[pr-fix][rendering] darner-gpu: OMSetRenderTargets takes at most eight render targets #427
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:list-omset-render-targets-bound"
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?
Contributor role (optional)
What it changes
The problem on main: the console-side
OMSetRenderTargetstook the title'scountand used it as a length. The one-range form built the handles by hand and, past its inline eight, fell off the fixed array into the heap:and the other form took the title's own
countelements (items(handles, count)). The count then reachedState::set_targetsandBoundTargets::restore, which bind one view per handle. D3D12 takes at mostD3D12_SIMULTANEOUS_RENDER_TARGET_COUNT(8) render targets, so a count ofu32::MAXaskedcollect()for 32 GB — whose refused allocation ishandle_alloc_error, an abort the run's filters do not see — and any count past eight named more views than the host command list accepts. Eight is already the file's own knowledge:thin::targetsclamps the same argument (thin.rs:919), and bothrange_bufandBoundTargets::restore'sinlineare eight long.This change takes the count as at most
RENDER_TARGETS(8, documented asD3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) before any handle is built, in one helper both forms go through, and refuses the excess the waythin::targetsdoes — silently, keeping the first eight. The helper exists becausestate::targetscannot be reached without a host command list, so the bookkeeping had to be testable on its own.How it was tested
e233b4d(one commit onf3840d7).cargo test --locked -p darner-gpu --lib— 1757 passed, 0 failed, 81 ignored. (One earlier run on this tree failedwatch::tests::ask_once_by_res_splits_reservations_without_refusals, one of the two pre-existing parallel-suite flakes; it passes alone and also fails on unmodifiedf3840d7in the same worktree.)list::tests::render_target_counts_past_eight_take_the_first_eightpins the bookkeeping without a GPU or a title: the eight views that follow the first on the one-range form from a count of nine, the first eight handles of the title's own sixteen-element array, the first eight from a count ofu32::MAX(read from the eight-element array it really is), and an empty slice for a null array on both forms.cargo clippy --locked -p darner-gpu --all-targets -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --workspace --locked: not green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request:darner-gpustands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependent flakes of #150;darner-shaderfailsemit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes.Closefailure that followed are not reproduced (no adapter); the test pins the count that reaches the bookkeeping. TheOMSetRenderTargetsentry points themselves are not called (they need a host command list).Checklist
main.main.docs/asset-policy.md. (cargo xtask policy: 555 files ok.)Checked for overlap
crates/darner-gpu/src/list.rsas well. Neither appears to touchstate::targetsor the render-target count in its description; they are listed so a reviewer can check for a conflict. No open or closed issue mentionsOMSetRenderTargetsor a render-target count.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.