[gtk: 1/3] Fix gtk4-demo’s gears demo on OpenGL ES
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/3] Fix gtk4-demo’s gears demo on OpenGL ES
- Date: Fri, 25 Dec 2020 01:36:36 +0000 (UTC)
commit 28c4adac24bf6b16cf2f2f0bf2dec79aca33d98c
Author: Emmanuel Gil Peyrot <linkmauve linkmauve fr>
Date: Fri Dec 25 01:21:08 2020 +0100
Fix gtk4-demo’s gears demo on OpenGL ES
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 ++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]