diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index be03f0c4ad4..95cc533b229 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -1778,7 +1778,7 @@ else if (offsetModel.getSceneId() == sceneId) buffer.put(uvOffset); buffer.put(tc); buffer.put(targetBufferOffset); - buffer.put(FLAG_SCENE_BUFFER | (hillskew ? (1 << 26) : 0) | (plane << 24) | (model.getRadius() << 12) | orientation); + buffer.put(FLAG_SCENE_BUFFER | (hillskew ? (1 << 26) : 0) | (plane << 24) | orientation); buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2()); targetBufferOffset += tc * 3; @@ -1812,7 +1812,7 @@ else if (offsetModel.getSceneId() == sceneId) buffer.put(hasUv ? tempUvOffset : -1); buffer.put(len / 3); buffer.put(targetBufferOffset); - buffer.put((model.getRadius() << 12) | orientation); + buffer.put(orientation); buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2()); tempOffset += len; diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/cl_types.cl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/cl_types.cl index 658ee06f4e4..be1d703a0a6 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/cl_types.cl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/cl_types.cl @@ -40,7 +40,7 @@ struct shared_data { int totalDistance[12]; // sum of distances to faces of a given priority int totalMappedNum[18]; // number of faces with a given adjusted priority int min10; // minimum distance to a face of priority 10 - uint renderPris[0]; // packed distance and face id + int renderPris[0]; // priority for face draw order }; struct modelinfo { @@ -48,7 +48,7 @@ struct modelinfo { int toffset; // offset into texture buffer int size; // length in faces int idx; // write idx in target buffer - int flags; // buffer, hillskew, plane, radius, orientation + int flags; // buffer, hillskew, plane, orientation int x; // scene position x int y; // scene position y int z; // scene position z diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl index 624d6621133..9354fa4f749 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl @@ -32,8 +32,8 @@ shared int totalDistance[12]; // sum of distances to faces of a given priority shared int totalMappedNum[18]; // number of faces with a given adjusted priority -shared int min10; // minimum distance to a face of priority 10 -shared uint renderPris[THREAD_COUNT * FACES_PER_THREAD]; // packed distance and face id +shared int min10; // minimum distance to a face of priority 10 +shared int renderPris[THREAD_COUNT * FACES_PER_THREAD]; // priority for face draw order #include "comp_common.glsl" diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl index 26137713107..f751476bed5 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl @@ -43,7 +43,7 @@ struct modelinfo { int toffset; // offset into texture buffer int size; // length in faces int idx; // write idx in target buffer - int flags; // buffer, hillskew, plane, radius, orientation + int flags; // buffer, hillskew, plane, orientation int x; // scene position x int y; // scene position y int z; // scene position z diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.cl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.cl index 4329618d21d..534ba8adb2a 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.cl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.cl @@ -119,7 +119,6 @@ void get_face(__local struct shared_data *shared, __constant struct uniform *uni } if (localId < size) { - int radius = (flags >> 12) & 0xfff; int orientation = flags & 0x7ff; // rotate for model orientation @@ -129,12 +128,7 @@ void get_face(__local struct shared_data *shared, __constant struct uniform *uni // calculate distance to face int thisPriority = (thisA.w >> 16) & 0xff; // all vertices on the face have the same priority - int thisDistance; - if (radius == 0) { - thisDistance = 0; - } else { - thisDistance = face_distance(thisrvA, thisrvB, thisrvC, cameraYaw, cameraPitch) + radius; - } + int thisDistance = face_distance(thisrvA, thisrvB, thisrvC, cameraYaw, cameraPitch); *o1 = thisrvA; *o2 = thisrvB; @@ -206,15 +200,15 @@ void insert_face(__local struct shared_data *shared, uint localId, struct modeli if (localId < size) { // calculate base offset into renderPris based on number of faces with a lower priority int baseOff = count_prio_offset(shared, adjPrio); - // the furthest faces draw first, and have the highest value + // the furthest faces draw first, and have the highest priority. // if two faces have the same distance, the one with the - // lower id draws first - shared->renderPris[baseOff + prioIdx] = ((uint)(distance << 16)) | (~localId & 0xffffu); + // lower id draws first. + shared->renderPris[baseOff + prioIdx] = distance << 16 | (int)(~localId & 0xffffu); } } int tile_height(read_only image3d_t tileHeightImage, int z, int x, int y) { -#define ESCENE_OFFSET 40 // (184-104)/2 +#define ESCENE_OFFSET 40 // (184-104)/2 const sampler_t tileHeightSampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE; int4 coord = (int4)(x + ESCENE_OFFSET, y + ESCENE_OFFSET, z, 0); return read_imagei(tileHeightImage, tileHeightSampler, coord).x << 3; @@ -250,7 +244,7 @@ void sort_and_insert(__local struct shared_data *shared, __constant struct unifo const int numOfPriority = shared->totalMappedNum[thisPriority]; const int start = priorityOffset; // index of first face with this priority const int end = priorityOffset + numOfPriority; // index of last face with this priority - const uint renderPriority = ((uint)(thisDistance << 16)) | (~localId & 0xffffu); + const int renderPriority = thisDistance << 16 | (int)(~localId & 0xffffu); int myOffset = priorityOffset; // calculate position this face will be in 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 d68a1ef9fa3..d169b4341bb 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 @@ -119,7 +119,6 @@ void get_face(uint localId, modelinfo minfo, float cameraYaw, float cameraPitch, } if (localId < size) { - int radius = (flags >> 12) & 0xfff; int orientation = flags & 0x7ff; // rotate for model orientation @@ -129,12 +128,7 @@ void get_face(uint localId, modelinfo minfo, float cameraYaw, float cameraPitch, // calculate distance to face int thisPriority = (thisA.w >> 16) & 0xff; // all vertices on the face have the same priority - int thisDistance; - if (radius == 0) { - thisDistance = 0; - } else { - thisDistance = face_distance(thisrvA, thisrvB, thisrvC, cameraYaw, cameraPitch) + radius; - } + int thisDistance = face_distance(thisrvA, thisrvB, thisrvC, cameraYaw, cameraPitch); o1 = thisrvA; o2 = thisrvB; @@ -205,15 +199,15 @@ void insert_face(uint localId, modelinfo minfo, int adjPrio, int distance, int p if (localId < size) { // calculate base offset into renderPris based on number of faces with a lower priority int baseOff = count_prio_offset(adjPrio); - // the furthest faces draw first, and have the highest value + // the furthest faces draw first, and have the highest priority. // if two faces have the same distance, the one with the - // lower id draws first - renderPris[baseOff + prioIdx] = uint(distance << 16) | (~localId & 0xffffu); + // lower id draws first. + renderPris[baseOff + prioIdx] = distance << 16 | int(~localId & 0xffffu); } } int tile_height(int z, int x, int y) { -#define ESCENE_OFFSET 40 // (184-104)/2 +#define ESCENE_OFFSET 40 // (184-104)/2 return texelFetch(tileHeightSampler, ivec3(x + ESCENE_OFFSET, y + ESCENE_OFFSET, z), 0).r << 3; } @@ -245,7 +239,7 @@ void sort_and_insert(uint localId, modelinfo minfo, int thisPriority, int thisDi const int numOfPriority = totalMappedNum[thisPriority]; const int start = priorityOffset; // index of first face with this priority const int end = priorityOffset + numOfPriority; // index of last face with this priority - const uint renderPriority = uint(thisDistance << 16) | (~localId & 0xffffu); + const int renderPriority = thisDistance << 16 | int(~localId & 0xffffu); int myOffset = priorityOffset; // calculate position this face will be in