startup: declare no DSV format on a pipeline that does not use depth #3535

Merged
KelboLive merged 2 commits from upstream-pr/3535 into main 2026-11-30 08:58:47 +00:00
KelboLive commented 2026-11-30 02:17:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-30T02:17:33Z.


Change

pipeline_for() declared desc.DSVFormat = dsv_format unconditionally, and pass_dsv_format() returns the
bound depth view's format whenever one is bound ΓÇö including when the stream PSO carries no depth-stencil
state. A state that enables neither depth nor stencil must declare DXGI_FORMAT_UNKNOWN. Declaring the
bound view's format instead is what the debug layer reports as message 1477:

ID3D12Device::CreateGraphicsPipelineState: The DSV format is (D16_UNORM) but the graphics pipeline
state does not use ...

startup_indirect_translated_targets_hardware fails on that warning in the Agility configuration even
though all five of its pixel checks pass.

Declare DXGI_FORMAT_UNKNOWN when depth/stencil is disabled, and let the pipeline cache keys, the recipe
replay and the log line follow the state actually built. Two passes that differ only in an unused DSV
format now share one pipeline.

Refs #3525.

Verification

Base upstream/main 47c30feb9. NVIDIA GeForce RTX 4070 Ti SUPER, driver 32.0.16.2101, debug layer on.

Agility configuration (-DOFFSCREEN_AGILITY_620_DIR + -DOFFSCREEN_WARP_DIR, Agility SDK 1.620.2,
WARP 1.0.22):

before: startup_indirect_translated_targets_hardware ***Failed  0.72 sec
        all five pixel checks OK; message 1477 emitted twice
after:  startup_indirect_translated_targets_hardware  Passed   0.83 sec
        no message 1477

In-box configuration (default dev preset), at this head:

ctest --preset dev -R 'depth|dsv|startup_indirect_(translated_targets|draw_indexed)'
100% tests passed out of 35

Context from the same host: a full sweep of the 952 _hardware tests on main before this change had no
functional failures, so the depth paths were already clean; this was checked against those tests plus every
depth/dsv test above.

Evidence and follow-up

CI cannot catch this: both Windows jobs build the in-box configuration, where the in-box debug layer does
not emit 1477 for this case. The reproduction is the Agility configuration above.

This settles option 1 in #3525: the warning is the shim's, not the fixture's. If the maintainers would
rather the fixture accept severity 2 here, that is option 2 and this patch should be dropped instead ΓÇö
the two are mutually exclusive.

Recipes recorded before this change

X2W_PSO_RECIPE_DIR records already written for such passes carry the old DSV format. pso_recipe_targets_match now skips them, so those passes lose pipeline precreation until the recipe is re-recorded; the pipeline is still created on demand, so the behaviour is unchanged.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5557790021 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3535). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T02:17:33Z. --- ## Change `pipeline_for()` declared `desc.DSVFormat = dsv_format` unconditionally, and `pass_dsv_format()` returns the bound depth view's format whenever one is bound ΓÇö including when the stream PSO carries no depth-stencil state. A state that enables neither depth nor stencil must declare `DXGI_FORMAT_UNKNOWN`. Declaring the bound view's format instead is what the debug layer reports as message 1477: ``` ID3D12Device::CreateGraphicsPipelineState: The DSV format is (D16_UNORM) but the graphics pipeline state does not use ... ``` `startup_indirect_translated_targets_hardware` fails on that warning in the Agility configuration even though all five of its pixel checks pass. Declare `DXGI_FORMAT_UNKNOWN` when depth/stencil is disabled, and let the pipeline cache keys, the recipe replay and the log line follow the state actually built. Two passes that differ only in an unused DSV format now share one pipeline. Refs #3525. ## Verification Base `upstream/main` `47c30feb9`. NVIDIA GeForce RTX 4070 Ti SUPER, driver 32.0.16.2101, debug layer on. Agility configuration (`-DOFFSCREEN_AGILITY_620_DIR` + `-DOFFSCREEN_WARP_DIR`, Agility SDK 1.620.2, WARP 1.0.22): ``` before: startup_indirect_translated_targets_hardware ***Failed 0.72 sec all five pixel checks OK; message 1477 emitted twice after: startup_indirect_translated_targets_hardware Passed 0.83 sec no message 1477 ``` In-box configuration (default `dev` preset), at this head: ```powershell ctest --preset dev -R 'depth|dsv|startup_indirect_(translated_targets|draw_indexed)' 100% tests passed out of 35 ``` Context from the same host: a full sweep of the 952 `_hardware` tests on `main` before this change had no functional failures, so the depth paths were already clean; this was checked against those tests plus every `depth`/`dsv` test above. ## Evidence and follow-up CI cannot catch this: both Windows jobs build the in-box configuration, where the in-box debug layer does not emit 1477 for this case. The reproduction is the Agility configuration above. This settles option 1 in #3525: the warning is the shim's, not the fixture's. If the maintainers would rather the fixture accept severity 2 here, that is option 2 and this patch should be dropped instead ΓÇö the two are mutually exclusive. ## Recipes recorded before this change `X2W_PSO_RECIPE_DIR` records already written for such passes carry the old DSV format. `pso_recipe_targets_match` now skips them, so those passes lose pipeline precreation until the recipe is re-recorded; the pipeline is still created on demand, so the behaviour is unchanged.
lukaslw-lab commented 2026-11-30 07:22:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T07:22:23Z.

