fix(gpu/desc): use transparent alpha (0x00) on RGBA neutral stand-ins to prevent smoke billboard gray quads #420
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/420"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T03:15:45Z.
Summary
Fixes translucent gray square quads around smoke/particle emitters (e.g., aircraft engine exhaust plumes) on 8 GB GPUs when RGBA billboard textures are evicted or not yet resident and receive a neutral stand-in SRV from
neutral_for().Root Cause
In
crates/victory-gpu/src/descriptor/host.rs,standin_texel(false)returned[0x80, 0x80, 0x80, 0x80](RGB ≈ 0.502, A ≈ 0.502).BC3,BC7,BC2,R8G8B8A8,B8G8R8A8),A ≈ 0.502renders 50%-opaque gray square quads (and stacked exhaust plume billboards compound to ~99.9% opaque gray blocks).clip(alpha - 0.5)),0x80 / 255 = 0.50196 >= 0.5passes the alpha test and renders solid gray square cards.A8_UNORM,R8_TYPELESS, andR9G9B9E5_SHAREDEXPwere not yet excluded fromgray_fits()alongsideR8_UNORM,BC4_*, andR11G11B10_FLOAT/BC6H_*.Changes
standin_texel(opaque): Default (!VICTORY_STANDIN_OPAQUE) now uses[0x80, 0x80, 0x80, 0x00](neutral~0.502RGB, transparent0x00alpha).VICTORY_STANDIN_OPAQUE=1continues to opt in to[0x80, 0x80, 0x80, 0xff].format_without_alpha()+standin_component_mapping(): Non-alpha picture/normal formats (BC5_*,R8G8_*,B8G8R8X8_*,B5G6R5_UNORM) forceA = 1.0viaD3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1(6792) on the stand-in SRV, matching real D3D12 hardware semantics while keepingRGB = 0x80(~0.502).gray_fits(): ExcludeA8_UNORM(alpha-only mask),R8_TYPELESS(single-channel typeless counterpart ofR8_UNORM), andR9G9B9E5_SHAREDEXP(HDR shared-exponent float) so they stay null(0,0,0,0).neutral_standin_rules_and_texel_formatsanda_texture_not_there_yet_has_a_neutral_stand_into cover all format groups andShader4ComponentMappingbehavior.Format-by-Format Analysis
BC3/BC2/BC7/R8G8B8A8/B8G8R8A8/R10G10B10A2/R16G16B16A16_UNORM/B5G5R5A1/B4G4R4A4(0.502, 0.502, 0.502, 0.0)(orA=1.0withVICTORY_STANDIN_OPAQUE=1)0.502(neutral gray, no neon green; opaque shaders ignore.a). Cutouts: cleanly discarded until resident instead of solid gray cards.BC1(UNORM/SRGB/TYPELESS)(0.502, 0.502, 0.502, 0.0)BC1albedo:.aignored, RGB stays neutral gray. 1-bit alpha-testedBC1foliage: discarded cleanly while streaming instead of solid gray cards.BC5_UNORM/BC5_TYPELESS/R8G8_UNORM/R8G8_TYPELESSShader4ComponentMappingforcesA = 1.0(0.502, 0.502, 0.502, 1.0)R=0.502, G=0.502produces flat normal(0,0,1)and neutral chroma;A=1.0matches real D3D12 hardware semantics for 2-channel formats.B8G8R8X8_*/B5G6R5_UNORMShader4ComponentMappingforcesA = 1.0(0.502, 0.502, 0.502, 1.0)A=1.0.R8_UNORM/R8_TYPELESS/A8_UNORM/BC4_UNORM/BC4_TYPELESSgray_fits()→ null SRV(0.0, 0.0, 0.0, 0.0)BC6H_*/R11G11B10_FLOAT/R9G9B9E5_SHAREDEXP/R16G16B16A16_FLOAT/R32*_FLOATgray_fits()→ null SRV(0.0, 0.0, 0.0, 0.0)*_SNORM(BC5_SNORM,BC4_SNORM,R8G8_SNORM, etc.) /D*depth /*_UINT/*_SINTgray_fits()/integer_format()→ null SRV(0, 0, 0, 0)0.0= flat), depth, and integer views stay zero.Verification
cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib descriptor: 109 passed, 0 failed (1 ignored)cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: asset policy: 365 files okcargo +1.98.1-x86_64-pc-windows-gnu check --workspace: passed cleanlyImported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T03:31:52Z.
Triage (
4bc457cc, CIcheckPASS):+146/-24incrates/victory-gpu/src/descriptor/host.rs, zero new toggles): switches default neutral stand-ins to[0x80, 0x80, 0x80, 0x00](hiding unstreamed smoke/particle/decal billboards and alpha-tested cutouts instead of rendering gray squares), forcesA = 1.0viaD3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1on non-alpha formats (BC5,R8G8,B8G8R8X8,B5G6R5), and excludesA8_UNORM,R8_TYPELESS, andR9G9B9E5_SHAREDEXPfromgray_fits().#282) + Gate 3--features diagnosticsvisual PNG check (verifying gray smoke/foliage quads eliminated with zero regression on solid surfaces).