help wanted: GPU translation, part 3 (render state and indirect draws) #1999
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1999
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@denn0x on GitHub · 2026-11-24 22:51 UTC · original
The startup runtime draws translated pipelines with a default fixed-function state. Once more geometry is drawn (ExecuteIndirect #1759, mesh programs #1760), the picture depends on the state the console pipeline itself carries. These pieces are independent; each can be one pull request with a source-built fixture.
Pieces (pick one, say so in a comment)
What a pull request needs
Where this comes from
Observed on a private executable (no bytes, keys, addresses or logs can be shared): with the default state, the geometry that does draw appears unordered and untextured, and most indirect draws are refused for their topology.
Related: #1759, #1760, #1909, #1916.
@R0Y00 on GitHub · 2026-11-24 23:04 UTC · original
Item C already has an implementation in #1806. Please continue there, with the remaining check focused on restoring the bound read-only DSV and preserving the command-list state. Item D can still be taken separately. A useful first slice is one source-built raster pass with a bound depth target plus a second pass whose result changes when the depth binding is omitted. Check pixels and debug-layer messages after the fence. Keep depth-only mesh as a follow-up if its adapter capability differs, and report a capability skip separately. Item E can build on the landed desktop record fixtures in #1759 and should keep a console-topology conversion and its negative control distinct.
@JB2WIN on GitHub · 2026-11-24 23:15 UTC · original
I'll take item A, depth/stencil state, starting with the decode. Today
stream_translation(d3d12_draw.inl) copies only a desktopDEPTH_STENCIL/DEPTH_STENCIL1subobject from the pipeline stream. First I'll find where the console pipeline carries its register block in the stand-in. Then I'll decodeDB_DEPTH_CONTROL(Z enable and write, the compare function including GREATER, stencil enable and functions) plusDB_STENCILREFMASKfrom the field layout in Mesa's public gfx10 register headers, and apply it behind a switch that is off by default. Evidence will be a WARP fixture with depth readback, together with a negative control where the switch is off. If the register block turns out not to be reachable from the stand-in, I'll report that here instead of guessing.AI-assisted (Claude Code).
@JB2WIN on GitHub · 2026-11-24 23:17 UTC · original
Item A, first finding. Nothing is built yet, because the register offset would have to be guessed.
state_aandstate_b, copied from title memory at creation (d3d12_capture.inl:22,:118,:120).CB_BLENDn_CONTROLwords at +0xD0 in block A (#1216,state_block_blend.h). NoDB_*register (DB_DEPTH_CONTROL,DB_STENCIL_CONTROL,DB_STENCILREFMASK) is documented or measured anywhere in the repository, and it is not established that the blocks carry them at all.d3d12_draw.inl:365-370already logs the first 0x1a0 bytes of both blocks for the first 24 pipelines when no blend is found.Has anyone located the DB words in block A or B, as #1216 did for blend? If not, I'll measure it locally from my own run, using that existing hex log, and match the words against Mesa's gfx10 field layouts. Only the offsets and the field interpretation would go into the PR, never the bytes. Until then the decode would rest on an assumed offset, which item A shouldn't.
AI-assisted (Claude Code).
@denn0x on GitHub · 2026-11-24 23:54 UTC · original
Yes. The depth-stencil and rasteriser registers were located locally in block A, next to the
CB_BLENDn_CONTROLwords from #1216. A decoder now exists in a local build:DB_DEPTH_CONTROL,DB_STENCIL_CONTROL,DB_STENCILREFMASK(_BF),PA_SU_SC_MODE_CNTL(cull, face, polygon offset enables) and the polygon offset scale and offset words. Field layouts follow Mesa's gfx10 register JSON.ClearDepthStencilViewis forwarded.GREATER_EQUALthe most common compare, back-face culling the most common cull mode, and no word the decoder has to refuse.To avoid two implementations, I'd suggest splitting it:
stream_translation.Does that work for you? If you'd rather do the whole item, I'll post the word positions here instead.
@R0Y00 on GitHub · 2026-11-25 00:08 UTC · original
The split in the latest reply is a good fit. Please keep the pure depth/stencil decoder and its source-built register-word controls together. Link that PR here so the existing item A claimant can build the real draw fixture on the same decoder interface.
For the draw fixture, use synthetic shader inputs and two overlapping triangles with unequal depths. Show the expected winner with reversed-Z and the different result with the switch disabled or the compare direction intentionally wrong. Check the stencil result separately with a known reference and include the original desktop state fallback. Reuse the same renderer on WARP and hardware. Keep raster bias and extra forwarding cases in their existing scope so either part can be reviewed independently.
@denn0x on GitHub · 2026-11-25 00:54 UTC · original
The decoder offered above is up as #2124: the pure depth-stencil decode from the slot 57 state block plus a device-free check with a shifted-offset control. It does not apply the state to draws and adds no read-back fixture, so item A's WARP fixture and the application in
stream_translationremain open for the claimant. Rasteriser state (item B) is not in it.@JB2WIN on GitHub · 2026-11-25 01:07 UTC · original
Thanks, @denn0x. I'll build item A's application and the draw fixture on top of #2124's decoder interface, as described above:
I'll start once #2124 has settled, so the interface doesn't move underneath.
AI-assisted (Claude Code).
@R0Y00 on GitHub · 2026-11-25 01:13 UTC · original
The slot 57 decoder is on main via #2124 (
f4752176). I independently compiled it with MSVC /O2, checked all 35 synthetic assertions, and confirmed the shifted-offset counterexample failed. The original bit fields match the Mesa gfx10 register table. The item A draw claimant can now build against this header. Its depth-bounds and unequal front/back flag states still need an explicit fallback or refusal in that integration; the decoder alone does not apply them to draws.@tedin7 on GitHub · 2026-11-25 01:40 UTC · original
Picking up Item D (depth-stencil target binding for translated draws, including depth-only) and Item F (integer / 32-bit float render-target variants) as two separate PRs with D3D12 WARP readback tests.
@tedin7 on GitHub · 2026-11-25 01:42 UTC · original
Update: Item D appears already covered on
mainvia #1430 (slot 50 DSV bind) andtests/startup_stream_depth_check.py, so we are skipping Item D and continuing only with Item F.@tedin7 on GitHub · 2026-11-25 02:47 UTC · original
Picking up Item E (indirect Draw/DrawIndexed with console-only primitive topologies) with unit + D3D12 WARP readback tests.
@R0Y00 on GitHub · 2026-11-25 03:19 UTC · original
For item E, #2180 merged at
a2010c91. Slot 61 now reports forwarded calls and refusal counts by signature kind with the render heartbeat. On WARP and RTX 4060 Laptop the source-built checks passed 7/7, including a wrong-count control and separate graphics-pipeline, compute-pipeline, and placeholder refusals. A rerun can now identify where calls stopped. Keep the existing rectangle-list and GPU-counted command work separate from these counters.@R0Y00 on GitHub · 2026-11-25 03:35 UTC · original
Item A's first draw-path slice has merged in #2169 (
009153b7). WithX2W_DEPTH_STATE=1, supported slot 57 state drives the depth/stencil draw and restores the caller's stencil reference afterward. The mixed-pipeline readback passed on WARP and RTX 4060 Laptop, including Reset back to zero. Removing the restore made the next stencil draw blue instead of green on both adapters. The switch is opt-in. Keep rasterizer state and the other render-state items separate.@RavenCurseBurg on GitHub · 2026-11-25 05:24 UTC · original
For item B, I can take a source-built culling and front-face winding readback on WARP. Before implementing the slot-57 integration, is anyone already publishing that part of the local rasterizer decoder mentioned above? A public decoder branch or the block-A word index for
PA_SU_SC_MODE_CNTLwould let me reuse the same layout. The fixture can use synthetic register words and two triangles with opposite winding, checking the result for front cull, back cull and the default switch setting. #1567 covers the slot-86 stream subobject; here the input would be the slot-57 register block. Polygon offset can stay a separate slice.@RavenCurseBurg on GitHub · 2026-11-25 07:01 UTC · original
Item B now has a runnable desktop cull/winding reference. One draw submits two mirrored triangles over an 8×4 target. The six combinations of no/front/back culling and clockwise/counterclockwise front faces each matched all 32 expected pixels on WARP and a physical D3D12 adapter. Ignoring either cull setting, swapping front/back culling, or reversing the front-face convention each changed the readback as expected. The hosted WARP run builds the same source and runs the same cases.
This pins the desktop reference for integration. The runtime dependency is still the location of the rasterizer word inside the slot-57 state block; the reference explicitly sets the desktop PSO fields.
AI-assisted (Codex, GPT-6.2 Astra xhigh).
@R0Y00 on GitHub · 2026-11-25 08:17 UTC · original
Thanks for the six-way cull and winding reference. Please turn that source-built reference into a focused fixture PR if you are up for it. Keep the opposite-winding triangles, the full 8×4 readback and the three mutation controls. Run it on WARP and hardware with the debug layer, and record the adapter, driver, and command. This gives the slot 57 integration an independent desktop reference. Leave the guest register location out of the fixture until it is independently established. #1567 covers the separate slot 86 stream path.
@RavenCurseBurg on GitHub · 2026-11-25 08:19 UTC · original
I’ll turn the desktop rasterizer reference into a focused fixture PR. I’ll keep the opposite-winding triangles, six PSO combinations, the complete 8×4 image and the mutation controls, and record which adapter and driver actually ran with the debug layer enabled. The fixture will use only desktop PSO state.
@RavenCurseBurg on GitHub · 2026-11-25 08:34 UTC · original
The desktop fixture is up in #2260. It reports the adapter and driver and checks 6/6/12/12 differing pixels for the four wrong states. WARP with the debug layer and the physical RTX 4060 both produced all six full images. The RTX host has no Graphics Tools debug layer, so a run of the two documented CTests on a physical adapter with the layer enabled would complete the requested evidence.
@R0Y00 on GitHub · 2026-11-25 13:29 UTC · original
The rectangle-list indirect Draw path landed in #2173 (
214ed093). The Windows fixture compares a full image on WARP and RTX 4060 Laptop, including distinct scratch for concurrent submissions. The shared-scratch mutation was detected, and a live compute root binding is still refused. This covers the rectangle-list conversion; the other draw families and title-side evidence remain open here.@RavenCurseBurg on GitHub · 2026-11-25 14:06 UTC · original
I will measure the narrow RGBA8 integer targets left open by #2148, formats 30 (UINT) and 32 (SINT). The source-built fixture will use distinct in-range and out-of-range channel words, compare saturation with low-byte truncation, and verify the independently typed UNORM target. I will report FXC/DXC on WARP and RTX 4060, with an explicit distinction between the translated desktop result and native guest hardware.
@RavenCurseBurg on GitHub · 2026-11-25 14:22 UTC · original
The RGBA8 measurement is complete; implementation and regression tests are in #2378. I compared translated pixel shaders with independently compiled typed HLSL on local RTX 4060, local WARP, and Windows Server 2025 WARP, using FXC and DXC for each. All 36 comparisons matched the saturated CPU reference on the integer target and
ff0000ffon the simultaneous UNORM target.The source-built comparison and hosted WARP debug-layer results are public. The evidence establishes desktop output-merger behavior on these two views. Native console readback is still outstanding.
@RavenCurseBurg on GitHub · 2026-11-25 14:39 UTC · original
I’ll take a stream-path winding follow-up for item B now that #1567 has landed. Its synthetic triangle distinguishes front from back culling, but its test currently accepts either ordering of the two images and always sets FrontCounterClockwise to false. I’ll check the exact 8×4 image for each cull direction, toggle the winding bit on both RASTERIZER and RASTERIZER1, and verify the test detects a swapped cull or ignored winding field. This exercises the translated slot-86 stream in addition to the desktop reference from #2260.
@RavenCurseBurg on GitHub · 2026-11-25 14:47 UTC · original · edited 2026-11-25 15:06 UTC
For item F I’m measuring the remaining narrow integer RTVs together after #2378: single- and two-channel 8/16-bit views, RGBA16, and the mixed-width R10G10B10A2_UINT view. I’ll compare source-built exports with independently compiled typed HLSL, check the destination bytes and simultaneous UNORM target, and distinguish per-channel saturation from discarded high bits. I’ll record any unsupported view or adapter separately before proposing changes.
Completed in #2392. All 198 translated/direct comparisons matched, including 132 where the low-bit shader gave different bytes; the remaining 66 were in-range controls. The exact PR head passed all three focused Windows Server WARP tests, with 22 narrow-target readbacks across FXC and DXC. Independent measurement and exact-head tests.
@R0Y00 on GitHub · 2026-11-25 15:11 UTC · original
The item B stream winding follow-up landed in #2387 (
a4900150). My Windows Release run passed 4/4 on WARP and RTX 4060 Laptop with the debug layer enabled. The fixture checked all 32 pixels with both cull directions, both windings, and both rasterizer subobject types. Buildstartup_stream_rasterizer, then runctest --preset release --no-tests=error -j 1 -R '^startup_stream_rasterizer(_ignore)?_(hardware|warp)$' -V. Item F stays open for the remaining typed views you are measuring.@denn0x on GitHub · 2026-11-25 18:01 UTC · original
On item B and the question about the
PA_SU_SC_MODE_CNTLword index: I've put up the decode logic only, in #2480.PA_SU_SC_MODE_CNTLvalue into D3D12 cull, front-face winding and fill mode, and refuses the forms D3D12 can't express. It comes with a device-free synthetic fixture and three wrong-field controls.FACE0 is taken as counter-clockwise front, as in radeonsi. The function also takes aflip_windingswitch, because that convention is not established against the D3D12 viewport.@R0Y00 on GitHub · 2026-11-25 20:16 UTC · original
The standalone PA_SU_SC_MODE_CNTL decoder landed in #2480 (
53a7d10e). Its four Windows Release checks cover cull, fill and winding, including the invalid-mode controls. Item B still needs independent evidence for where the runtime record stores the word and which winding the viewport requires. A source-built front/back pair with a swapped-winding negative control can separate those two questions before wiring the decoder into slot 57.