From 91b0cba1459257a045d38ac8a27cb36a7caafa69 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 5 Mar 2023 14:10:21 +1100 Subject: [PATCH] [client] egl: switch from `mediump` to `highp` This fixes a rounding issue on certain hardware (NVidia) which actually implement mediump as half precision (16-bit) float. It's safe to assume `highp` is available as if the GPU does not support it, then the shader compiler will try to find a lower precision that is supported by the GPU --- client/renderers/EGL/shader/basic.vert | 2 +- client/renderers/EGL/shader/cursor.vert | 2 +- client/renderers/EGL/shader/cursor_mono.frag | 2 +- client/renderers/EGL/shader/cursor_rgb.frag | 2 +- client/renderers/EGL/shader/damage.frag | 2 +- client/renderers/EGL/shader/desktop.vert | 2 +- client/renderers/EGL/shader/desktop_rgb.frag | 2 +- client/renderers/EGL/shader/downscale.frag | 2 +- client/renderers/EGL/shader/downscale_lanczos2.frag | 2 +- client/renderers/EGL/shader/downscale_linear.frag | 2 +- client/renderers/EGL/shader/ffx_cas.frag | 2 +- client/renderers/EGL/shader/ffx_fsr1_easu.frag | 2 +- client/renderers/EGL/shader/ffx_fsr1_rcas.frag | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client/renderers/EGL/shader/basic.vert b/client/renderers/EGL/shader/basic.vert index 82153dbd..6e13d395 100644 --- a/client/renderers/EGL/shader/basic.vert +++ b/client/renderers/EGL/shader/basic.vert @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; layout(location = 0) in vec2 vertex; out vec2 fragCoord; diff --git a/client/renderers/EGL/shader/cursor.vert b/client/renderers/EGL/shader/cursor.vert index f1daca30..d7bf0eb8 100644 --- a/client/renderers/EGL/shader/cursor.vert +++ b/client/renderers/EGL/shader/cursor.vert @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 1) in vec2 vertexUV; diff --git a/client/renderers/EGL/shader/cursor_mono.frag b/client/renderers/EGL/shader/cursor_mono.frag index dfb5eb0b..99d54d64 100644 --- a/client/renderers/EGL/shader/cursor_mono.frag +++ b/client/renderers/EGL/shader/cursor_mono.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; in vec2 uv; out vec4 color; diff --git a/client/renderers/EGL/shader/cursor_rgb.frag b/client/renderers/EGL/shader/cursor_rgb.frag index 756aa357..cc4268a3 100644 --- a/client/renderers/EGL/shader/cursor_rgb.frag +++ b/client/renderers/EGL/shader/cursor_rgb.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; #include "color_blind.h" diff --git a/client/renderers/EGL/shader/damage.frag b/client/renderers/EGL/shader/damage.frag index 40e87de4..ebc01326 100644 --- a/client/renderers/EGL/shader/damage.frag +++ b/client/renderers/EGL/shader/damage.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; out vec4 color; diff --git a/client/renderers/EGL/shader/desktop.vert b/client/renderers/EGL/shader/desktop.vert index 24c2e163..36a22249 100644 --- a/client/renderers/EGL/shader/desktop.vert +++ b/client/renderers/EGL/shader/desktop.vert @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; layout(location = 0) in vec2 vertex; out vec2 uv; diff --git a/client/renderers/EGL/shader/desktop_rgb.frag b/client/renderers/EGL/shader/desktop_rgb.frag index 6b2c6f34..ed4ec1ad 100644 --- a/client/renderers/EGL/shader/desktop_rgb.frag +++ b/client/renderers/EGL/shader/desktop_rgb.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; #define EGL_SCALE_AUTO 0 #define EGL_SCALE_NEAREST 1 diff --git a/client/renderers/EGL/shader/downscale.frag b/client/renderers/EGL/shader/downscale.frag index 78614c25..2561ed7e 100644 --- a/client/renderers/EGL/shader/downscale.frag +++ b/client/renderers/EGL/shader/downscale.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; in vec2 fragCoord; out vec4 fragColor; diff --git a/client/renderers/EGL/shader/downscale_lanczos2.frag b/client/renderers/EGL/shader/downscale_lanczos2.frag index 9530e22f..08675f56 100644 --- a/client/renderers/EGL/shader/downscale_lanczos2.frag +++ b/client/renderers/EGL/shader/downscale_lanczos2.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; #define PI 3.141592653589793 diff --git a/client/renderers/EGL/shader/downscale_linear.frag b/client/renderers/EGL/shader/downscale_linear.frag index c68c39f0..e345c0e2 100644 --- a/client/renderers/EGL/shader/downscale_linear.frag +++ b/client/renderers/EGL/shader/downscale_linear.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; in vec2 fragCoord; out vec4 fragColor; diff --git a/client/renderers/EGL/shader/ffx_cas.frag b/client/renderers/EGL/shader/ffx_cas.frag index 4312bf21..5e799b2d 100644 --- a/client/renderers/EGL/shader/ffx_cas.frag +++ b/client/renderers/EGL/shader/ffx_cas.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; #include "compat.h" diff --git a/client/renderers/EGL/shader/ffx_fsr1_easu.frag b/client/renderers/EGL/shader/ffx_fsr1_easu.frag index d9e1ac14..2812a1cd 100644 --- a/client/renderers/EGL/shader/ffx_fsr1_easu.frag +++ b/client/renderers/EGL/shader/ffx_fsr1_easu.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; #include "compat.h" diff --git a/client/renderers/EGL/shader/ffx_fsr1_rcas.frag b/client/renderers/EGL/shader/ffx_fsr1_rcas.frag index 61f8f2f1..b7dc4881 100644 --- a/client/renderers/EGL/shader/ffx_fsr1_rcas.frag +++ b/client/renderers/EGL/shader/ffx_fsr1_rcas.frag @@ -1,5 +1,5 @@ #version 300 es -precision mediump float; +precision highp float; #include "compat.h"