From d3ad1b4d01a87c23a578b5edfdde0e44a2f5e4f5 Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Sat, 30 Dec 2023 23:22:47 +0100 Subject: [PATCH] Use bitwise operations to extract data from gl_vertexID. This seems to fix problems for some people, probably fixing some rare hardware bug here. --- assets/cubyz/shaders/chunks/chunk_vertex.vs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/cubyz/shaders/chunks/chunk_vertex.vs b/assets/cubyz/shaders/chunks/chunk_vertex.vs index a42dbf04..1a70c56c 100644 --- a/assets/cubyz/shaders/chunks/chunk_vertex.vs +++ b/assets/cubyz/shaders/chunks/chunk_vertex.vs @@ -121,8 +121,8 @@ int convertNormal(int normal, mat3 permutationMatrix, vec3 mirrorVector) { } void main() { - int faceID = gl_VertexID/4; - int vertexID = gl_VertexID%4; + int faceID = gl_VertexID >> 2; + int vertexID = gl_VertexID & 3; int encodedPositionAndNormalsAndPermutation = faceData[faceID].encodedPositionAndNormalsAndPermutation; int blockAndModel = faceData[faceID].blockAndModel; int fullLight = faceData[faceID].light[vertexID];