feat(render): shader ABI v2 - AtmosphericFrame gains clock/wind blocks; caster pass binds it (Campaign VM VM6a)

AtmosphericFrame (set 3/binding 5) grows additively from 160 to 192 bytes:
two appended vec4 members, uAtmosphereClockWind and uAtmosphereWindAmplitude,
carry the foliage-wind clock/weather and amplitude inputs VM6b's shader
displacement will read. RenderPackShaderAbi renames the old constant to
AtmosphericFrameSizeBytesV1 (160), adds AtmosphericFrameSizeBytesV2 (192),
keeps AtmosphericFrameSizeBytes pointing at the current (v2) size, and adds
ShaderAbiVersion = 2. RenderPackSpirvValidator.ValidateAtmosphericFrame
accepts either the v1 (seven-member, 160-byte) or v2 (nine-member, 192-byte)
shape and rejects anything else naming both — this is why the frozen
external sample packs under samples/*/Shaders/*.spv, whose GLSL sources are
not in this tree, need no rebuild: a v1 shader bound to the 192-byte buffer
still reads correctly, since a bound range only needs to be >= the block's
own declared size.

DirectionalSunShadowRenderer's caster pass now binds AtmosphericFrame too
(both the multiview and per-cascade sites), through a new
AtmosphericFrameBufferBinding the graph owns and supplies via
DirectionalSunShadowRenderInput. AtmosphericPostProcessGraph.RenderDirectionalShadows
builds its own 192-byte ring allocation for this, separate from the world
receiver's frame block, because the caster pass runs before RenderPostProcess
constructs that block within the same frame. The four world caster pipeline
variants (opaque/cutout, base/multiview) are now allowed to declare binding
5 in the validator; terrain casters are untouched.

This commit is plumbing only: the two new members are always written but
never read by any shader yet (zero placeholders), so pack-on and pack-off
output are both pixel-identical to before. VM6b wires the real weather-driven
values and the shader-side displacement.

App hermetic filter: 5972/5974 (2 pre-existing failures unrelated to this
change, confirmed against the unmodified baseline). Core.Tests hermetic:
4697/4697. RenderPackValidator.Tests: 30/30. VulkanShaderManifestTests
(retail oracle set): 7/7, byte-identical.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-23 00:30:02 +02:00
parent a0157693ec
commit 0930c35d1d
17 changed files with 340 additions and 32 deletions

View file

@ -1,10 +1,23 @@
#ifndef ACDREAM_ATMOSPHERIC_COMMON_GLSL
#define ACDREAM_ATMOSPHERIC_COMMON_GLSL
// Render-pack shader ABI v1. These declarations are the byte-level SSOT for
// AtmosphericFrameUniforms (set 3/binding 5, 160 bytes) and
// AtmosphericPackPassUniforms (set 3/binding 7). Binding 6 is intentionally
// reserved for directional-shadow data in directional_shadow_common.glsl.
// Render-pack shader ABI v2 (Campaign VM VM6, additive over v1). These
// declarations are the byte-level SSOT for AtmosphericFrameUniforms (set
// 3/binding 5) and AtmosphericPackPassUniforms (set 3/binding 7). Binding 6
// is intentionally reserved for directional-shadow data in
// directional_shadow_common.glsl.
//
// v1 was seven members / 160 bytes (everything through
// uAtmosphereInverseViewProjection). v2 appends two vec4 members at offsets
// 160/176 for a total of 192 bytes — foliage-wind clock/weather and
// amplitude inputs. The append is additive-only: a v1 module bound to the
// (now 192-byte) buffer reads only its declared 160-byte prefix, which is
// valid Vulkan (the bound range only needs to be >= the block's declared
// size), so shader assets compiled before VM6 — including the frozen
// external sample packs under samples/*/Shaders/*.spv, whose GLSL sources
// are not in this tree and are never recompiled — remain valid without a
// rebuild. RenderPackSpirvValidator.ValidateAtmosphericFrame accepts EITHER
// shape.
layout(std140, ACDREAM_PACK_UBO_SET binding = 5) uniform AtmosphericFrame {
vec4 uAtmosphereSunScreen; // 0: uv.xy, ray strength, elevation degrees
vec4 uAtmosphereSunColor; // 16: authored display-space rgb (retail has no linear pipeline), policy multiplier
@ -13,6 +26,11 @@ layout(std140, ACDREAM_PACK_UBO_SET binding = 5) uniform AtmosphericFrame {
vec4 uAtmosphereSunDirection; // 64: surface-to-sun xyz, authored brightness
vec4 uAtmospherePolicy; // 80: day group, group factor, shadow/shaft elevation factors
mat4 uAtmosphereInverseViewProjection; // 96: screen/depth to world
// Campaign VM VM6 (2026-08-22): ABI v2 additions. Read by
// foliage_wind.glsl only — every pre-VM6 pass leaves these declared but
// unread.
vec4 uAtmosphereClockWind; // 160: elapsed seconds, wind mean [0..1], wind gust [0..1], wind direction radians
vec4 uAtmosphereWindAmplitude; // 176: lean amplitude m, branch amplitude m, flutter amplitude m, max canopy height m
};
layout(std140, ACDREAM_PACK_UBO_SET binding = 7) uniform PackPass {

View file

@ -12,7 +12,7 @@
},
{
"stage": "frag",
"sourceSha256": "de77256a5edde4f50c0d50544cb7e15e7d6b618636f2c529750b20e7a779cf65",
"sourceSha256": "ece56dc1c369316d7623f04795d93938fcc54756734bc49db01311fa96ec2dbf",
"compiled": true
}
]
@ -28,7 +28,7 @@
},
{
"stage": "frag",
"sourceSha256": "f8f21269fdf4d994844a747842d68bbda5afcddb5dccccdcec11563450edba52",
"sourceSha256": "b13cd8712c6532fbe9c4661794ad9f424a27437b5f2fa14c0b76d38cf7e93523",
"compiled": true
}
]
@ -44,7 +44,7 @@
},
{
"stage": "frag",
"sourceSha256": "dfc11d59f71d65efe650bcfa3434777cbcfe3358f5be38bf392f51b2bd2561b3",
"sourceSha256": "d28b82fc7ee8ca18d6911683ce904d59ecee749e9fd4bcc5af58ac048911a0b4",
"compiled": true
}
]
@ -60,7 +60,7 @@
},
{
"stage": "frag",
"sourceSha256": "45d02b356ada9fb15052290188d0de85e666de94f7bec7dc34c4e405b31401ef",
"sourceSha256": "695e692cd5442be15d63a0b4f155abeaecf54674adae5f7cf25ef0bb892d18ee",
"compiled": true
}
]
@ -76,7 +76,7 @@
},
{
"stage": "frag",
"sourceSha256": "9765a397328fe9a002a825ae806fcd1651645458e2909dc9ff96a1759c4690d9",
"sourceSha256": "6ae2a078177b516c8ee138467559e9d4bf8838ea53941709176ce4f6fa3803a0",
"compiled": true
}
]
@ -92,7 +92,7 @@
},
{
"stage": "frag",
"sourceSha256": "93aeef7ce7555c9c184ee8d7e419c207b2fbed4d877788f016faf19832816b0d",
"sourceSha256": "739b397a270142a77c08e7edefde7b2f9992588452a9827b737a0512bbeab513",
"compiled": true
}
]