From 05a45cd09edb5a1f8db63792049a459e7a8d88b2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 6 May 2024 19:02:06 +0200 Subject: [PATCH] fix a precision problem in sbuftex-sapp.glsl --- sapp/sbuftex-sapp.glsl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sapp/sbuftex-sapp.glsl b/sapp/sbuftex-sapp.glsl index f413b571..615c8721 100644 --- a/sapp/sbuftex-sapp.glsl +++ b/sapp/sbuftex-sapp.glsl @@ -19,7 +19,9 @@ out vec3 uv_idx; void main() { gl_Position = mvp * vec4(vtx[gl_VertexIndex].pos, 1.0); - uv_idx = vec3(vtx[gl_VertexIndex].uv, float(vtx[gl_VertexIndex].idx)); + // need to add a bit of wiggle room here to prevent a precision problem on NVIDIA + // down in the pixel shader + uv_idx = vec3(vtx[gl_VertexIndex].uv, float(vtx[gl_VertexIndex].idx) + 0.5); } @end