Skip to content

Shaders

TamKungZ edited this page Oct 27, 2026 · 1 revision

Shaders

bgfx shader sources are in src/main/shaders (.sc, with shared common.sh, texture.sh and varying.def.sc). The Gradle build compiles them to D3D12 with bgfx shaderc (compileD3D12Shaders) and checks them with verifyD3D12Shaders.

Programs

Pairings as declared in graphics.pipeline.PipelineSet. Each pipeline has an opaque fragment program and an alpha-test one.

Pipeline Vertex Fragment (opaque / alpha test)
Colour vs_position_color fs_position_color / fs_position_color_alpha
Colour with light vs_position_color_light fs_position_color / fs_position_color_alpha
Texture vs_position_color_tex fs_position_color_tex / fs_position_color_tex_cutout
Texture with light vs_position_color_tex_light fs_position_color_tex / fs_position_color_tex_cutout
Entity vs_entity fs_entity / fs_entity_cutout
Line vs_line fs_position_color / fs_position_color_alpha
End portal vs_end_portal fs_end_portal (both)

ShaderPipeline also loads fs_logic_invert and fs_logic_invert_alpha for the logic-op blend pass.

Matching vanilla

bridge.shader.ShaderSemantics describes each vanilla core shader (alpha test, fog mode and space, lightmap lookup, diffuse lighting, overlay). ShaderSourceTest checks that table against the shader sources in the Minecraft jar.

Clone this wiki locally