Skip to content

Commit

Permalink
Add workarounds for a driver bug that seems to cause shaders to be mi…
Browse files Browse the repository at this point in the history
…scompiled.

Fixes #1368.
Fixes #1728.
  • Loading branch information
mstange committed Sep 21, 2017
1 parent a29eed7 commit 917da3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion webrender/res/prim_shared.glsl
Expand Up @@ -281,7 +281,9 @@ Glyph fetch_glyph(int specific_prim_address,
glyph_index / 2;
vec4 data = fetch_from_resource_cache_1(glyph_address);
// Select XY or ZW based on glyph index.
vec2 glyph = mix(data.xy, data.zw, bvec2(glyph_index % 2 == 1));
// We use "!= 0" instead of "== 1" here in order to work around a driver
// bug with equality comparisons on integers.
vec2 glyph = mix(data.xy, data.zw, bvec2(glyph_index % 2 != 0));

// In subpixel mode, the subpixel offset has already been
// accounted for while rasterizing the glyph.
Expand Down
2 changes: 1 addition & 1 deletion webrender/res/ps_angle_gradient.glsl
Expand Up @@ -42,7 +42,7 @@ void main(void) {
vGradientAddress = prim.specific_prim_address + VECS_PER_GRADIENT;

// Whether to repeat the gradient instead of clamping.
vGradientRepeat = float(int(gradient.extend_mode.x) == EXTEND_MODE_REPEAT);
vGradientRepeat = float(int(gradient.extend_mode.x) != EXTEND_MODE_CLAMP);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion webrender/res/ps_radial_gradient.glsl
Expand Up @@ -52,7 +52,7 @@ void main(void) {
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

Expand Down

0 comments on commit 917da3c

Please sign in to comment.