Skip to content

Commit

Permalink
Better missing shader handling
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Nov 24, 2024
1 parent 771d709 commit f64d26e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

import static net.irisshaders.iris.pipeline.programs.ShaderOverrides.isBlockEntities;

Expand Down Expand Up @@ -185,6 +187,8 @@ private static ShaderKey getTranslucent(Object p) {
}
}

private Set<ShaderProgram> missingShaders = new HashSet<>();

@Inject(method = "getProgram", at = @At(value = "HEAD"), cancellable = true)
private void redirectIrisProgram(ShaderProgram shaderProgram, CallbackInfoReturnable<CompiledShaderProgram> cir) {
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
Expand All @@ -204,8 +208,8 @@ private void redirectIrisProgram(ShaderProgram shaderProgram, CallbackInfoReturn

if (program != null) {
cir.setReturnValue(program);
} else if (IrisPlatformHelpers.getInstance().isDevelopmentEnvironment()) {
Iris.logger.error("missing program " + shaderProgram.configId(), new Throwable());
} else if (missingShaders.add(shaderProgram)) {
Iris.logger.error("Missing program " + shaderProgram.configId() + " in override list. This is not a critical problem, but it could lead to weird rendering.", new Throwable());
}
} else {
if (shaderProgram == ShaderAccess.MEKANISM_FLAME) {
Expand Down

0 comments on commit f64d26e

Please sign in to comment.