Skip to content

Commit

Permalink
fix a precision problem in sbuftex-sapp.glsl
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed May 6, 2024
1 parent 902dcbe commit 05a45cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sapp/sbuftex-sapp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 05a45cd

Please sign in to comment.