Skip to content

Commit

Permalink
Prevent drawing when formats don't match
Browse files Browse the repository at this point in the history
  • Loading branch information
xCollateral committed Jul 15, 2024
1 parent 4d84631 commit 4946c67
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/net/vulkanmod/mixin/render/BufferUploaderM.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public static void drawWithShader(BufferBuilder.RenderedBuffer renderedBuffer) {

if (parameters.vertexCount() > 0) {
ShaderInstance shaderInstance = RenderSystem.getShader();

// Prevent drawing if formats don't match to avoid disturbing visual bugs
if (shaderInstance.getVertexFormat() != renderedBuffer.drawState().format()) {
renderedBuffer.release();
return;
}

// Used to update legacy shader uniforms
// TODO it would be faster to allocate a buffer from stack and set all values
shaderInstance.apply();
Expand Down

0 comments on commit 4946c67

Please sign in to comment.