b61b25f80f
A program's preprocessed GLSL, any version from 110 to 460, compatibility or core, rewritten into the Vulkan-flavoured GLSL 450 that naga's frontend reads, then parsed and validated into naga modules with the program's interface: its uniform block (offsets from naga's layout), its samplers and their bindings, its output locations. The rewrite works on preprocessing tokens and keeps the pack's lines, so every error points at the pack's own file and line through the preprocessor's line map. - Loose uniforms go into one block shared by both stages; bool is stored as int. Samplers are split into texture and sampler objects, combined again where used, and passed as two arguments to the pack's functions. - The compatibility built-ins become declarations of ours (prefix hz_): gl_Vertex, gl_MultiTexCoordN, the matrices and ftransform(), gl_FragData, gl_FragColor, gl_TexCoord, gl_FrontColor, gl_Fog (from vanilla's fog), texture2D and the other old texture functions, shadow2D; varyings get locations by name across the stages; words that became keywords after GLSL 1.x are renamed in old code. - naga gaps covered: modf, conditional initializers of globals (run by our main), and unsized arrays sized from their constructor. - The pack's main is called by one of ours that draws the quad from (0,0) to (1,1) and adapts GL's conventions: clip y negated for every target but the window, so memory rows are GL's rows and gl_FragCoord needs no change; clip z from GL's [-w, w] to [0, w], so stored depth is GL's window depth. In final, gl_FragCoord.y is counted from the bottom of the window. Black box over the public test packs: all 105 composite-style programs (composite, deferred, final, prepare, begin, shadowcomp of the base and dimension folders) translate and validate. Nothing uses it yet: players see no change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
480 B
TOML
16 lines
480 B
TOML
[package]
|
|
name = "horizon-shaders"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version = "1.85"
|
|
description = "Shader packs (the shaders/ folder format): reading packs, their .properties and .lang files, and later their GLSL"
|
|
|
|
[dependencies]
|
|
horizon-core = { path = "../horizon-core" }
|
|
naga = { version = "30.0.1", features = ["glsl-in", "wgsl-in"] }
|
|
zip = { version = "2", default-features = false, features = ["deflate"] }
|
|
|
|
[lints]
|
|
workspace = true
|