From 3a949c717a26e55fd585169daa26e279a7efdc5e Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 19 Oct 2024 16:58:04 -0700 Subject: [PATCH] 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 --- .../flywheel/backend/compile/PipelineCompiler.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/compile/PipelineCompiler.java b/common/src/backend/java/dev/engine_room/flywheel/backend/compile/PipelineCompiler.java index c01f8284b..e752edfd2 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/compile/PipelineCompiler.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/compile/PipelineCompiler.java @@ -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() {