[pr-fix][rendering] darner-gpu: the read-back footprint cache tells a 3D texture from a 2D array #426
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:texback-key-dimension"
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?
Contributor role (optional)
What it changes
The problem on main:
texback::footprints_ofcaches the copyable footprints of a texture under a key that leaves the dimension out:(
crates/darner-gpu/src/texback.rs:402, built at:416). The cached value depends on the dimension:DepthOrArraySizeis a depth for aTEXTURE3Dand an array size for aTEXTURE2D, so the subresource count at:421-425(one per mip versus one per mip per layer) differs for the same key. A 64x64x64 volume and a 64-layer 64x64 array of the same format and mip count therefore shared oneArc<Footprints>and one read-back buffer size. Both users of it trust it:record_texture(:511-526) recordssubresources.len()copies withSubresourceIndex: i, which the other shape does not have, andland(:633-651) pairs footprintiwith(i % mips, i / mips)of a layout whoseslicesis 1 for a 3D texture, soLayout::tilereturnsInvalidand nothing lands — the title keeps reading whatever the read-back was meant to replace.This change puts the dimension and the sample count into the key through a pure
footprint_key()(desc.Dimension.0 as u64, Width, Height, DepthOrArraySize, MipLevels, Format.0, SampleDesc.Count); the sample count is passed toGetCopyableFootprints, so it belongs in the key too. The subresource-count expression moves intosubresource_count()so it can be asserted without a device.FootprintKeyis private, so its shape is free to change.How it was tested
c7b977a(one commit onf3840d7).cargo test --locked -p darner-gpu --lib— 1757 passed, 0 failed, 81 ignored. (One earlier full-suite run on this tree failedwatch::tests::ask_once_by_res_splits_reservations_without_refusals, one of the two pre-existing parallel-suite flakes: three runs of the unmodifiedf3840d7tree in the same worktree produced the same class of flake, and bothwatchtests pass when run alone.)texback::tests::the_footprint_cache_tells_apart_textures_that_differ_in_dimension: builds the 2D-array and 3DD3D12_RESOURCE_DESCvalues, assertssubresource_countis 64 and 1, asserts the two keys differ, and that raisingSampleDesc.Countchanges the key. No adapter: the key is pure.cargo clippy --locked -p darner-gpu --all-targets -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --workspace --locked: not green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request:darner-gpustands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependent flakes of #150;darner-shaderfailsemit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes.footprints_ofitself still needs a device and stays untested; the test pins the key and the subresource count, not a realGetCopyableFootprintscall, and does not exercise the out-of-range copy/landpath downstream.D3D12_TEXTURE_LAYOUTis still not in the key; no caller here creates a 64 KiB-swizzled texture through this cache, so the change was not widened.Checklist
main.main.docs/asset-policy.md. (cargo xtask policy: 555 files ok.)Checked for overlap
crates/darner-gpu/src/texback.rstoo — it narrowsland's lock scope and says nothing aboutfootprints_of,FootprintKeyor the read-back buffer size, so a conflict is possible inlandonly. Issue #287 asks for a read-back hook, not this cache. No open or closed issue mentions the footprint key.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.