Skip to content

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

Closed
bartikele wants to merge 1 commit into
Marvisak:mainfrom
bartikele:shader-descriptor-only-as-data
Closed

bartikele wants to merge 1 commit into
Marvisak:mainfrom
bartikele:shader-descriptor-only-as-data

Conversation

@bartikele

Copy link
Copy Markdown
Contributor

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

@shortselow-byte

Copy link
Copy Markdown

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"):

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

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants