Read a host texture's flags once instead of on every use #31

Closed
github-bot wants to merge 1 commit from github-bot/gh-31 into main AGit
Owner

@⁠romainhedouin on GitHub · 2026-11-25 12:32 UTC · original
romainhedouin:perf/transition-flags → main · +30 −15 · 6 files · 1 commits · closed without merging

For each texture a draw uses, the code asked D3D12 for the texture's description (GetDesc, a COM call) just to read its flags: once to pick a legal state and once more to know whether the title fills it. It also copied a reference-counted pointer each time. The flags never change after creation, so they are now read once when the host texture is made and kept with it.

Per texture used by a draw Before After
GetDesc calls, sampled texture 2 0
GetDesc calls, render target or depth 1 0
Arc clone + drop (texture already in the list) 1 0

Counts from the code, not timings. Type-checked for Windows (cargo clippy --target x86_64-pc-windows-msvc, with and without --all-features, no new warnings); not run.

🤖 Generated with Claude Code

**@⁠romainhedouin** on GitHub · 2026-11-25 12:32 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/31) `romainhedouin:perf/transition-flags` → `main` · +30 −15 · 6 files · 1 commits · closed without merging For each texture a draw uses, the code asked D3D12 for the texture's description (`GetDesc`, a COM call) just to read its flags: once to pick a legal state and once more to know whether the title fills it. It also copied a reference-counted pointer each time. The flags never change after creation, so they are now read once when the host texture is made and kept with it. | Per texture used by a draw | Before | After | |---|---|---| | `GetDesc` calls, sampled texture | 2 | 0 | | `GetDesc` calls, render target or depth | 1 | 0 | | `Arc` clone + drop (texture already in the list) | 1 | 0 | Counts from the code, not timings. Type-checked for Windows (`cargo clippy --target x86_64-pc-windows-msvc`, with and without `--all-features`, no new warnings); not run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:33:54 +00:00
github-bot closed this pull request 2026-11-27 01:00:00 +00:00
Author
Owner

@⁠romainhedouin on GitHub · 2026-11-26 22:24 UTC · original

Closing: a-publier already reads a host texture's flags once, at creation (HostTexture.flags, resource.rs:1193 and :2377), and uses the cache in transition and the per-draw check (host.rs:6653, draw.rs:4420).

**@⁠romainhedouin** on GitHub · 2026-11-26 22:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/31#issuecomment-7204648746) Closing: `a-publier` already reads a host texture's flags once, at creation (`HostTexture.flags`, resource.rs:1193 and :2377), and uses the cache in `transition` and the per-draw check (host.rs:6653, draw.rs:4420).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.