Skip to content

Commit

Permalink
wgpu_core::command::bundle: Consolidate pipeline and vertex state.
Browse files Browse the repository at this point in the history
Refactor `wgpu_core::command::bundle::State` to more closely resemble
the internal slots of a WebGPU `GPURenderBundleEncoder`, and add
validation required by the WebGPU specification.

Use `Option` to represent state that may be left unset on the encoder:
specifically, the pipeline and vertex buffers. (Previous commits have
already addressed index buffers and bind groups.) Use `.ok_or`, etc.
for unwrapping, to ensure that encoding state errors are reported.

Consolidate state derived from the pipeline in a new `PipelineState`
struct.

Remove `wgpu_core::command::bundle::PushConstantState::is_dirty`; just
represent push constant state as a vector of `PushConstantRange`
values. It's sufficient to simply zero the push constants whenever the
vector is non-empty.

Rename `bundle::State::flush_push_constants` to `zero_push_constants`a.
This is not a "flush pending state changes" function like all the
others; it just ensures that each pipeline's push constant state is
initialized.
  • Loading branch information
jimblandy committed Jun 14, 2022
1 parent 006bbbc commit 4f010c6
Showing 1 changed file with 182 additions and 168 deletions.
Loading

0 comments on commit 4f010c6

Please sign in to comment.