Skip to content

Commit

Permalink
Fix incompat with immedeately fast 1.1.25
Browse files Browse the repository at this point in the history
Turns out uploading empty buffers isn't the best idea I've ever had,
but it also wasn't the worst one I ever had.

Maybe results in some performance gains even, who knows.
  • Loading branch information
andi-makes committed Aug 6, 2023
1 parent b3ba6b9 commit 5f83292
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions common/src/main/java/dev/schmarrn/lighty/event/BufferHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ void upload(BufferBuilder.RenderedBuffer buffer) {
if (vertexBuffer != null) {
vertexBuffer.close();
}
vertexBuffer = new VertexBuffer(VertexBuffer.Usage.DYNAMIC);
vertexBuffer.bind();
vertexBuffer.upload(buffer);
VertexBuffer.unbind();
if (buffer.isEmpty()) {
// Don't upload
vertexBuffer = null;
} else {
vertexBuffer = new VertexBuffer(VertexBuffer.Usage.DYNAMIC);
vertexBuffer.bind();
vertexBuffer.upload(buffer);
VertexBuffer.unbind();
}
}

void draw(Matrix4f positionMatrix, Matrix4f projectionMatrix, ShaderInstance shader) {
Expand Down

0 comments on commit 5f83292

Please sign in to comment.