-
Bug
-
Resolution: Fixed
-
P3
-
8
Related to RT-32250, this issue was discovered while analyzing Ensemble performance. If I have two rectangles and 100K circles packed between them, and the bottom rectangle changes (animate the color) and the top rectangle is fully opaque, and both rectangles are exactly the same size and all circles are fully hidden by the top-most rectangle, then I would expect that the dirty root (if any were needed at all, see RT-32250 for a discussion of that) would be the top-most rectangle. Instead, it is null.
The problem is this region.contains check in setCullBits:
protected int setCullBits(BaseBounds bounds, int regionIndex, RectBounds region) {
int b = 0;
if (region != null && !region.isEmpty()) {
if (region.intersects(bounds)) {
b = 1;
if (region.contains(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight())) {
b = 2;
}
cullingBits = cullingBits | (b << (2 * regionIndex));
}
}
return b;
}
The problem is that if the region size exactly matches that of the bounds, it should be set with cull bit 1, but is instead being set with cull bit 2, because region.contains answers true if both values are equal. The best thing to do is to just make sure that region & bounds are not equal before going into this contains check.
BTW, please add comments to cullingBits in NGNode so that it is clear how they are used and what the bit positions mean. I'm doing my best to understand but it isn't clear.
The problem is this region.contains check in setCullBits:
protected int setCullBits(BaseBounds bounds, int regionIndex, RectBounds region) {
int b = 0;
if (region != null && !region.isEmpty()) {
if (region.intersects(bounds)) {
b = 1;
if (region.contains(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight())) {
b = 2;
}
cullingBits = cullingBits | (b << (2 * regionIndex));
}
}
return b;
}
The problem is that if the region size exactly matches that of the bounds, it should be set with cull bit 1, but is instead being set with cull bit 2, because region.contains answers true if both values are equal. The best thing to do is to just make sure that region & bounds are not equal before going into this contains check.
BTW, please add comments to cullingBits in NGNode so that it is clear how they are used and what the bit positions mean. I'm doing my best to understand but it isn't clear.
- relates to
-
JDK-8117746 Bad occlusion culling analysis leads to rendering that should not happen
-
- Resolved
-