Skip to content

Commit

Permalink
Merge branch '1.10.18.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
zeruth committed Jan 1, 2024
2 parents 0a7c8d7 + 552c371 commit c57cc14
Show file tree
Hide file tree
Showing 20 changed files with 280 additions and 236 deletions.
2 changes: 1 addition & 1 deletion cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.18.1</version>
<version>1.10.18.2</version>
</parent>

<artifactId>cache</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.18.1</version>
<version>1.10.18.2</version>
<packaging>pom</packaging>

<name>RuneLite</name>
Expand Down Expand Up @@ -62,7 +62,7 @@
<url>https://github.com/runelite/runelite</url>
<connection>scm:git:git://github.com/runelite/runelite</connection>
<developerConnection>scm:git:[email protected]:runelite/runelite</developerConnection>
<tag>runelite-parent-1.10.18.1</tag>
<tag>runelite-parent-1.10.18.2</tag>
</scm>

<developers>
Expand Down
2 changes: 1 addition & 1 deletion runelite-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.18.1</version>
<version>1.10.18.2</version>
</parent>

<artifactId>runelite-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion runelite-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.18.1</version>
<version>1.10.18.2</version>
</parent>

<artifactId>client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,7 @@ enum ComputeMode

private final GLBuffer uniformBuffer = new GLBuffer("uniform buffer");

private final IntBuffer uniformBuf = ByteBuffer.allocateDirect(32 * Integer.BYTES)
.order(ByteOrder.nativeOrder())
.asIntBuffer();

private GpuFloatBuffer vertexBuffer;
private GpuIntBuffer vertexBuffer;
private GpuFloatBuffer uvBuffer;

private GpuIntBuffer modelBufferUnordered;
Expand Down Expand Up @@ -280,7 +276,7 @@ enum ComputeMode

private int sceneId;
private int nextSceneId;
private GpuFloatBuffer nextSceneVertexBuffer;
private GpuIntBuffer nextSceneVertexBuffer;
private GpuFloatBuffer nextSceneTexBuffer;

@Override
Expand Down Expand Up @@ -368,7 +364,7 @@ protected void startUp()
}
}

vertexBuffer = new GpuFloatBuffer();
vertexBuffer = new GpuIntBuffer();
uvBuffer = new GpuFloatBuffer();

modelBufferUnordered = new GpuIntBuffer();
Expand Down Expand Up @@ -667,29 +663,23 @@ private void initVao()

GL43C.glEnableVertexAttribArray(0);
GL43C.glBindBuffer(GL43C.GL_ARRAY_BUFFER, tmpOutBuffer.glBufferId);
GL43C.glVertexAttribPointer(0, 3, GL43C.GL_FLOAT, false, 16, 0);
GL43C.glVertexAttribIPointer(0, 4, GL43C.GL_INT, 0, 0);

GL43C.glEnableVertexAttribArray(1);
GL43C.glVertexAttribIPointer(1, 1, GL43C.GL_INT, 16, 12);

GL43C.glEnableVertexAttribArray(2);
GL43C.glBindBuffer(GL43C.GL_ARRAY_BUFFER, tmpOutUvBuffer.glBufferId);
GL43C.glVertexAttribPointer(2, 4, GL43C.GL_FLOAT, false, 0, 0);
GL43C.glVertexAttribPointer(1, 4, GL43C.GL_FLOAT, false, 0, 0);

// Create temp VAO
vaoTemp = GL43C.glGenVertexArrays();
GL43C.glBindVertexArray(vaoTemp);

GL43C.glEnableVertexAttribArray(0);
GL43C.glBindBuffer(GL43C.GL_ARRAY_BUFFER, tmpVertexBuffer.glBufferId);
GL43C.glVertexAttribPointer(0, 3, GL43C.GL_FLOAT, false, 16, 0);
GL43C.glVertexAttribIPointer(0, 4, GL43C.GL_INT, 0, 0);

GL43C.glEnableVertexAttribArray(1);
GL43C.glVertexAttribIPointer(1, 1, GL43C.GL_INT, 16, 12);