Review: APPROVED


Reviewed 977e36d6 by reading the diff; not built or run.

Verdict: approve. When use_depth_stencil is false, the desc keeps its zero-initialised depth-stencil state (src/startup_stubs/d3d12_draw.inl:1545). Declaring DXGI_FORMAT_UNKNOWN then matches what is built, and the state key, targets key, recipe replay and log line all follow pso_dsv_format consistently. No MUST.

  • SHOULD cover the second half of the condition, or narrow the claim. pso_dsv_format (:1521) keys on use_depth_stencil, which only says that a depth-stencil state exists (bound.has_depth_stencil). A stream PSO whose DEPTH_STENCIL subobject has DepthEnable = StencilEnable = FALSE while a DSV is bound still declares the bound format. That is the same "does not use" case, so message 1477 can still appear there. Either add bound.depth_stencil.DepthEnable || bound.depth_stencil.StencilEnable to the condition, or change the comment from "enables neither" to "carries no depth-stencil state".
  • NIT X2W_PSO_RECIPE_DIR records already written for such passes carry the old DSV format (pso_recipe.h:204). pso_recipe_targets_match now skips them and the pipeline is created normally, so they only lose precreation until they are re-recorded. Worth a line in the PR body; the change is still correct.
  • Checked: passes that do use depth are unchanged (same format, same keys). Merging two passes that differ only in an unused DSV format is safe, because neither one binds a depth state.

Tests: none added. startup_indirect_translated_targets_hardware is the regression test, but only in the Agility configuration (author's before/after above). CI builds the in-box configuration, where the debug layer does not emit 1477, so CI cannot show the fix; the green run shows only that nothing else regressed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6108231966 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3535#pullrequestreview-6108231966). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T07:22:23Z. **Review:** APPROVED --- Reviewed `977e36d6` by reading the diff; not built or run. **Verdict: approve.** When `use_depth_stencil` is false, the desc keeps its zero-initialised depth-stencil state (`src/startup_stubs/d3d12_draw.inl:1545`). Declaring `DXGI_FORMAT_UNKNOWN` then matches what is built, and the state key, targets key, recipe replay and log line all follow `pso_dsv_format` consistently. No MUST. - **SHOULD** cover the second half of the condition, or narrow the claim. `pso_dsv_format` (`:1521`) keys on `use_depth_stencil`, which only says that a depth-stencil state exists (`bound.has_depth_stencil`). A stream PSO whose DEPTH_STENCIL subobject has `DepthEnable = StencilEnable = FALSE` while a DSV is bound still declares the bound format. That is the same "does not use" case, so message 1477 can still appear there. Either add `bound.depth_stencil.DepthEnable || bound.depth_stencil.StencilEnable` to the condition, or change the comment from "enables neither" to "carries no depth-stencil state". - **NIT** `X2W_PSO_RECIPE_DIR` records already written for such passes carry the old DSV format (`pso_recipe.h:204`). `pso_recipe_targets_match` now skips them and the pipeline is created normally, so they only lose precreation until they are re-recorded. Worth a line in the PR body; the change is still correct. - Checked: passes that do use depth are unchanged (same format, same keys). Merging two passes that differ only in an unused DSV format is safe, because neither one binds a depth state. Tests: none added. `startup_indirect_translated_targets_hardware` is the regression test, but only in the Agility configuration (author's before/after above). CI builds the in-box configuration, where the debug layer does not emit 1477, so CI cannot show the fix; the green run shows only that nothing else regressed.
KelboLive commented 2026-11-30 08:43:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-30T08:43:12Z.


