From 28c4adac24bf6b16cf2f2f0bf2dec79aca33d98c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 25 Dec 2020 01:21:08 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20gtk4-demo=E2=80=99s=20gears=20demo=20on?= =?UTF-8?q?=20OpenGL=C2=A0ES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here is a command to reproduce this testcase: GDK_DEBUG=gl-gles gtk4-demo --run gears Without this patch, Mesa throws this compile error: 0:130(13): error: no matching function for call to `mod(error, float)'; candidates are: This is caused by `u_rotation - 90` being of type error since `u_rotation` is a float and it’s illegal to subtract it with an integer. --- gsk/resources/glsl/conic_gradient.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gsk/resources/glsl/conic_gradient.glsl b/gsk/resources/glsl/conic_gradient.glsl index e9dee73e07..7f73508a3f 100644 --- a/gsk/resources/glsl/conic_gradient.glsl +++ b/gsk/resources/glsl/conic_gradient.glsl @@ -15,8 +15,8 @@ void main() { gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0); // The -90 is because conics point to the top by default - rotation = mod (u_rotation - 90, 360.0); - if (rotation < 0) + rotation = mod (u_rotation - 90.0, 360.0); + if (rotation < 0.0) rotation += 360.0; rotation = PI / 180.0 * rotation; @@ -55,7 +55,7 @@ void main() { angle -= rotation; // fract() does the modulo here, so now we have progress // into the current conic - float offset = fract (angle / 2 / PI + 2); + float offset = fract (angle / 2.0 / PI + 2.0); vec4 color = color_stops[0]; for (int i = 1; i < u_num_color_stops; i ++) {