From 248179a82c4272e907ffa11b1861adc8bb61b67f Mon Sep 17 00:00:00 2001 From: Hydrox Date: Wed, 10 Jun 2020 04:36:00 +0100 Subject: [PATCH] gpu: fix major visual glitches on linux (#11389) Putting this if statement behind `localId < size` causes major visual glitches with the Mesa graphics driver on AMD cards. We think this is a compiler bug as this change shouldn't be affecting anything. --- .../client/plugins/gpu/priority_render.glsl | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl index 8a3d4474d2..90af8d41f0 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl @@ -113,28 +113,35 @@ int count_prio_offset(int priority) { void get_face(uint localId, modelinfo minfo, int cameraYaw, int cameraPitch, out int prio, out int dis, out ivec4 o1, out ivec4 o2, out ivec4 o3) { int size = minfo.size; + int offset = minfo.offset; + int flags = minfo.flags; + uint ssboOffset; + + if (localId < size) { + ssboOffset = localId; + } else { + ssboOffset = 0; + } + + ivec4 thisA; + ivec4 thisB; + ivec4 thisC; + + // Grab triangle vertices from the correct buffer + if (flags < 0) { + thisA = vb[offset + ssboOffset * 3]; + thisB = vb[offset + ssboOffset * 3 + 1]; + thisC = vb[offset + ssboOffset * 3 + 2]; + } else { + thisA = tempvb[offset + ssboOffset * 3]; + thisB = tempvb[offset + ssboOffset * 3 + 1]; + thisC = tempvb[offset + ssboOffset * 3 + 2]; + } if (localId < size) { - int offset = minfo.offset; - int flags = minfo.flags; int radius = (flags & 0x7fffffff) >> 12; int orientation = flags & 0x7ff; - ivec4 thisA; - ivec4 thisB; - ivec4 thisC; - - // Grab triangle vertices from the correct buffer - if (flags < 0) { - thisA = vb[offset + localId * 3]; - thisB = vb[offset + localId * 3 + 1]; - thisC = vb[offset + localId * 3 + 2]; - } else { - thisA = tempvb[offset + localId * 3]; - thisB = tempvb[offset + localId * 3 + 1]; - thisC = tempvb[offset + localId * 3 + 2]; - } - // rotate for model orientation ivec4 thisrvA = rotate(thisA, orientation); ivec4 thisrvB = rotate(thisB, orientation);