[PR] Compatibility with custom ShaderInstance on 0.7.0a, fix uniformCache is null
BloCamLimb opened this issue ยท 5 comments
Description
There are two constructors for ShaderInstance, one is from Vanilla that takes String name, one is added by Forge that takes ResourceLocation name. And Vanilla's constructor is replaced with Forge's for modding purposes. But your me.jellysquid.mods.sodium.mixin.features.shader.uniform.ShaderProgramMixin#initCache
copies the Fabric version as-is and injects to the String version of the constructor, thus uniformCache
is not initialized. This leads to crashes on mods that create their own ShaderInstances through the ResourceLocation version of the constructor.
Solution
You should change the Mixin to:
@Inject(method = { "<init>" }, at = { @At("RETURN") })
private void initCache(ResourceProvider factory, ResourceLocation name, VertexFormat format, CallbackInfo ci) {
....
}
I want to contribute to the project, but I didn't see the latest codebase pushing, I have to open an issue.
Crash-report
The crash is simple, uniformCache is not initialized so it's null on drawWithShader().
crash-2023-08-16_09.14.43-client.txt
Env
Minecraft 1.20.1
Forge 47.1.69
Rubidium 0.7.0a
ModernUI 3.8.0.4 <- example mod that creates custom shaders
this is severe enough to deserve a hotfix. as asek has been away for two months, does anyone have a fork with a patch that I can download and compile, or should I attempt to patch it myself?
this is severe enough to deserve a hotfix. as asek has been away for two months, does anyone have a fork with a patch that I can download and compile, or should I attempt to patch it myself?
you can use the pr