Took the second option from the SHOULD, and the first would not have been valid — I tried it.

Adding DepthEnable || StencilEnable to the condition makes startup_stream_depth fail on both WARP and hardware, and the debug layer says why:

sev=2 id=680 CreateGraphicsPipelineState: The depth stencil unit or pixel shader expects a ...
sev=1 id=615 DrawInstanced: The depth stencil format does not match that specified by the current pipeline state

So a bound DSV must match the pipeline's DSVFormat even when depth and stencil are both disabled. The ds_disabled PSOs in that fixture (DepthEnable = FALSE with DSVFormat = D32_FLOAT and a DSV bound) are a legitimate configuration, and declaring UNKNOWN for them is rejected at draw time. Reverted to use_depth_stencil and corrected the comment to say what it actually guarantees: 1477 is the case where the pass carries no depth-stencil state at all, so the bound format has nothing to match.

Re-verified at d8cf4c3e4:

startup_stream_depth_{warp,hardware}                  Passed   3.19 / 5.78 s
startup_indirect_translated_targets_{warp,hardware}   Passed
startup_indirect_draw_indexed_{warp,hardware}         Passed

in-box: ctest -R 'depth|dsv|startup_indirect_(translated_targets|draw_indexed)'   35/35

The diff for this follow-up is comment-only; the code is unchanged from 977e36d6e.

On the NIT: agreed, and it is worth a line in the description — recipes recorded before this change carry the old DSV format, so pso_recipe_targets_match skips them and those passes lose precreation until the recipe is re-recorded. Updated the description to say so.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7273258015 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3535#issuecomment-7273258015). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T08:43:12Z. --- Took the second option from the SHOULD, and the first would not have been valid — I tried it. Adding `DepthEnable || StencilEnable` to the condition makes `startup_stream_depth` fail on both WARP and hardware, and the debug layer says why: ``` sev=2 id=680 CreateGraphicsPipelineState: The depth stencil unit or pixel shader expects a ... sev=1 id=615 DrawInstanced: The depth stencil format does not match that specified by the current pipeline state ``` So a bound DSV must match the pipeline's `DSVFormat` even when depth and stencil are both disabled. The `ds_disabled` PSOs in that fixture (`DepthEnable = FALSE` with `DSVFormat = D32_FLOAT` and a DSV bound) are a legitimate configuration, and declaring `UNKNOWN` for them is rejected at draw time. Reverted to `use_depth_stencil` and corrected the comment to say what it actually guarantees: 1477 is the case where the pass carries no depth-stencil state at all, so the bound format has nothing to match. Re-verified at `d8cf4c3e4`: ``` startup_stream_depth_{warp,hardware} Passed 3.19 / 5.78 s startup_indirect_translated_targets_{warp,hardware} Passed startup_indirect_draw_indexed_{warp,hardware} Passed in-box: ctest -R 'depth|dsv|startup_indirect_(translated_targets|draw_indexed)' 35/35 ``` The diff for this follow-up is comment-only; the code is unchanged from `977e36d6e`. On the NIT: agreed, and it is worth a line in the description — recipes recorded before this change carry the old DSV format, so `pso_recipe_targets_match` skips them and those passes lose precreation until the recipe is re-recorded. Updated the description to say so.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3535
No description provided.