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

@ -129,13 +129,18 @@ internal sealed class AtmosphericFrameInputState : IAtmosphericWorldFrameSink
}
/// <summary>
/// Shader ABI SSOT for opt-in set 3 binding 5. Six std140 vec4 values followed by one
/// mat4, 160 bytes.
/// Shader ABI SSOT for opt-in set 3 binding 5. ABI v2 (Campaign VM VM6):
/// six std140 vec4 values, one mat4, then two more std140 vec4 values —
/// 192 bytes. The two appended members carry the foliage-wind clock/weather
/// and amplitude inputs <c>foliage_wind.glsl</c> reads; every earlier member
/// keeps its ABI v1 offset. See <see cref="RenderPackShaderAbi.AtmosphericFrameSizeBytesV1"/>
/// and <c>atmospheric_common.glsl</c> for the byte-level contract both
/// backends and the SPIR-V validator agree on.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
internal readonly struct AtmosphericFrameUniforms
{
internal const int SizeInBytes = 160;
internal const int SizeInBytes = 192;
internal AtmosphericFrameUniforms(
Vector4 sunScreen,
@ -144,7 +149,9 @@ internal readonly struct AtmosphericFrameUniforms
Vector4 weather,
Vector4 sunDirection,
Vector4 policy,
Matrix4x4 inverseViewProjection)
Matrix4x4 inverseViewProjection,
Vector4 clockWind,
Vector4 windAmplitude)
{
SunScreen = sunScreen;
SunColor = sunColor;
@ -153,6 +160,8 @@ internal readonly struct AtmosphericFrameUniforms
SunDirection = sunDirection;
Policy = policy;
InverseViewProjection = inverseViewProjection;
ClockWind = clockWind;
WindAmplitude = windAmplitude;
}
internal readonly Vector4 SunScreen;
@ -162,6 +171,9 @@ internal readonly struct AtmosphericFrameUniforms
internal readonly Vector4 SunDirection;
internal readonly Vector4 Policy;
internal readonly Matrix4x4 InverseViewProjection;
// Campaign VM VM6 ABI v2 additions — offsets 160/176.
internal readonly Vector4 ClockWind;
internal readonly Vector4 WindAmplitude;
}
/// <summary>