Skip to content

Commit

Permalink
Turn the cutout off crash off
Browse files Browse the repository at this point in the history
- MaterialEncoder would trigger an indexing of CutoutShaders.OFF, though
  PipelineCompiler would explicitly not index OFF
- This caused a crash on instancing when MaterialEncoder would delete
  all pipeline shaders while instancing was trying to upload the packed
  ubershader uniform
  • Loading branch information
Jozufozu committed Oct 19, 2024
1 parent 3d2fdb7 commit 3a949c7
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@ public GlProgram get(InstanceType<?> instanceType, ContextShader contextShader,
MaterialShaderIndices.fogSources()
.index(fog.source());

boolean useCutout = cutout != CutoutShaders.OFF;
// Same thing for cutout.
// Add OFF to the index here anyway to ensure MaterialEncoder doesn't deleteAll at an inappropriate time.
MaterialShaderIndices.cutoutSources()
.index(cutout.source());

if (useCutout) {
// Same thing for cutout.
MaterialShaderIndices.cutoutSources()
.index(cutout.source());
}

return harness.get(new PipelineProgramKey(instanceType, contextShader, light, shaders, useCutout, FrameUniforms.debugOn()));
return harness.get(new PipelineProgramKey(instanceType, contextShader, light, shaders, cutout != CutoutShaders.OFF, FrameUniforms.debugOn()));
}

public void delete() {
Expand Down

0 comments on commit 3a949c7

Please sign in to comment.