Intel miscompiles GTK shader
This is https://gitlab.gnome.org/GNOME/gtk/-/issues/6321
This line seems to trigger a miscompilation, reliably on Vulkan with the generated SPIRV, but also for some people (including me) with GL.
The problem does happen with Mesa 23.3 on stock F39 as well as git main. It does not happen on AMD or nvidia's proprietary driver.
The same function is used in 2 other shaders, both exhibit the same problem.
I can make the failure go away (on all 3 shaders and with Vulkan and GL) by applying this diff:
diff --git a/gsk/gpu/shaders/gskgpulineargradient.glsl b/gsk/gpu/shaders/gskgpulineargradient.glsl
index 7b4bb4e248..955f506123 100644
--- a/gsk/gpu/shaders/gskgpulineargradient.glsl
+++ b/gsk/gpu/shaders/gskgpulineargradient.glsl
@@ -75,7 +75,7 @@ get_gradient_color (float offset)
if (offset <= _offsets0[0])
color = _color0;
else
- color = mix (_color0, _color1, (offset - _offsets0[0]) / (_offsets0[1] - _offsets0[0]));
+ color = mix (_color0, _color1, (_offsets0[0] - offset) / (_offsets0[0] - _offsets0[1]));
}
else
{
To reproduce, you need GTK main or 4.13.5. Run demos/node-editor/gtk4-node-editor
(it should work uninstalled), clear the text field on the left and type linear-gradient {}
into it. Observe the sidebar, in particular the rendering below the "Vulkan" label. It should now look something like this:
The expected output would be that all renderers in the sidebar produce the same output: