Bug 1505871. Work around a suspected shader miscompilation on Windows. r=gw
☠☠ backed out by 3c030119c0dc ☠ ☠
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 25 Feb 2019 19:20:28 -0600
changeset 518990 6486435a048dba1d6bfb5fbc6442c0cce2350332
parent 518989 9be871042749e932076d769de91a01bfbd696796
child 518991 045ab0ec361396705590c5bbcc93e828481ae4e3
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1505871
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1505871. Work around a suspected shader miscompilation on Windows. r=gw On Windows the vFuncs array is always 0 in the fragment shader. If we move the computation of the vFuncs array outside of the switch (so that it is computed for every type of shader, even when it is not needed) then it works.
gfx/wr/webrender/res/brush_blend.glsl
--- a/gfx/wr/webrender/res/brush_blend.glsl
+++ b/gfx/wr/webrender/res/brush_blend.glsl
@@ -61,16 +61,26 @@ void brush_vs(
     float oneMinusLumB = 1.0 - lumB;
 
     float amount = float(user_data.z) / 65536.0;
     float invAmount = 1.0 - amount;
 
     vOp = user_data.y & 0xffff;
     vAmount = amount;
 
+    // This assignment is only used for component transfer filters but this
+    // assignment has to be done here and not in the component transfer case
+    // below because it doesn't get executed on Windows because of a suspected
+    // miscompile of this shader on Windows. See
+    // https://github.com/servo/webrender/wiki/Driver-issues#bug-1505871---assignment-to-varying-flat-arrays-inside-switch-statement-of-vertex-shader-suspected-miscompile-on-windows
+    vFuncs[0] = (user_data.y >> 28) & 0xf; // R
+    vFuncs[1] = (user_data.y >> 24) & 0xf; // G
+    vFuncs[2] = (user_data.y >> 20) & 0xf; // B
+    vFuncs[3] = (user_data.y >> 16) & 0xf; // A
+
     switch (vOp) {
         case 2: {
             // Grayscale
             vColorMat = mat3(
                 vec3(lumR + oneMinusLumR * invAmount, lumR - lumR * invAmount, lumR - lumR * invAmount),
                 vec3(lumG - lumG * invAmount, lumG + oneMinusLumG * invAmount, lumG - lumG * invAmount),
                 vec3(lumB - lumB * invAmount, lumB - lumB * invAmount, lumB + oneMinusLumB * invAmount)
             );
@@ -115,20 +125,16 @@ void brush_vs(
             vec4 offset_data = fetch_from_gpu_cache_1(user_data.z + 4);
             vColorMat = mat3(mat_data[0].xyz, mat_data[1].xyz, mat_data[2].xyz);
             vColorOffset = offset_data.rgb;
             break;
         }
         case 13: {
             // Component Transfer
             vTableAddress = user_data.z;
-            vFuncs[0] = (user_data.y >> 28) & 0xf; // R
-            vFuncs[1] = (user_data.y >> 24) & 0xf; // G
-            vFuncs[2] = (user_data.y >> 20) & 0xf; // B
-            vFuncs[3] = (user_data.y >> 16) & 0xf; // A
             break;
         }
         default: break;
     }
 }
 #endif
 
 #ifdef WR_FRAGMENT_SHADER