Turn the cutout off crash off

- 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
This commit is contained in:
Jozufozu 2024-10-19 16:58:04 -07:00
parent 3d2fdb7e83
commit 3a949c717a

View File

@ -61,15 +61,12 @@ public final class PipelineCompiler {
MaterialShaderIndices.fogSources()
.index(fog.source());
boolean useCutout = cutout != CutoutShaders.OFF;
if (useCutout) {
// 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());
}
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() {