Repository navigation
fix: default viewport and scissor for translated draws - #1657
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22989d61c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep the title's viewport/scissor flags apart from the automatic default and remember the size of the default already forwarded, so a list that never sets its own state follows render target 0 across OMSetRenderTargets. Adds a grow case to startup_stream_viewport. AI-assisted; commands listed were executed locally.
AI-assisted; commands listed were executed locally.
Two ways to overwrite a title-set viewport both survive the fixtureReviewed Environment: Windows 11 build 26300.9974, MSVC 14.44.35207, SDK 10.0.26100. cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^startup_stream_viewport' -VMutations
Why I am not calling the last two a gap outright
That leaves two readings I cannot separate from the fixture:
The way to tell them apart is one more case, and it is small: in I would rather flag this than stay quiet, because the branch's own comment says "Only the title's own calls set the flags; an automatic default is regenerated when render target 0 changes size" — the size cache is what makes the two What is solid in the changeThe swap and the disabled-scissor mutants being caught means the default rectangle is asserted in both extents and both views, and the VerdictReviewed |
Conflicts resolved keeping both sides: - d3d12_draw.inl: mip comment line, upstream's wording (R0Y00#1630). - d3d12_xs_device.cpp: Pass keeps local compute root state and upstream viewport/scissor flags (R0Y00#1657); local ExecuteIndirect trace (slot 61) and upstream list_root_cbv (slot 42, R0Y00#1654) both kept. - xcrdapi.cpp: local failure tally, RDS5 shift/slice and stream cache kept next to upstream's BCPack census (R0Y00#1622); queue worker is upstream's CreateThread worker (R0Y00#1410), the local tally_failure("exception") moved into fail_entry. - run.ps1: upstream venv python and exit code (R0Y00#1535/R0Y00#1603) with local --fast-exit/--log-repeats. - gfx2hlsl.py image(): local 1D lowering (load, sample, sample_l, a16) kept over upstream's sample-only 1D guard; startup_image_sample_l_check keeps the local 1D SampleLevel expectation, startup_image_3d_check keeps the local 1D assertions plus upstream's cube-dimension refusal. Tests adjusted for local behaviour: startup_run_ps1_check expects the two local debugger arguments, startup_translator_check's StubPipeline has ps_entry_reads, and the coverage check's hand-built Pipeline sets packed_position_vgpr (new in R0Y00#1634).
Conflict in d3d12_xs_device.cpp list_viewports / list_scissors: kept upstream R0Y00#1657's viewport_set / scissor_set flags on a forwarded call and the local state_dropped counters on a dropped one.
What
A command list that never calls RSSetViewports (list slot 21) or RSSetScissorRects (slot 22) draws no pixel on desktop D3D12, yet every translated draw is counted as drawn. Pass now remembers whether the title set each one. A translated draw with no viewport covers the first render target (width, height, depth 0 to 1); with no scissor it gets the same rectangle. A viewport or scissor the title set is never replaced.
Tests
New
startup_stream_viewport_warpandstartup_stream_viewport_hardwarereuse thestartup_stream_consumerfixture (mode chosen by X2W_TEST_VIEWPORT) on an 8x4 target cleared to blue, red pixel shader:Failure message names the first wrong pixel. A mutation that disables the default fails
noneat pixel (0, 0); one that overrides the title's rectangle failsrectat pixel (2, 1); one that keeps the flags across Reset failsresetat pixel (0, 0). The disable-default-viewport mutation was run on Windows 2025 (see Verification).Windows 2025 command:
ctest --preset dev --no-tests=error -R '^startup_stream_viewport_(warp|hardware)$' -VRun locally
x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-onlyon tests/startup_stream_setup.cpp and tests/startup_stream_draw.cpp: clean.Verification (Windows Server 2025, build 26100, MSVC 14.44, D3D12 WARP)
At 22989d6 (same tree as 50aaa70):
x2w_pipe.py preflight /root/wt/x2w-frontier-p04-viewport: no FAIL. It flagged the identifiersmall(Windows SDK macro) in tests/startup_stream_setup.cpp; renamed toinsetin 50aaa70.x2w_pipe.py win2025 1657 --regex '^(startup_stream_viewport_warp|startup_stream_draw_warp|startup_stubs|d3d12x_graphics_list_warp|startup_cb_blend_warp|stream_root_srv_warp)$' --force:--preset dev): 6/6 passed./O2(--preset release): 6/6 passed.if (false && !pass.viewport_set)),startup_stream_viewport_warpfailed on Windows 2025:none: pixel (0, 0) is 0000ffff, expected ff0000ff. The mutation commit was reverted (1f24626, 22989d6)._hardwarevariant skips: the node has only WARP.Open PR overlap
git merge-treeagainst the heads of #1441, #1469, #1511, #1549, #1555, #1567, #1641 and #1654: no new conflict. The existing conflicts of #1441 and #1469 (CMakeLists.txt, xg_xs.cpp) and #1549 (docs/experiments.md) already exist against main without this change. #1654 also edits tests/startup_stream_setup.cpp and docs/startup-runtime.md; it merges cleanly.AI-assisted; commands listed were executed locally.