victory-shader: infer 4-dword buffer views from UsedResource in descriptor_data #1325

Closed
github-bot wants to merge 1 commit from gh-pr/1325/head into gh-pr/1325/base
Owner

@⁠bartikele on GitHub · 2026-11-24 17:26 UTC · original
bartikele:shader-descriptor-only-as-data → main · +89 −38 · 1 files · 1 commits · closed without merging

In Lower::descriptor_data, when use_at is None (no Role::Resource descriptor in self.x.res.descriptors references the s_load_dword* site, e.g. a shader that only calls GetDimensions on a buffer without issuing buffer_load/s_buffer_load), fall back to self.used_kind(&Source::Loaded { load: site, first: 0 }):

  • If used.dwords == 4 and used.kind is Srv or Uav, infer the buffer view properties ((12 | u, used.stride) for 4-byte-aligned strides >= 4, else (11 | u, 0)) and emit getDimensions for word 2.
  • Still rejects ResourceType::Cbv with a constant buffer's descriptor read as data.

Adds unit test emit::lower::tests::buffer_descriptor_size_read_without_buffer_op_lowers.

Tested with:

  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings
  • cargo test -p victory-shader --locked
  • cargo xtask policy
**@⁠bartikele** on GitHub · 2026-11-24 17:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1325) `bartikele:shader-descriptor-only-as-data` → `main` · +89 −38 · 1 files · 1 commits · closed without merging In `Lower::descriptor_data`, when `use_at` is `None` (no `Role::Resource` descriptor in `self.x.res.descriptors` references the `s_load_dword*` site, e.g. a shader that only calls `GetDimensions` on a buffer without issuing `buffer_load`/`s_buffer_load`), fall back to `self.used_kind(&Source::Loaded { load: site, first: 0 })`: - If `used.dwords == 4` and `used.kind` is `Srv` or `Uav`, infer the buffer view properties (`(12 | u, used.stride)` for 4-byte-aligned strides >= 4, else `(11 | u, 0)`) and emit `getDimensions` for word 2. - Still rejects `ResourceType::Cbv` with `a constant buffer's descriptor read as data`. Adds unit test `emit::lower::tests::buffer_descriptor_size_read_without_buffer_op_lowers`. Tested with: - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings` - `cargo test -p victory-shader --locked` - `cargo xtask policy`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:27:37 +00:00
github-bot closed this pull request 2026-11-26 04:27:37 +00:00
Author
Owner

@⁠shortselow-byte on GitHub · 2026-11-24 17:54 UTC · original

For triage: this is the third open PR changing the same branch of descriptor_data (the load with no resource use, use_at == None, refused as "a descriptor read only as data"):

  • #1067 takes the kind from the table's range (and an eight-dword heap entry as a 2D image);
  • #1130 takes it from another load of the same entry that is used as a resource;
  • this one infers a buffer view from UsedResource when it has four dwords.

git merge-tree against the current heads: this PR conflicts in emit/lower.rs with both #1067 (6d30fd7) and #1130 (98f073d), which also conflict with each other. A one-line combination of those two is in the comments on #1067 and #1130; this PR's four-dword buffer case could be a third fallback in the same match, rather than a third rewrite of it.

**@⁠shortselow-byte** on GitHub · 2026-11-24 17:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/1325#issuecomment-7139882729) For triage: this is the third open PR changing the same branch of `descriptor_data` (the load with no resource use, `use_at == None`, refused as "a descriptor read only as data"): - #1067 takes the kind from the table's range (and an eight-dword heap entry as a 2D image); - #1130 takes it from another load of the same entry that is used as a resource; - this one infers a buffer view from `UsedResource` when it has four dwords. `git merge-tree` against the current heads: this PR conflicts in `emit/lower.rs` with both #1067 (`6d30fd7`) and #1130 (`98f073d`), which also conflict with each other. A one-line combination of those two is in the comments on #1067 and #1130; this PR's four-dword buffer case could be a third fallback in the same `match`, rather than a third rewrite of it.
Author
Owner

@⁠bartikele on GitHub · 2026-11-24 18:02 UTC · original

Closing as subsumed by #1067 — #1067 already handles the 4-dword buffer UsedResource fallback in descriptor_data (alongside 8-dword images and a full GPU waterfall test), so keeping this open would just create unnecessary merge conflicts.

**@⁠bartikele** on GitHub · 2026-11-24 18:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/1325#issuecomment-7140069696) Closing as subsumed by #1067 — #1067 already handles the 4-dword buffer `UsedResource` fallback in `descriptor_data` (alongside 8-dword images and a full GPU waterfall test), so keeping this open would just create unnecessary merge conflicts.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1325
No description provided.