Skip to content

GPU: preserve typed null render target slots - #450

Open
fuzeofficlal wants to merge 2 commits into
Marvisak:mainfrom
fuzeofficlal:fix/typed-null-rtv
Open

fuzeofficlal wants to merge 2 commits into
Marvisak:mainfrom
fuzeofficlal:fix/typed-null-rtv

Conversation

@fuzeofficlal

@fuzeofficlal fuzeofficlal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

A typed null RTV still occupies an output slot. Skipping it in State::set_targets moves the next live target into the wrong slot. Keep the typed null descriptor in the host binding array and track only live textures for state transitions and capture.

The regression draws two colors with a null RGBA8 RTV in slot 0 and a live RGBA8 RTV in slot 1. The PSO uses UNKNOWN for slot 0. Before the fix, the D3D12 debug layer rejected the live target bound to slot 0. With the fix, all 16 pixels in the live texture receive the color from SV_Target1 on native D3D12 and WARP.

cargo test -p victory-gpu --features diagnostics passed with 47 tests and one ignored benchmark. The default suite passed with 44 tests and one ignored benchmark. The default view lookup also returns no format when there is no resource. The staged asset policy check passed.

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 93edd8e on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed). The new typed_null_rtv_keeps_the_next_color_slot only builds with --features diagnostics, which I did not run separately for this PR.

  • A typed null RTV now takes its slot (CreateRenderTargetView(None, desc)), so later targets keep their indices. Only live textures go into targets and capture.
  • The view_format reorder also fixes a real bug: before, resource(this) was dereferenced before host_resource could return None for a null this. The new test covers that.
  • Nit: a null record without a desc (record.desc() is None) still hits continue and shifts later slots, as before. D3D12 needs a desc for a null RTV, so there is no direct fix, but a tracing::debug! there would make the remaining case visible.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…t slots

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DeerSilver

Copy link
Copy Markdown

Tested head 93edd8e merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: pass. No game files: the test suite only.

  • The PR's new test passes. It uses the host GPU and ran on the RTX 5060 (DXGI adapter 0 on this laptop, so the host-device helpers return a device and the tests don't take their early return):
    • a_missing_resource_has_no_default_view_format
  • cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored, against 342 passed / 6 ignored on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

dudegio pushed a commit to dudegio/VIctory-world-preview that referenced this pull request Nov 24, 2026
…layout

Integrates renderer changes from Marvisak/VIctory#450 and #492. Includes capture-verified surface normal decoding.
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. State::set_targets in draw.rs no longer skips a typed null RTV. It binds a host null view built from the title's own description (Host::rtv now takes Option<&ID3D12Resource>), so later targets keep their SV_Target<n> slots. I checked:

  • reordering resource::view_format to look up the host resource first avoids touching the title resource when it is null, which RtvRecord::desc would otherwise do for a null view;
  • the new draw test pins the PSO's slot 0 to UNKNOWN, as D3D12 requires for a null RTV, and checks slot 1 by readback.

A null view with no description is still skipped and still shifts the slots. #1613 (open, needs work) covers that case and targets without a host texture, and overlaps this PR. The maintainer should pick one, or fold this test into the other.

CI: passing (check).


Generated by Claude Code

dudegio pushed a commit to dudegio/VIctory-world-preview that referenced this pull request Nov 25, 2026
Adapt typed null RTVs from fuzeofficial (Marvisak/VIctory#450) and writable RGB9E5 format substitution from Yaekai (#492). Decode captured packed surface normals and preserve disjoint buffer update ranges.
Materialize an explicit null RTV when recording host render-target bindings. Keep the resource-transition list limited to real textures. A synthetic MRT draw verifies that the real target receives SV_Target1 after a typed null in slot 0.
AgneyaK added a commit to AgneyaK/VIctory that referenced this pull request Nov 25, 2026
…view

`set_targets` skipped a target with no recorded view or no host texture
(`continue`), so every later target moved down a slot: a draw writing
`SV_Target1` wrote it into the texture bound as target 1 only if target 0
existed on the host. On NVIDIA, `main` already has such a target: a
2560x1440 B4G4R4A4_UNORM render target the host refuses gets no host
texture (Marvisak#1754, Marvisak#1758, Marvisak#1781), so the targets after it get the wrong
outputs. The title's typed null views (no resource) took the same path
(Marvisak#450).

Each of those slots now gets a null view: no recorded view, no host
texture, a typed null view, or a copy made without the render-target use.
The null view takes the title's view format where the host renders to it
(`renders_format`, `D3D12_FORMAT_SUPPORT1_RENDER_TARGET`, asked once per
format), so it matches the pipeline's target formats; else
R8G8B8A8_UNORM.

Test `a_target_that_cannot_be_bound_keeps_the_others_in_their_slots`
draws SV_Target0 red and SV_Target1 green with slot 0 unbindable (no view;
a typed null view) and reads the slot-1 texture back: green. On `main`'s
`set_targets` it reads red in both cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AgneyaK

AgneyaK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Heads-up on overlap: #1613 (updated today) now also keeps a skipped render-target slot with a null view. It covers this PR's typed null view (including one with no description, which this PR still skips) and targets with no recorded view or no host texture. The last is the NVIDIA case on main, where a refused 2560x1440 target shifts the later ones. Its test checks both the no-view and the typed-null-view case against main.

Your test pins the PSO's slot 0 to UNKNOWN, which is a useful extra case. Happy to fold anything from here into #1613, or the other way round, whichever the maintainer prefers.

AI use: Claude Code (Claude Opus 5.5) wrote this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants