Shaders: rebuild a cube image descriptor for code that reads its dwords #109
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!109
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/109/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?
@tedin7 on GitHub · 2026-11-24 00:36 UTC · original
tedin7:vic-descriptor-cube→main· +87 −5 · 1 files · 2 commits · closed without mergingWhat
descriptor_datanow rebuilds the GFX10 descriptor dwords of a cube view (dim 3): resource kind 5, type 11 in dword 3, depth dword 5 (six faces, no cube array), width and height fromgetDimensions.Why
an image dimension (cube or MSAA)for a cube, althoughimage_get_resinfoand cube sampling already handle cube views. MSAA is still refused.Tested
cargo test -j4 -p victory-shader cube_descriptorbefore the change: fails withUnsupported { offset: 28, what: "an image dimension (cube or MSAA)" }.cargo test -j4 -p victory-shaderafter the change: 52 passed, 0 failed (the new test included).cargo clippy -j4 -p victory-shader --tests: no new warnings (existing: dead_codeconstant_colorin emit/mod.rs, a boolean-simplification note in resource.rs).rustfmt --edition 2024 --checkon lower.rs: clean.lowers()test helper is added by the other open scalar PRs in the same tests module, so a trivial merge conflict there is possible.@DaviTostes on GitHub · 2026-11-24 01:09 UTC · original
Tested
743b1e2on Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 52 passed, 0 failed (2 test binaries).victory-gpuE0425.@tedin7 on GitHub · 2026-11-24 02:48 UTC · original
Thanks for testing, DaviTostes. A note in case it was missed: the PR does carry a test,
cube_descriptor_dwords_read_as_datainemit/lower.rs(last hunk of the diff). It loads a cube descriptor, runsimage_get_resinfoon it and branches on its depth dword (5). Onmainit fails with "an image dimension (cube or MSAA)" and it passes with the fix. It checks that the program translates, not the final dword values: those would need the GPU or a DXIL evaluator, which I did not run.@ifBars on GitHub · 2026-11-24 03:09 UTC · original
I tested the cube SRV change on Windows with the SDK DXIL validator. An observable synthetic shader reading the dimensions and type now translates. I held the raw depth/base-array word in our adaptation. A six-face host view alone does not establish that the original descriptor encodes 5 in DEPTH.
AMD's table gives cube image type 11 and describes DEPTH and BASE_ARRAY separately. RadeonSI also provides a concrete different encoding: for a single cube it sets the last layer to the first, then uses that last layer as the texture state's depth on GFX10. This does not establish the Xbox encoding either. Do you have a native cube descriptor or a field-value test that establishes 5 for the guest cases this PR handles? AMD RDNA 2 ISA, image resource definition · RadeonSI cube view setup · GFX10 descriptor packing
@tedin7 on GitHub · 2026-11-24 03:13 UTC · original
Thanks ifBars, fair point. No: I do not have a native cube descriptor, and nothing in this repo (victory-shader or victory-gpu) establishes DEPTH=5. I took 5 from the six-face host view and from how this code already treats arrays (DEPTH as count minus 1), which is an inference, not evidence. Your RadeonSI reading (last layer = first layer for a single cube on GFX10) contradicts it, and I cannot rule it out.
I pushed a follow-up commit that stops claiming it: for a cube, the translator still gives the width/height dword and the type dword (type 11, per the AMD table), but the depth dword (dword 4) is no longer produced, so a program that reads it is refused as before. The test now branches on the type dword, and asserts that reading the depth dword of a cube is still refused.
cargo test -p victory-shader: 52 passed; clippy andrustfmt --edition 2024 --checkclean, on Linux x86_64. I did not run Windows, a GPU or the DXIL validator. The cube load/store and sampling paths are not affected.@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 #317. Cube views in descriptor_data. Same change as #317, which also covers MSAA and fills the depth dword as the public driver does; neither has a title program behind it.
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