GL43C.glEnableVertexAttribArray(2);
GL43C.glBindBuffer(GL43C.GL_ARRAY_BUFFER, tmpUvBuffer.glBufferId);
GL43C.glVertexAttribPointer(2, 4, GL43C.GL_FLOAT, false, 0, 0);
GL43C.glVertexAttribPointer(1, 4, GL43C.GL_FLOAT, false, 0, 0);

// Create UI VAO
vaoUiHandle = GL43C.glGenVertexArrays();
Expand Down Expand Up @@ -807,7 +797,20 @@ private void shutdownInterfaceTexture()
private void initUniformBuffer()
{
initGlBuffer(uniformBuffer);
updateBuffer(uniformBuffer, GL43C.GL_UNIFORM_BUFFER, 32, GL43C.GL_DYNAMIC_DRAW, CL12.CL_MEM_READ_ONLY);

IntBuffer uniformBuf = GpuIntBuffer.allocateDirect(8 + 2048 * 4);
uniformBuf.put(new int[8]); // uniform block
final int[] pad = new int[2];
for (int i = 0; i < 2048; i++)
{
uniformBuf.put(Perspective.SINE[i]);
uniformBuf.put(Perspective.COSINE[i]);
uniformBuf.put(pad); // ivec2 alignment in std140 is 16 bytes
}
uniformBuf.flip();

updateBuffer(uniformBuffer, GL43C.GL_UNIFORM_BUFFER, uniformBuf, GL43C.GL_DYNAMIC_DRAW, CL12.CL_MEM_READ_ONLY);
GL43C.glBindBuffer(GL43C.GL_UNIFORM_BUFFER, 0);
}

private void initAAFbo(int width, int height, int aaSamples)
Expand Down Expand Up @@ -877,8 +880,11 @@ public void drawScene(double cameraX, double cameraY, double cameraZ, double cam
// viewport buffer.
targetBufferOffset = 0;

// UBO.
uniformBuf.clear();
// UBO. Only the first 32 bytes get modified here, the rest is the constant sin/cos table.
// We can reuse the vertex buffer since it isn't used yet.
vertexBuffer.clear();
vertexBuffer.ensureCapacity(32);
IntBuffer uniformBuf = vertexBuffer.getBuffer();
uniformBuf
.put(Float.floatToIntBits((float) cameraYaw))
.put(Float.floatToIntBits((float) cameraPitch))
Expand Down Expand Up @@ -909,7 +915,7 @@ public void postDrawScene()
vertexBuffer.flip();
uvBuffer.flip();

FloatBuffer vertexBuffer = this.vertexBuffer.getBuffer();
IntBuffer vertexBuffer = this.vertexBuffer.getBuffer();
FloatBuffer uvBuffer = this.uvBuffer.getBuffer();

updateBuffer(tmpVertexBuffer, GL43C.GL_ARRAY_BUFFER, vertexBuffer, GL43C.GL_DYNAMIC_DRAW, 0L);
Expand All @@ -926,7 +932,7 @@ public void postDrawScene()
modelBufferSmall.flip();
modelBufferUnordered.flip();

FloatBuffer vertexBuffer = this.vertexBuffer.getBuffer();
IntBuffer vertexBuffer = this.vertexBuffer.getBuffer();
FloatBuffer uvBuffer = this.uvBuffer.getBuffer();
IntBuffer modelBuffer = this.modelBuffer.getBuffer();
IntBuffer modelBufferSmall = this.modelBufferSmall.getBuffer();
Expand All @@ -944,7 +950,7 @@ public void postDrawScene()
// Output buffers
updateBuffer(tmpOutBuffer,
GL43C.GL_ARRAY_BUFFER,
targetBufferOffset * 16, // each element is a vec4, which is 16 bytes
targetBufferOffset * 16, // each element is an ivec4, which is 16 bytes
GL43C.GL_STREAM_DRAW,
CL12.CL_MEM_WRITE_ONLY);
updateBuffer(tmpOutUvBuffer,
Expand Down Expand Up @@ -1509,7 +1515,7 @@ public void loadScene(Scene scene)
return;
}

GpuFloatBuffer vertexBuffer = new GpuFloatBuffer();
GpuIntBuffer vertexBuffer = new GpuIntBuffer();
GpuFloatBuffer uvBuffer = new GpuFloatBuffer();

sceneUploader.upload(scene, vertexBuffer, uvBuffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class SceneUploader
}
}

