Repository navigation
gpu: bind both heaps before a directly indexed root signature - #49
Conversation
simnJS
left a comment
There was a problem hiding this comment.
Thanks, this is a clean fix and the reasoning holds up. #46 has merged, so could you retarget this to main and rebase (it's well behind now)? Main has since gained two more 1419 sites: the allowance at pipeline/host.rs:2049, and Target::bind in rectangles/geometry.rs (~417 and ~1178), which sets the root signature with no heaps bound — that's the current rectangle_geometry_obeys_depth_bounds failure on main. Covering them with heaps_with_own_samplers would be great. Small nit: the description says 8 tests, the commit says seven. We'll approve once it's green on main.
|
This pull request now conflicts with its base branch. Please rebase it on |
87db613 to
c1fa1b2
Compare
|
Thanks. Done in c1fa1b2: retargeted to main and rebased onto f74e985.
Under the layer on main: 410 passed. The full WARP pr-check passes; its first attempt hit |
|
This pull request now conflicts with its base branch. Please rebase it on |
simnJS
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. c1fa1b2 covers the last round: the pipeline/host.rs allowances are gone, Target::bind binds both heaps, and the description no longer counts tests. The debug-layer job at this head shows no 1419, and rectangle_geometry_obeys_depth_bounds passes.
Main has moved since (now 4ccd539) and the PR conflicts again. For the rebase:
State::bindon main now callswanted_heaps(constant_reads || root_uavs || root_srvs && bounded_root_srvs()). With your parameterlesswanted_heaps()those three locals have no other use, so they can go; filling both slots already covers the root UAV and constant-read cases.- Main added two 1419 allowances in
descriptor/host.rs:stride_table_reads_stay_inside_the_table_and_tell_remapped_slotsandviews_read_through_the_table_only_are_refreshed_for_picks. Both run throughrun_table_program, which you already fix, so please remove them.known_layer_errorsdoes not fail once the error stops, so a stale one would go unnoticed. - Main now has
testgpu::bind_indexed_heaps, which does in tests whatheaps_with_own_samplersdoes. The depth-bounds test already calls it beforeTarget::bind. Please keep one helper and drop the double binding. - My mistake last time: the stream-output pass uses
empty_root(ALLOW_STREAM_OUTPUT), which indexes no heap, so that hunk is not needed. - Optional:
own_samplershas 16 slots. A shader indexing the sampler heap past 15 while the title has no hosted sampler heap reads out of bounds; 2048 null samplers (the shader-visible maximum, a few dozen KB) would cover any index a title can form. - The description already discloses the AI help, so please drop the
Co-Authored-Bytrailer when you rebase.
We'll approve once it is rebased and green.
c1fa1b2 to
935b09f
Compare
|
Rebased onto main (05db757) and pushed 935b09f on top, with follow-ups from an in-house review:
Under the layer there is no 1419 anywhere, and the full WARP pr-check passes. |
|
This pull request now conflicts with its base branch. Please rebase it on |
simnJS
left a comment
There was a problem hiding this comment.
Thanks, this covers the last round. The three locals are gone, the descriptor/host.rs allowances are removed, and with heaps set in bind_pipeline no 1419 allowance is left. CI is fully green, gpu-debug-layer included. The sampler-slot test is a nice addition.
One thing before I merge: both commits still carry the Co-Authored-By trailer. Please drop it (a force-push is fine for that); the AI line in the description is what CONTRIBUTING asks for. Main has also moved a lot since (several fixes for the same 1419 tests landed today), so please merge main in at the same time and check the result.
Non-blocking nits, fine for a follow-up:
rectangles/geometry.rs:748and:790still callbind_indexed_heapsjust beforeTarget::bind, which binds the same heaps at:419. One of the two can go.- The stream-output pass (
:1242) usesempty_root(ALLOW_STREAM_OUTPUT), so itsSetDescriptorHeapsisn't needed. own_samplersstill has 16 slots. 2048 would cover any index a shader can form.
Approving.
Pipelines' root signatures index the view and sampler heaps directly, which D3D12 allows to be set only once both heaps are bound (debug layer message 1419). Lists that bound no sampler heap of the title's, or no view heap, set them anyway. The draw state now binds XTP's own heap in place of each the title binds none of: the view heap it had, and a new sampler heap of null samplers. Test helpers that set such a root signature do the same (in the descriptor, pipeline and rectangle-geometry tests), and every allowance for 1419 goes. Part of #45.
Reword the docs for the rule of both heaps bound before a directly indexed root signature, test a title sampler heap and unchanged heaps, make bind_indexed_heaps use XTP's own static heaps, and log once when a wanted heap has no host heap.
935b09f to
ac0024a
Compare
simnJS
left a comment
There was a problem hiding this comment.
Thanks. Both trailers are gone, and the rebase onto 997af76 fits what main fixed today:
- the twins and loop-counter fixes stay;
- the draw allowances main already removed are no longer touched;
- every 1419 allowance is gone;
rectangles/geometry.rsno longer binds the heaps twice, and the stream-output hunk is gone.
CI is fully green, gpu-debug-layer included. Optional: the description still mentions the stream-output pass. Approving and merging.
What and why
Part of #45, message id 1419. It builds on #46 (merged), whose debug-layer harness found it and checks it.
D3D12 lets a root signature with
CBV_SRV_UAV_HEAP_DIRECTLY_INDEXEDorSAMPLER_HEAP_DIRECTLY_INDEXEDbe set only once a heap of that type is bound ("SetDescriptorHeaps must be called to bind a sampler descriptor before setting a root signature with D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED flag"). Translated pipelines' root signatures carry both flags (pipeline/host.rs). But when a title binds no sampler heap, or no view heap,draw::State::bindbound only what the title had, then set the root signature anyway. That is invalid D3D12 usage of the kind that can hang an NVIDIA GPU.draw::State::wanted_heapsnow puts XTP's own heap in place of each one the title binds none of (or one without a host heap). That means the view heap it already had (OWN_VIEW_HEAP, until now only for root SRV tables), and a new sampler heap of 16 null samplers (OWN_SAMPLER_HEAP,descriptor::own_sampler_heap,HostHeap::own_samplers). Theroot_srvsargument is gone: the view slot is always filled. Code that special-casesOWN_VIEW_HEAP(picked buffers, the stride table, root SRV tables) behaves as before: XTP's heaps have no stride table, so that path still refuses as it did with no heap.descriptor::heaps_with_own_samplers, test-only): indescriptor/host.rs, inpipeline/host.rs(render_r8_uintand the compute helper), and inrectangles/geometry.rs(Target::bindand the stream-output pass). The last one is behindrectangle_geometry_obeys_depth_boundsfailing on main.known_layer_errors(&[1419], "#45")allowance is gone; none is left in the tree.Area
gpu:draw.rs,descriptor.rs,descriptor/host.rs, test helpers inpipeline/host.rsandrectangles/geometry.rs.Tests
cargo xtask pr-checkpasses on my machineNew or changed behaviour has tests that need no game files, or I explain below why it cannot
draw::tests::lists_without_a_view_heap_use_xtps_ownnow expects both of XTP's heaps without the title's, and the title's view heap with XTP's sampler heap after it binds one.Under the layer (
XTP_TEST_ADAPTER=warp XTP_D3D12_DEBUG=1 XTP_REQUIRE_GPU=1 RUST_TEST_THREADS=1 cargo test -p xtp-gpu --features diagnostics --locked), rebased on mainf74e985: 410 passed, no 1419 anywhere, includingrectangle_geometry_obeys_depth_boundsanda_pipeline_with_a_geometry_shader_runs_the_export_shader. The tests that had the allowance fail with message 1419 without this change (the draw tests throughState::bind, the others through the helpers).Ran on the title: BTP 6, Series S, diagnostics build on WARP, fresh data and cache, 150 s, stopped by its exact process handle, with this change and on its parent. Both runs gave 32 frame lines through to the stop, median 13.9 fps, the same 16 warnings, and no errors. No gameplay stage is claimed, and no log is included.
Provenance
AI assistance: Claude Code (Opus 5.5) drafted the change, tests and verification. No external code was copied or translated. I answer for every line.
Checklist
<area>: <summary>; one topic; under 400 changed lines, or the reason is above🤖 Generated with Claude Code