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

Closed
romainhedouin wants to merge 1 commit from upstream-pr/31 into main
romainhedouin commented 2026-11-25 12:32:45 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by romainhedouin on 2026-11-25T12:32:45Z.


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

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5491387602 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/31). Originally posted by [romainhedouin](https://github.com/romainhedouin) on 2026-11-25T12:32:45Z. --- 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)
romainhedouin commented 2026-11-26 22:24:25 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by romainhedouin on 2026-11-26T22:24:25Z.


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).

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7204648746 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/31#issuecomment-7204648746). Originally posted by [romainhedouin](https://github.com/romainhedouin) on 2026-11-26T22:24:25Z. --- 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

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
Belobug/VIctory-Belobug-AMD!31
No description provided.