Skip to content

GPU: log the missing D3D12 1.7 (no castable texture formats) - #2005

Open
Calvix2k wants to merge 4 commits into
Marvisak:mainfrom
Calvix2k:codex/gpu-device10-1999
Open

Calvix2k wants to merge 4 commits into
Marvisak:mainfrom
Calvix2k:codex/gpu-device10-1999

Conversation

@Calvix2k

@Calvix2k Calvix2k commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Only the log; the placed-view test's expectation lives in #2251, and the cast device is now asked once per texture.

What

resource::make_texture makes a texture with its formats (castable) through CreateCommittedResource3, which needs ID3D12Device10 (D3D12 1.7). On a Windows 10 system runtime that interface is absent; the existing fallback then clears the castable list — correctly, since the old API cannot pass one — but silently, so every view in another format gets its own HostTexture and a copy at the read, and nothing in the log says why.

  • resource.rs: ask for ID3D12Device10 once per texture (one QueryInterface serving both the log and the creation, which used to ask twice) and, when it is absent while a castable list was wanted, log once at info.
  • No other change: the fallback, the address of the blocking list and the HostTexture behaviour are as in main.

Verification

  • Windows 10 19045 / RX 7800 XT: cargo test -p victory-gpu --features diagnostics --lib — the same single failure as unmodified main (draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view, the missing ID3D12Device10; Tests: heap-capped and barrier-less hosts run the GPU tests #2251 derives its expectation). cargo clippy -p victory-gpu --all-targets -- -D warnings clean; cargo xtask policy clean.
  • Where ID3D12Device10 exists the log is not reached, and the creation path is unchanged.

No game data.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Logs missing D3D12 1.7 and skips the sharing test there — capability gating for older WARP/driver combos; good hardening.

@AlanQiang0418

Copy link
Copy Markdown
Contributor

Could we keep both GPU readbacks running on hosts without Device10, and use the writer texture's accepted format list to decide whether round 0 should share? #1765 already has that assertion. The early return here also skips the BC1 round, which expects a copy on every host.

I tested cdc5986 on an RTX 5080 and WARP. Both passed normally. With Device10 still available, I simulated CreateCommittedResource3 returning E_INVALIDARG for the R32_UINT allocation only. Both runs then failed at round 0: one host texture (actual false, expected true). Dropping the early return and using let shared = shared && !a.castable.is_empty(); made both pass with the same injected failure, including the copy and texel assertions. The Intel report on #1765 describes a real adapter that refuses the list.

The log can also use the error from the existing interface query. That saves a second QueryInterface on each eligible texture and includes the HRESULT. I tested a one-file implementation with tracing enabled on both adapters. Four injected E_NOINTERFACE results in one process produced one INFO line with 0x80004002; normal runs produced zero.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. This is a recommendation to look, not an approval. Re-reviewed at b674985, which merges cleanly into main.

resource::make_texture (crates/victory-gpu/src/resource.rs) now asks for ID3D12Device10 once per texture, only when there are castable formats, and keeps the QueryInterface error. The placed path (CreatePlacedResource2), the log and the committed path (CreateCommittedResource3) all use that one result. main can ask twice. The one-time info line now carries the HRESULT. Control flow otherwise matches main: the committed path runs exactly when main's !castable_formats.is_empty() && cast::<ID3D12Device10>().is_ok() would. The test expectations stay with #2251.

The earlier small point still stands, and it does not block: a placed texture made without ID3D12Device10 clears castable_formats before the log check, so the line first appears with a committed texture. Checking device10.is_none() right after the query would log on the first texture.

On your reply: confirmed. Dropping the test change leaves #2251 to own the expectations, and using the query's own error saves the second QueryInterface. CI: check passing on this head.


Generated by Claude Code

@Calvix2k

Copy link
Copy Markdown
Contributor Author

Narrowed after seeing #2251 (@kotekompotek), which derives the placed-view test's expectation from the host instead of skipping it, and does the same for the paired-copy and heap-cap tests.

What is left here is only the missing log: when a castable format list would be used and the device has no ID3D12Device10 (D3D12 1.7 — a Windows 10 system runtime), say so once, because otherwise the fallback (every view in another format gets its own host texture and a copy) is invisible. Host::device10() is the check.

The placed-view test change from this branch is dropped in 83ee34f; #2251 owns the test expectations. Nothing conflicts between the two now.

@Calvix2k Calvix2k changed the title GPU: log the missing D3D12 1.7 and skip the sharing test there GPU: log the missing D3D12 1.7 (no castable texture formats) Nov 25, 2026
resource::make_texture makes a texture with its castable formats through
CreateCommittedResource3, which needs ID3D12Device10 (D3D12 1.7). On a
Windows 10 system runtime the interface is missing (E_NOINTERFACE), the
castable list is cleared silently, and every view in another format gets
its own host texture and a copy at the read. Say so once in the log:
without it a tester cannot tell why a window shows two textures per
memory (and why the placed-view test fails).

Host::device10() exposes the check, and the placed-view sharing test
skips with the reason when it is false, like the other capability skips:
what it checks cannot hold without the castable list.

Closes Marvisak#1999.
The test's expectation is host-derived in Marvisak#2251 (which covers the
memory paired-copy and heap-cap tests as well); this branch keeps only the
log for the missing D3D12 1.7 and `Host::device10`.
The log check and the castable-format creation each cast the device. Ask
once per texture and use the answer for both, which also drops the
`Host::device10` helper.
@Calvix2k
Calvix2k force-pushed the codex/gpu-device10-1999 branch from a4f8f45 to ca43982 Compare November 25, 2026 18:33
@Calvix2k

Copy link
Copy Markdown
Contributor Author

Rebased onto origin/main 13f91ca; the branch is mergeable again.

Conflicts were in host.rs (device10 next to main's new copies_in_video_memory) and resource.rs (main's crate::placement path). Resolution:

  • Host::device10 is gone, as the last commit intended: resource::make_texture asks ID3D12Device10 once per texture into a device10 local and uses it for the placement, the log and the committed creation. The placed path now reuses that query instead of asking again.
  • The log fires when a castable list was wanted and device10 is none, before the plain fallback.
  • The placed-view test stays as main has it (no skip), per 3e80d2c / Tests: heap-capped and barrier-less hosts run the GPU tests #2251.

On Windows 10 19045 without the Agility runtime (no ID3D12Device10) + RX 7800 XT: cargo clippy -p victory-gpu --all-targets clean, cargo test -p victory-gpu --lib 194 passed, 1 failed, 1 ignored; the one failure is a_texture_written_in_one_format_reads_in_another_through_a_placed_view ("a placed texture"), the expectation #2251 owns, and it fails the same way on main here. The new info log appears once.

AI-assisted (DeepSeek V4.1).

The one ID3D12Device10 query per texture now keeps its Result, so the
info log can name the HRESULT without asking a second time. Requested by
@AlanQiang0418 on Marvisak#2005.
@Calvix2k

Copy link
Copy Markdown
Contributor Author

Both points from @AlanQiang0418 are handled, one by the drop and one by b674985.

1. The early return and the BC1 round: gone. The test change was dropped in 83ee34f; #2251 owns the placed-view, paired-copy and heap-cap expectations. The diff here now touches only resource::make_texture: one ID3D12Device10 query per texture, plus one log. No test edits, so round 0/round 1 keep expecting a copy on every host, and the writer texture's accepted format list is not consulted here at all — that decision stays where #1765/#2251 put it.

2. The log uses the query's own error, not a second call. Noticed and adopted, thank you: the Result is kept instead of discarded with .ok(), so the message carries the HRESULT.

let mut device10_error = None;
let device10 = match (!castable_formats.is_empty())
    .then(|| host.device.cast::<ID3D12Device10>())
    .transpose()
{
    Ok(device) => device,
    Err(error) => { device10_error = Some(error); None }
};

and the one-time message matches on it:

ONCE.call_once(|| match &device10_error {
    Some(error) => tracing::info!(error = %error, "..."),
    None => tracing::info!("..."),
});

So an eligible texture costs exactly one QueryInterface whether or not ID3D12Device10 is there, and the line says why it is missing.

Verification (Windows 10 22H2 19045, RX 7800 XT, driver 32.0.32029.2010, origin/main 13f91ca rebased):

  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo test --locked -p victory-gpu --lib: 194 passed, 1 failed, 1 ignored. The one failure is draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view ("round 0: a placed texture"), the expectation Tests: heap-capped and barrier-less hosts run the GPU tests #2251 owns; it fails the same way on main here.

I could not reproduce your injected E_INVALIDARG/E_NOINTERFACE setup, so the HRESULT in the line is the one your dd1825e describes rather than a second measurement of it.

AI-assisted (DeepSeek V4.1), no game data.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
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.

4 participants