void upload(Scene scene, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
void upload(Scene scene, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
++sceneId;
offset = 0;
Expand Down Expand Up @@ -113,7 +113,7 @@ void upload(Scene scene, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
log.debug("Scene upload time: {} unique models: {} length: {}KB", stopwatch, uniqueModels, (offset * 16) / 1024);
}

private void upload(Scene scene, Tile tile, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
private void upload(Scene scene, Tile tile, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
Tile bridge = tile.getBridge();
if (bridge != null)
Expand Down Expand Up @@ -228,7 +228,7 @@ private void upload(Scene scene, Tile tile, GpuFloatBuffer vertexBuffer, GpuFloa
}
}

int upload(Scene scene, SceneTilePaint tile, int tileZ, int tileX, int tileY, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer,
int upload(Scene scene, SceneTilePaint tile, int tileZ, int tileX, int tileY, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer,
int lx, int lz, boolean padUvs)
{
tileX += GpuPlugin.SCENE_OFFSET;
Expand Down Expand Up @@ -277,13 +277,13 @@ int upload(Scene scene, SceneTilePaint tile, int tileZ, int tileX, int tileY, Gp
final int lz3 = lz + Perspective.LOCAL_TILE_SIZE;
final int hsl3 = nwColor;

vertexBuffer.put(lx2, ly2, lz2, Float.intBitsToFloat(0x00800000 | hsl2));
vertexBuffer.put(lx3, ly3, lz3, Float.intBitsToFloat(0x00800000 | hsl3));
vertexBuffer.put(lx1, ly1, lz1, Float.intBitsToFloat(0x00800000 | hsl1));
vertexBuffer.put(lx2, ly2, lz2, hsl2);
vertexBuffer.put(lx3, ly3, lz3, hsl3);
vertexBuffer.put(lx1, ly1, lz1, hsl1);

vertexBuffer.put(lx0, ly0, lz0, Float.intBitsToFloat(0x00800000 | hsl0));
vertexBuffer.put(lx1, ly1, lz1, Float.intBitsToFloat(0x00800000 | hsl1));
vertexBuffer.put(lx3, ly3, lz3, Float.intBitsToFloat(0x00800000 | hsl3));
vertexBuffer.put(lx0, ly0, lz0, hsl0);
vertexBuffer.put(lx1, ly1, lz1, hsl1);
vertexBuffer.put(lx3, ly3, lz3, hsl3);

if (padUvs || tile.getTexture() != -1)
{
Expand All @@ -310,7 +310,7 @@ int upload(Scene scene, SceneTilePaint tile, int tileZ, int tileX, int tileY, Gp
}

int upload(SceneTileModel sceneTileModel, int lx, int lz,
GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer, boolean padUvs)
GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer, boolean padUvs)
{
final int[] faceX = sceneTileModel.getFaceX();
final int[] faceY = sceneTileModel.getFaceY();
Expand Down Expand Up @@ -362,9 +362,9 @@ int upload(SceneTileModel sceneTileModel, int lx, int lz,
int ly2 = vertexY[vertex2];
int lz2 = vertexZ[vertex2] - lz;

vertexBuffer.put(lx0, ly0, lz0, Float.intBitsToFloat(0x00800000 | hsl0));
vertexBuffer.put(lx1, ly1, lz1, Float.intBitsToFloat(0x00800000 | hsl1));
vertexBuffer.put(lx2, ly2, lz2, Float.intBitsToFloat(0x00800000 | hsl2));
vertexBuffer.put(lx0, ly0, lz0, hsl0);
vertexBuffer.put(lx1, ly1, lz1, hsl1);
vertexBuffer.put(lx2, ly2, lz2, hsl2);

if (padUvs || triangleTextures != null)
{
Expand Down Expand Up @@ -396,7 +396,7 @@ int upload(SceneTileModel sceneTileModel, int lx, int lz,
return cnt;
}

private void uploadSceneModel(Model model, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
private void uploadSceneModel(Model model, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
// deduplicate hillskewed models
if (model.getUnskewedModel() != null)
Expand Down Expand Up @@ -430,7 +430,7 @@ private void uploadSceneModel(Model model, GpuFloatBuffer vertexBuffer, GpuFloat
}
}

public int pushModel(Model model, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
public int pushModel(Model model, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
final int triangleCount = Math.min(model.getFaceCount(), GpuPlugin.MAX_TRIANGLE);

Expand Down Expand Up @@ -508,9 +508,9 @@ else if (color3 == -2)
int triangleB = indices2[face];
int triangleC = indices3[face];

vertexBuffer.put(vertexX[triangleA], vertexY[triangleA], vertexZ[triangleA], Float.intBitsToFloat(packAlphaPriority | color1));
vertexBuffer.put(vertexX[triangleB], vertexY[triangleB], vertexZ[triangleB], Float.intBitsToFloat(packAlphaPriority | color2));
vertexBuffer.put(vertexX[triangleC], vertexY[triangleC], vertexZ[triangleC], Float.intBitsToFloat(packAlphaPriority | color3));
vertexBuffer.put(vertexX[triangleA], vertexY[triangleA], vertexZ[triangleA], packAlphaPriority | color1);
vertexBuffer.put(vertexX[triangleB], vertexY[triangleB], vertexZ[triangleB], packAlphaPriority | color2);
vertexBuffer.put(vertexX[triangleC], vertexY[triangleC], vertexZ[triangleC], packAlphaPriority | color3);

if (faceTextures != null)
{
Expand Down Expand Up @@ -611,7 +611,7 @@ void releaseSortingBuffers()
orderedFaces = null;
}

int pushSortedModel(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
int pushSortedModel(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
final int vertexCount = model.getVerticesCount();
final int[] verticesX = model.getVerticesX();
Expand Down Expand Up @@ -932,7 +932,7 @@ else if (pri == 10)
return len;
}

private int pushFace(Model model, int face, GpuFloatBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
private int pushFace(Model model, int face, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
final int[] indices1 = model.getFaceIndices1();
final int[] indices2 = model.getFaceIndices2();
Expand Down Expand Up @@ -982,9 +982,9 @@ private int pushFace(Model model, int face, GpuFloatBuffer vertexBuffer, GpuFloa
}
}

vertexBuffer.put(modelLocalX[triangleA], modelLocalY[triangleA], modelLocalZ[triangleA], Float.intBitsToFloat(packAlphaPriority | color1));
vertexBuffer.put(modelLocalX[triangleB], modelLocalY[triangleB], modelLocalZ[triangleB], Float.intBitsToFloat(packAlphaPriority | color2));
vertexBuffer.put(modelLocalX[triangleC], modelLocalY[triangleC], modelLocalZ[triangleC], Float.intBitsToFloat(packAlphaPriority | color3));
vertexBuffer.put(modelLocalX[triangleA], modelLocalY[triangleA], modelLocalZ[triangleA], packAlphaPriority | color1);
vertexBuffer.put(modelLocalX[triangleB], modelLocalY[triangleB], modelLocalZ[triangleB], packAlphaPriority | color2);
vertexBuffer.put(modelLocalX[triangleC], modelLocalY[triangleC], modelLocalZ[triangleC], packAlphaPriority | color3);

if (faceTextures != null && faceTextures[face] != -1)
{
Expand Down Expand Up @@ -1031,7 +1031,7 @@ private static int packAlphaPriority(short[] faceTextures, byte[] faceTransparen
{
priority = (facePriorities[face] & 0xff) << 16;
}
return alpha | priority | 0x00800000;
return alpha | priority;
}

private static int interpolateHSL(int hsl, byte hue2, byte sat2, byte lum2, byte lerp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct uniform {
float cameraX;
float cameraY;
float cameraZ;
int4 sinCosTable[2048];
};

struct shared_data {
Expand Down
Loading

0 comments on commit c57cc14

Please sign in to comment.