tools/shaders: the game's shaders, translated for WebGL2
Translates every shader stage the game can compile into GLSL ES 3.00 at build time (ADR 0007), so
the browser needs no shader compiler. ./gradlew :app-web:shaders writes
app-web/build/web-shaders/shaders.json (read by render-webgl2) and shaders.txt (what was
translated and what WebGL2 can't run). Both hold translated Mojang shaders: never committed.
How it works
GameShaderFilesreads shader sources and post effects from the client jar.PipelineCatalogloads the game's pipeline registry on this JVM and lists every distinct stage.Includesexpands includes,SpirvCompilercompiles with shaderc,EsslTranslatorturns SPIR-V into GLSL ES with SPIRV-Cross, andEsslRewritesfills WebGL2's gaps (texel buffers become 2D textures; output arrays become separate outputs). Stages that depend on 0-to-1 depth get a second variant.GlslangCheckcompiles and links each pipeline withglslangValidator.
Invariants
- Nothing here ships.
- Vanilla shaders must translate. Only missing WebGL2 features are allowed, each listed with why.
How to test
./gradlew :tools:shaders:check
./gradlew :app-web:shaders # the real run (needs ./incari setup)