Shaders: test that an image read as float and used by an atomic is annotated twice #226
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!226
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/226/head"
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?
@gingertonik on GitHub · 2026-11-24 01:37 UTC · original
gingertonik:test/image-atomic-annotation→main· +107 −2 · 2 files · 2 commits · closed without mergingStacked on #177 (its commit
e55eb69is the first commit here). This adds only the test that PR was noted to lack; once #177 merges, the diff is the test alone.What
A synthetic compute program in
emit::lower::tests, in the style of the existing ones: it loads a 2D image UAV from a descriptor table as four float channels (image_load) and then runsimage_atomic_uminon the same image in the same block. The test asserts that the image is annotated twice:(0x1002, 0x409)for the load and(0x1002, 0x105)for the atomic.To let the test read the annotations, test builds record each annotation's two property words in
Shaderand hand them out throughLowered(#[cfg(test)]fields; nothing changes in a normal build).Why
#177 fixes the heap-handle cache handing an atomic the float handle of an earlier load. The expected values come from DXIL's resource properties, not from the code under test: word 0 is the resource kind (Texture2D = 2) with the UAV bit (0x1000); word 1 carries the component type in its low byte (
U32= 5,F32= 9 inDxilConstants.h'sComponentType) and the component count above it. D3D12 allows the Interlocked operations on integer UAVs only, so the atomic's annotation has to be the one-u32form.Tested
Linux x86_64, pinned toolchain, from the repository root:
d2a4bae(without #177) the test fails:the atomic's annotation: [(d, ffffffff), (1002, 409)]. The load's annotation is present and the atomic's is missing.e55eb69it passes.cargo test -p victory-shader: 57 passed, 0 failed.cargo fmt --all -- --check: no differences invictory-shader.cargo clippy -p victory-shader --tests: only the existingconstant_colordead-code warning on Linux.cargo xtask policy: 151 files ok. Windows MSVC release cross-build (xwin SDK,lld-link): clean.Synthetic words only; no game data.
AI-assisted (Hermes).
@jeremygold02 on GitHub · 2026-11-24 05:24 UTC · original
Thanks @gingertonik for adding a focused regression case for the two resource annotations emitted from one image.
I tested commit
6e01ea031553e1bd19b37ffae5cc2facaa18920bwith:The targeted test passed (1 passed, 0 failed; 69 filtered).
an_image_read_as_float_and_by_an_atomic_is_annotated_twicelowers a synthetic compute shader that loads four float channels from a 2D UAV and then performs an unsigned atomic minimum. It asserts both annotations are emitted: the four-component F32 resource for the load and a separate one-component U32 resource for the atomic.This validates shader IR lowering and annotation generation; it does not compile or execute the shader on a GPU.
@Marvisak on GitHub · 2026-11-25 00:00 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #177.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed