Background
I was recently testing Vulkan out with a resource pack I have been maintaining through several Minecraft updates for the Java Realms map Good Phantom, which leverages core/post shaders to produce a custom retexturable skybox.
When I first loaded the resource pack with Vulkan, it immediately crashed after logging the following error:
Couldn't compile pipeline minecraft:transparency/3: Unable to find shader defined uniform (Projection)This is caused by the custom skybox.vsh post shader including #moj_import minecraft:projection.glsl, which it uses to reference the Projection uniform containing ProjMat. This has historically worked in OpenGL and continues to work without issue in OpenGL as of 26.2 Snapshot 7.
However, for Vulkan, importing projection.glsl is not enough. Instead, the uniform must also be explicitly declared within the post shader pass definition in transparency.json:
"uniforms": {
"Projection": [
{
"name": "ProjMat",
"type": "matrix4x4",
"value": [
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0
]
}
]
}Per RogueLogix in the Minecraft Feedback Discord #rendering channel:
That failing the pipeline compile is WAI. […] OpenGL isn't verifying it and technically doesn't need to. With Vulkan any discrepancy like that matters so it does verify it.
GL should replicate the crash if you purposely Introduce an error in the shader
In essence: this particular error is unique to Vulkan, and working as intended, but the game crashing on post shader compile failure is its own issue that affects both graphics APIs and needs addressing.
Steps to Reproduce
Set “Improved Transparency” to “ON” in video settings.
Set “Graphics API” to “Prefer OpenGL”.
Download and apply the
skybox-broken.zipresource pack.Open a world.
Observe no crash and a working custom skybox.
Set “Graphics API” to “Prefer Vulkan” (or “Default”, if Vulkan would be default for you).
Relaunch Minecraft and reopen the world.
Observe an immediate crash due to the missing uniform.
Relaunch Minecraft, ensuring “Graphics API” is still set to “Prefer Vulkan”.
Download/apply the
skybox-fixed.zipresource packReopen the world.
Observe no crash and a working custom skybox.
Notes
I have also attached a crash report for further context about the crash.
In retrospect, it is far easier to put an #error somewhere for testing sake since the core issue is crashes on post shader compilation failure. This report was rewritten to indicate the true cause of the problem following discussion with the developers, and there is probably enough information there to go off of for resolution.
Thank you for helping us improve Minecraft! We saved your files: