Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWork around an apparent driver bug that caused wrong corner radii. #1810
Conversation
|
Fun! Could you add a comment in that shader code just outlining roughly what's in the commit message and then r=me. Thanks for digging into it! |
|
I added this to the driver issues page. Unfortunately my descriptions of the problem and resolution are super vague, if you have any idea how to better explain this for future reference don't hesitate to fill in the blanks. |
|
omg, this is an aweful bug |
|
Here's an alternative fix that also works: diff --git a/webrender/res/cs_clip_rectangle.glsl b/webrender/res/cs_clip_rectangle.glsl
--- a/webrender/res/cs_clip_rectangle.glsl
+++ b/webrender/res/cs_clip_rectangle.glsl
@@ -27,8 +27,8 @@ struct ClipCorner {
vec4 outer_inner_radius;
};
-ClipCorner fetch_clip_corner(ivec2 address, int index) {
- address += ivec2(2 + 2 * index, 0);
+ClipCorner fetch_clip_corner(ivec2 address, float index) {
+ address += ivec2(2 + 2 * int(index), 0);
vec4 data[2] = fetch_from_resource_cache_2_direct(address);
return ClipCorner(RectWithSize(data[0].xy, data[0].zw), data[1]);
}It looks like what's broken is: reading from integer variables (or integer arguments) when doing any kind of integer calculation, in the right circumstances. If I store the number in a float, everything works. If I do the calculation without making use of an integer variable as part of the inputs of that calculation, things work as well. I'll stick with the original fix though, and I'll add a comment. |
leeoniya
commented
Oct 5, 2017
|
those pesky integers are at it again? #1728 (comment) |
Using the driver of the Intel GPU in my Macbook Pro (Intel HD Graphics 530 1536 MB, 0x191b, Skylake GT2) on macOS 10.12.6, the integer calculation that was used in order to compute the lookup address gave wrong results, and the corner radius for the wrong corner was looked up. The only way to get correct results from it was to move the entire adjustment of the address ivec2 variable into the caller. Now all values in the calculations were integer literals. I then replaced the multiplications with gradual "+= 2" adjustments of the address variable in fetch_clip, because that looked better and might even be easier to reason about than the original code.
|
They sure are. And there's still at least one more instance of this problem left to find (#1738). |
|
@bors-servo r+ |
|
|
Work around an apparent driver bug that caused wrong corner radii. Fixes #1809. Using the driver of the Intel GPU in my Macbook Pro (Intel HD Graphics 530 1536 MB, 0x191b, Skylake GT2) on macOS 10.12.6, the integer calculation that was used in order to compute the lookup address gave wrong results, and the corner radius for the wrong corner was looked up. The only way to get correct results from it was to move the entire adjustment of the address ivec2 variable into the caller. Now all values in the calculations were integer literals. I then replaced the multiplications with gradual "+= 2" adjustments of the address variable in fetch_clip, because that looked better and might even be easier to reason about than the original code. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1810) <!-- Reviewable:end -->
|
|
Use a different workaround that fixes both #1809 and #1738. This reverts #1810 and applies the alternative workaround that I gave in #1810 (comment) , because this alternative workaround also happens to fix #1738. I was hesitant to create this PR because I haven't debugged #1738 enough to understand what's going wrong. But there is probably no good reason to delay fixing this until somebody does the investigation. r? @kvark <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1915) <!-- Reviewable:end -->
mstange commentedOct 5, 2017
•
edited by larsbergstrom
Fixes #1809.
Using the driver of the Intel GPU in my Macbook Pro (Intel HD Graphics 530
1536 MB, 0x191b, Skylake GT2) on macOS 10.12.6, the integer calculation that was
used in order to compute the lookup address gave wrong results, and the corner
radius for the wrong corner was looked up.
The only way to get correct results from it was to move the entire adjustment of
the address ivec2 variable into the caller. Now all values in the calculations
were integer literals.
I then replaced the multiplications with gradual "+= 2" adjustments of the
address variable in fetch_clip, because that looked better and might even be
easier to reason about than the original code.
This change is