GPU: drop a texture's clear value the host cannot take #3063
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3065"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-26T05:59:47Z.
What
victory-gpu'shost_descmasks a title texture's flags to the PC set (PC_FLAGS), butmake_textureforwarded the title's optimized clear value toCreateCommittedResource/CreateCommittedResource3unconditionally. PC D3D12 refuses a clear value when the flags name neitherALLOW_RENDER_TARGETnorALLOW_DEPTH_STENCIL— verified on this machine:E_INVALIDARG(0x80070057) with flags 0, success withALLOW_RENDER_TARGET— so such a texture got no host copy at all (a "no host texture" warning, then every use of it failed).Drop the clear value when the masked flags have neither use, keeping it for render targets and depth buffers as before.
Refs #1242 (
VIC-BT-022).Testing
resource::tests::a_clear_value_on_a_plain_texture_does_not_break_creation: a 64x64 R8G8B8A8_UNORM texture with flags 0 and a clear value. It fails on main (creation refused) and passes with the change. Skips cleanly when the test host has no D3D12 device.cargo test --locked -p victory-gpu --lib: 229 passed; the 3 failures (descriptor::host::tests::dynamic_slots_are_held_until_released,draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view,memory::tests::lists_share_a_table_and_copies_keep_their_views) fail identically on unmodified main on this machine (NVIDIA).cargo clippy --locked -p victory-gpu --lib --tests -- -D warnings: clean.cargo xtask policy: ok.Limitations
Verified on one Windows host; the rule the fix relies on is the D3D12 runtime's own parameter validation, not a driver quirk.
cargo fmtshows pre-existing differences with this toolchain version on untouched parts of the crate; the changed lines follow the file's style.No game data. AI-assisted (Kimi).
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:07:31Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):clear_valueinmake_texturewithd.flags & (USES & !UNORDERED) != 0cleanly drops console-supplied clear values on textures that are neither render targets nor depth-stencil buffers, avoiding PC D3D12E_INVALIDARGcreation failures.cargo test -p victory-gpu resource::tests -- --test-threads=1(RTX 5090 & WARP): 19 passed, 0 failed on both (includinga_clear_value_on_a_plain_texture_does_not_break_creation).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T06:09:13Z.
Review: APPROVED
Reviewed head
34761782line-by-line (CI green):USES = 0x7(render target0x1, depth0x2, unordered0x4) andUNORDERED = 0x4, sod.flags & (USES & !UNORDERED) != 0checks strictlyALLOW_RENDER_TARGET | ALLOW_DEPTH_STENCIL(0x3) and does not matchDENY_SHADER_RESOURCE(0x8) or UAV-only textures.clear_valuewhen neither RTV nor DSV is set avoids D3D12CreateCommittedResourcereturningE_INVALIDARG, anda_clear_value_on_a_plain_texture_does_not_break_creationdirectly verifies the fix throughmake_texture.Clean and surgical.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T06:33:24Z.
Review: APPROVED
Verified: USES&!UNORDERED = RT|DS (0x3) — D3D12 only accepts an optimized clear value on render-target/depth resources, so a clear value on a plain/UAV texture now gets dropped instead of failing CreateCommittedResource with E_INVALIDARG. Console semantics (clear allowed anywhere) preserved where the host can take it. Host test proves creation succeeds.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:18:02Z.
Automated triage for the maintainers.
Merge candidate.
make_texture(crates/victory-gpu/src/resource.rs) passed the title's optimized clear value to resource creation even when the host flags (masked toPC_FLAGSinhost_desc) allow neither render-target nor depth-stencil use. PC D3D12 refuses that withE_INVALIDARG, so the texture got no host copy. The PR keeps the clear value only whend.flags & (USES & !UNORDERED)(render target or depth) is set. Thedpassed in is the host description, with uses merged from other title textures at the same memory, so render targets and depth buffers are unaffected. A side effect: such textures now also qualify for the placed-resource path (clear_value.is_none()), which is fine. The regression test creates a 64x64 RGBA8 texture with flags 0 and a clear value.CI:
checkpassing.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.