Pixel programs keep the console's early depth test (VICTORY_EARLY_DEPTH=1, off by default)
A console pixel program whose DB_SHADER_CONTROL has DEPTH_BEFORE_SHADER (bit 12, HLSL's [earlydepthstencil]) is translated with DXIL's ForceEarlyDepthStencil flag when VICTORY_EARLY_DEPTH=1. The translator read DB_SHADER_CONTROL but never used it, so every such program ran with the late test on the host wherever it writes unordered views or discards, and its writes to unordered views landed for pixels the depth test then rejected. What that broke (capture C:\dev\captures\haze2, a character's head in front of a window): the transparent pass (list 247; pixel programs 629743ca412296d4, 8ba01719b71d1d35, 5436c45060d74ebe and others, DB_SHADER_CONTROL 0x1450) keeps the nearest transparent depth and its velocity with 64-bit atomics in texture 46225 (R32G32, 1706x960); draw 271:34 (pixel 00ae3e9b98a0ae26, depth test ALWAYS, depth write on) writes that depth into the scene depth 6481 and that velocity into the motion vectors 38269 wherever it holds one. The glass, behind the head, wrote there too: at the head's pixels in front of it the scene depth that the heat-haze and in-scattering pass 731a39171b568298 (279:303) reads holds the glass's (0.176, 0.85 m, for the head's 0.39, 0.38 m) and the motion vectors hold the glass's velocity (-24, +31 where the head's own is +43, +35). 13.7% of that frame's transparent texels lie behind the opaque depth. The haze pass picks heat haze (beyond 20 m) and in-scattering (beyond 137 m there) by each pixel's distance, in 16x16 tiles: where the false depth is far, it works on character outlines (expected cause of the blocks on hair, not yet confirmed in a run). The switch joins the shader cache's key only while it is on, so the default translation and its cache entries stay as they were. Counted at the shader cache's log line: programs given the early test, left late (switch off), left late as they write depth or stencil. Tests: the decision, and a pixel program translated with and without the switch (dxil.dll validates it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a83bc910a7
commit
41b4a056d6
5 files changed
+249
No files matched your search
@@ -84,6 +84,16 @@ fn build() -> [u8; 32] {
|
||||
}
|
||||
bytes.push(0);
|
||||
}
|
||||
// So is whether pixel programs keep the console's early depth test
|
||||
// (`VICTORY_EARLY_DEPTH=1`): only while it is on, so that the
|
||||
// translations cached without it are still served without it.
|
||||
if victory_shader::emit::early_depth() {
|
||||
tracing::info!(
|
||||
"VICTORY_EARLY_DEPTH=1: pixel programs whose console code tests depth before them get the host's early depth-stencil test"
|
||||
);
|
||||
bytes.extend_from_slice(b"VICTORY_EARLY_DEPTH=1");
|
||||
bytes.push(0);
|
||||
}
|
||||
// And which clean-up passes ran over the translated code.
|
||||
bytes.extend_from_slice(&victory_shader::emit::shader_opt().to_le_bytes());
|
||||
bytes
|
||||
|
||||
Reference in new issue
Block a user