Bring immediate in line with webgpu spec#9280
Conversation
|
We should probably use a |
There was a problem hiding this comment.
I don't think this should block landing this, but:
The way this determines immediate_slots_required is not per spec. You need to look at the entry point(s) the pipeline uses, and see which specific fields of the var<immediate> type those entry points and their callees actually touch.
Getting this right will require a new bitmask field in naga::valid::FunctionInfo that gets populated probably by FunctionInfo::process_expression and process_block, and then consulted by wgpu_core.
| fn required_limits() -> wgpu::Limits { | ||
| wgpu::Limits { | ||
| max_immediate_size: 16, | ||
| max_immediate_size: 12, |
There was a problem hiding this comment.
Does this PR fix #4682 (which IIRC is the reason for this)?
cwfitzgerald
left a comment
There was a problem hiding this comment.
Thanks for this!
A few miscellaneous comments. I think unless you feel really strongly, we should do the move to naga's FunctionInfo first, as it will need to be done no matter what once we hook up the CTS, and means you won't need to churn on this code for the stuff that is going to be replaced anyway.
| texture_memory_init_actions: Vec<TextureInitTrackerAction>, | ||
| next_dynamic_offset: usize, | ||
| binder: Binder, | ||
| immediate_slots_set: u64, |
There was a problem hiding this comment.
We should document what this is and that it's a bitflags and not a count.
There was a problem hiding this comment.
suggestion(optional): Might consider putting this in a wrapper type so you can easily define helper methods on it (and added type safety)
| InvalidGroupSize { current: [u32; 3], limit: u32 }, | ||
| #[error(transparent)] | ||
| BindingSizeTooSmall(#[from] LateMinBufferBindingSizeMismatch), | ||
| #[error("Not all immediate data slots required by the pipeline have been set (required: 0x{required:016X}, set: 0x{set:016X})")] |
There was a problem hiding this comment.
This error isn't really going to be very actionable for users. Once we determine we're in the error state, we should build a vector of byte ranges that aren't specified, will be much better UX.
Connections
ticks boxes in #8556
Description
Brings immediate validation in line with webgpu spec. Bitmask of immediate slots required for a pipeline, tracks slot writing, removes auto-zeroing, and infers immediate_size for auto pipline layouts
Testing
Theres some tests on the slot bitmask algorithm and some validation tests for set_immediates behavior
Squash or Rebase?
Either, commits are clean
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.