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
…2769)

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 authored Jun 15, 2022
1 parent 5c8d4a8 commit 915be10
Showing 1 changed file with 182 additions and 168 deletions.
Loading

0 comments on commit 915be10

Please sign in to comment.