From 086e1ed39f1d4d3b27398d23f0573be6a7a0b7ee Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 24 Mar 2021 09:30:02 -0400 Subject: [PATCH] ngl: Fix crash with intel driver on Windows when compiling shaders Fixes #3783. --- gsk/ngl/resources/conic_gradient.glsl | 5 ++++- gsk/ngl/resources/linear_gradient.glsl | 5 ++++- gsk/ngl/resources/radial_gradient.glsl | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gsk/ngl/resources/conic_gradient.glsl b/gsk/ngl/resources/conic_gradient.glsl index 3a26cf9563..3df33bcb11 100644 --- a/gsk/ngl/resources/conic_gradient.glsl +++ b/gsk/ngl/resources/conic_gradient.glsl @@ -32,7 +32,10 @@ uniform float u_color_stops[MAX_COLOR_STOPS * 5]; _NOPERSPECTIVE_ _IN_ vec2 coord; float get_offset(int index) { - return u_color_stops[5 * index]; + // u_color_stops[5 * index] makes Intel Windows driver crash. + // See https://gitlab.gnome.org/GNOME/gtk/-/issues/3783 + int base = 5 * index; + return u_color_stops[base]; } vec4 get_color(int index) { diff --git a/gsk/ngl/resources/linear_gradient.glsl b/gsk/ngl/resources/linear_gradient.glsl index c4dfb53722..153d7afc98 100644 --- a/gsk/ngl/resources/linear_gradient.glsl +++ b/gsk/ngl/resources/linear_gradient.glsl @@ -56,7 +56,10 @@ uniform bool u_repeat; _NOPERSPECTIVE_ _IN_ vec4 info; float get_offset(int index) { - return u_color_stops[5 * index]; + // u_color_stops[5 * index] makes Intel Windows driver crash. + // See https://gitlab.gnome.org/GNOME/gtk/-/issues/3783 + int base = 5 * index; + return u_color_stops[base]; } vec4 get_color(int index) { diff --git a/gsk/ngl/resources/radial_gradient.glsl b/gsk/ngl/resources/radial_gradient.glsl index 5990b39a84..4311fc5d63 100644 --- a/gsk/ngl/resources/radial_gradient.glsl +++ b/gsk/ngl/resources/radial_gradient.glsl @@ -35,7 +35,10 @@ uniform float u_color_stops[MAX_COLOR_STOPS * 5]; _NOPERSPECTIVE_ _IN_ vec2 coord; float get_offset(int index) { - return u_color_stops[5 * index]; + // u_color_stops[5 * index] makes Intel Windows driver crash. + // See https://gitlab.gnome.org/GNOME/gtk/-/issues/3783 + int base = 5 * index; + return u_color_stops[base]; } vec4 get_color(int index) {