Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradients are broken with the Mac driver of my integrated GPU #1368

Closed
mstange opened this issue Jun 12, 2017 · 11 comments
Closed

Gradients are broken with the Mac driver of my integrated GPU #1368

mstange opened this issue Jun 12, 2017 · 11 comments

Comments

@mstange
Copy link
Contributor

mstange commented Jun 12, 2017

On my machine, when the integrated GPU is use, repeating radial gradients are non-repeating, and non-repeating radial gradients are repeating. See bug 1372299 for testcases.

I'm on macOS 10.12.5 Beta (16F71b), Intel HD Graphics 530 1536 MB

@glennw
Copy link
Member

glennw commented Jun 12, 2017

It's possible that #1328 or #1348 may fix / work around this apparent driver bug. These changes modify how gradients are stored, into what is (probably) a more common driver path. After the next WR update lands in Gecko, we should check if this still occurs.

cc @staktrace

@staktrace
Copy link
Contributor

@mstange you can try the build from https://treeherder.mozilla.org/#/jobs?repo=try&revision=671e529cecd8e824a08cdcde17b14edbdb44cd98 which should have the above PRs to see if it fixes the problem.

@mstange
Copy link
Contributor Author

mstange commented Jun 13, 2017

I tested the build, and the bug is still present.

@kvark
Copy link
Member

kvark commented Jun 14, 2017

@mstange could you provide an apitrace/renderdoc capture?

@mstange
Copy link
Contributor Author

mstange commented Jun 15, 2017

Maybe, but it would be a bit of work.

I can reproduce this bug by pinning my GPU to the integrated one and then running cargo run show reftests/gradient/radial-circle.yaml. You could do the same and then capture whatever trace you want on your machine :)

@kvark
Copy link
Member

kvark commented Jun 15, 2017 via email

@kvark
Copy link
Member

kvark commented Jun 16, 2017

@mstange do the WR's reftests report any errors for you?

@mstange
Copy link
Contributor Author

mstange commented Jun 16, 2017

Yes, but unfortunately that's due to #1394. I'll retest once that bug is fixed.

@mstange
Copy link
Contributor Author

mstange commented Jun 29, 2017

I've now updated to the release version of 10.12.5, and the issue still happens.
If we can make a reduced testcase and submit a bug to Apple, they might fix it.

@mstange
Copy link
Contributor Author

mstange commented Sep 21, 2017

This shader change seems to "fix" the bug:

diff --git a/gfx/webrender/res/ps_radial_gradient.glsl b/gfx/webrender/res/ps_radial_gradient.glsl
--- a/gfx/webrender/res/ps_radial_gradient.glsl
+++ b/gfx/webrender/res/ps_radial_gradient.glsl
@@ -47,17 +47,17 @@ void main(void) {
     vStartCenter.y *= ratio_xy;
     vEndCenter.y *= ratio_xy;
     vTileSize.y *= ratio_xy;
     vTileRepeat.y *= ratio_xy;

     vGradientAddress = prim.specific_prim_address + VECS_PER_GRADIENT;

     // Whether to repeat the gradient instead of clamping.
-    vGradientRepeat = float(int(gradient.start_end_radius_ratio_xy_extend_mode.w) == EXTEND_MODE_REPEAT);
+    vGradientRepeat = float(int(gradient.start_end_radius_ratio_xy_extend_mode.w) != EXTEND_MODE_CLAMP);
 }
 #endif

 #ifdef WR_FRAGMENT_SHADER
 void main(void) {
     vec2 pos = mod(vPos, vTileRepeat);

     if (pos.x >= vTileSize.x ||

Very similar to #1728 (comment).

@mstange
Copy link
Contributor Author

mstange commented Sep 21, 2017

My integrated GPU shows the same type of bug for linear gradients, and making the same corresponding change to ps_angle_gradient.glsl fixes that one as well.

mstange added a commit to mstange/webrender that referenced this issue Sep 21, 2017
bors-servo pushed a commit that referenced this issue Sep 21, 2017
Add workarounds for a driver bug that seems to cause shaders to be miscompiled.

Fixes #1368.
Fixes #1728.

<!-- 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/1740)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants