Repository navigation
d3d12_xs: depth, stencil and raster state for slot 57 native pipelines from state blob A (RT-SLOT57-DEPTH-RASTER) - #1691
Conversation
…(RT-SLOT57-BLEND-STATE) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry (RT-SLOT57-BLEND-STATE) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PSOs (RT-SLOT57-BLEND-STATE) A library pipeline enables MAX on an R8_UINT target; the colour block bypasses blending there, and D3D12 refuses the PSO. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…with blending off on its stand-in targets (RT-SLOT57-BLEND-STATE) On devices without renderable B4G4R4A4, the Vulkan layer refuses blending on the RGBA8 stand-in (E_NOTIMPL). Turn blending off on those targets, then on every target, before leaving the pipeline to the PC description path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s from state blob A (RT-SLOT57-DEPTH-RASTER) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…EPTH-RASTER) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kawaii-shakal
left a comment
There was a problem hiding this comment.
Review (read-only, not run). I checked the decode against the RDNA2 register layout, and it matches:
ZFUNCandSTENCILFUNCare 0..7 → D3D12 1..8, with the+ 1;FACE= 1 means clockwise is front, soFrontCounterClockwise = !FACE;- a polygon mode, culling both faces, depth bounds, the colour-write flags, a single disabled z clip, and unequal face masks are refused;
- no DSV turns depth and stencil off.
Two questions:
- The stencil reference value.
DB_STENCILREFMASKbits 7:0 areSTENCILTESTVAL, the reference. The decode reads the masks andSTENCILOPVALbut not the test value, so the pipeline relies on the title callingOMSetStencilRef. On the console the ref can come in with the pipeline's register set. If the title never sets it for these PSOs, stencil tests would compare against 0. Could you count how many stencil-enabled records have a nonzeroSTENCILTESTVAL(bits 7:0 of+0xc0)? If any do, the native PSO path may need to supply it as the default ref. - Depth bias is out of scope here. A count of records with
POLY_OFFSET_*_ENABLEset inPA_SU_SC_MODE_CNTL(bits 11 and 12) would show how many shadow or decal pipelines will draw without it once a world frame is reached. It would also be a good marker for the follow-up.
AI-assisted review (Claude Code, Claude Opus 5.5).
… (review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@kawaii-shakal thanks for checking the decode. The counts, over all 25,471 graphics records of 1.0.2.1:
AI-assisted. |
MoonEyes
left a comment
There was a problem hiding this comment.
Built and tested on Windows 11 with MSVC 19.44 (scripts\build_runtime.ps1, incremental on main 3f81d46's build tree), NVIDIA GeForce RTX 4060, driver 610.88. Head f0e776a (it carries #1671's commits).
ctest -R "native_pso|dual_source|translated_draw|xs_proxy_mock|xbox_native_base_draw": 13/13 passed, including native_pso_blend, native_pso_depth, d3d12_translated_draw and xbox_native_base_draw, and the nine xs_proxy_mock* variants.
Not checked: the in-game effect (blend, depth/stencil/raster state on the slot 57 pipelines). That needs a world frame, which my setup does not reach yet.
AI-assisted: yes (Claude Code ran the build and the tests; I read the results).
…d-in (RT-SLOT57-BLEND-STATE review) adrianmjim's review: the blend fallback ran on any E_NOTIMPL, which also stands for refusals unrelated to blending (stream_unsupported, mesh limits, FullyCovered, and ProjectLeonida#1703's dual-source refusal). Such a pipeline was retried with blending off, logged as a blend refusal, and, if the retry succeeded, drew without the blend the title asked for. Now only a pipeline with a blended B4G4R4A4 target is retried, with blending off on those targets alone (without_stand_in_blend, its own header), and the line is printed only when that retry succeeds. The "every target" step is gone: no real boot used it (RTX 4070 Laptop and kawaii-shakal's RTX 5070 Ti only ever logged the B4G4R4A4 step). native_pso_fallback_test covers the decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # runtime/CMakeLists.txt
|
Merged, after #1703. Thank you, @OreoFR, and thanks to @kawaii-shakal for the stencil-reference and depth-bias questions and the real boot, and to @MoonEyes for the independent pass.
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: RT-SLOT57-DEPTH-RASTER (#1608 (comment))
Depends on: #1671, #1592
This builds on #1671: same functions in
runtime/shims/d3d12_xs_native_pso.handruntime/src/native_pso.h. Its commits are the first five here and drop out once it merges. #1592 has the same one-line#includeconflict as #1671. The real-boot test also used #1558 and #1547 to get past the landing screen on NVIDIA; this change doesn't need them.What and why
The slot 57 native factory built every PSO with depth
ALWAYSplus writes (wherever there was a DSV), no stencil, no culling and depth clip on. State blob A carries the real state in RDNA2 registers beside the blend registers #1671 decodes (vertex-pipeline offsets, +84 in mesh pipelines). Measured over all 25,471 graphics records of 1.0.2.1:+0xb8DB_DEPTH_CONTROL:Z_ENABLEis clear in 7,040 of 7,079 records;STENCIL_ENABLEis set only with stencil formats;GEQUAL(reversed depth).+0xbcDB_STENCIL_CONTROL: onlyKEEP,REPLACE_TEST,ADD_WRAP(operand 1),ZEROandINVERTare used.+0xc0/+0xc4DB_STENCILREFMASK(_BF): the two faces have equal masks in every stencil record.+0xa0PA_SU_SC_MODE_CNTL: no culling in 13,534 records, back faces in 11,873, front faces in 62.+0x9cPA_CL_CLIP_CNTL: D3D clip space in every record, and both z clips off (depth clamp) in 960.The layouts and counts are in
docs/fspx.md. Aggregate counts only; no blob bytes are quoted.runtime/src/native_pso.h:decode_state_a_depth_rasterreads the registers. It shares the shape and tag check with the blend decode.d3d12_depth_rastermaps them to D3D12. The compare functions are shifted by one. The stencil ops map as follows, with the adding ones only for an operand of 1:REPLACE_TEST→REPLACE;ADD_WRAP→INCR,ADD_CLAMP→INCR_SAT, and the subtracting ones likewise;ZERO,INVERTandKEEPmap to themselves._BFfields underBACKFACE_ENABLE. Cull comes fromCULL_FRONT/CULL_BACK,FrontCounterClockwise = !FACE, andDepthClipEnableis off when both z clips are off.runtime/shims/d3d12_xs_native_pso.h:fill_depth_raster_stateapplies the mapping to both the VS and the mesh paths. A pipeline without a DSV keeps depth and stencil off.Not built, falling back to today's defaults (logged):
None of these occurs in 1.0.2.1: a Python mirror of these rules maps all 25,471 records.
Out of scope: depth bias (
PA_SU_POLY_OFFSET_*), because its D3D12 units depend on the depth format.runtime/test/native_pso_depth_test.cpp(portable, standard library only): register reads for both families, every mapping above, and each refused form.What a real boot can and can't show. The first-run pages and the loading slideshow are drawn without a DSV, so this change must not alter them, and it doesn't. The 3D pipelines it changes only draw once a world frame is reached, which no build has yet. The one field whose effect isn't visible before then is the winding:
FACEmaps toFrontCounterClockwise = !FACE, as RADV and PAL program it.Tested
main+ d3d12_xs: make a D16S8 depth texture without UAV when the depth provider refuses it (RT-D16S8-UAV-NVIDIA-FALLBACK) #1558 + d3d12: compile a submission's pipelines on worker threads (RT-PIPELINE-COMPILE-WORKERS) #1547 + d3d12_xs: blend state for slot 57 native pipelines from state blob A (RT-SLOT57-BLEND-STATE) #1671 + this branch, fresh first-run profile, factory on.native_pso_depth,native_pso_blend,xs_proxy_mockandxbox_native_base_drawpass.GPUs tested: NVIDIA GeForce RTX 4070 Laptop GPU, driver 591.59 (32.0.15.9159), Windows 11
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase). It's stacked on d3d12_xs: blend state for slot 57 native pipelines from state blob A (RT-SLOT57-BLEND-STATE) #1671, as stated above.docs/design.md, with how it was confirmed. (Not a translator change; the measurement is indocs/fspx.md.)🤖 Generated with Claude Code