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

Closed
bartikele wants to merge 1 commit from upstream-pr/1325 into main
bartikele commented 2026-11-24 17:26:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by bartikele on 2026-11-24T17:26:21Z.


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
<!-- greyfinch-sync:Marvisak/VIctory:issue:6587576839 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1325). Originally posted by [bartikele](https://github.com/bartikele) on 2026-11-24T17:26:21Z. --- 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`
upstream-sync closed this pull request 2026-11-24 18:04:46 +00:00
shortselow-byte commented 2026-11-24 18:06:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by shortselow-byte on 2026-11-24T17:54:43Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139882729 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1325#issuecomment-7139882729). Originally posted by [shortselow-byte](https://github.com/shortselow-byte) on 2026-11-24T17:54:43Z. --- 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.
bartikele commented 2026-11-24 18:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by bartikele on 2026-11-24T18:02:27Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140069696 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1325#issuecomment-7140069696). Originally posted by [bartikele](https://github.com/bartikele) on 2026-11-24T18:02:27Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1325
No description provided.