Skip to content

Commit

Permalink
Don't dirty the vertex buffer for stride/rate changes on bundles. (#2744
Browse files Browse the repository at this point in the history
)

`wgpu_core::command::bundle::State::set_pipeline` marks a vertex
buffer slot dirty if the pipeline's stride or step mode for that
vertex buffer slot differs from what had been previously established.
The effect of marking the slot dirty is to ensure that a new
`SetVertexBuffer` command is inserted before the next draw command
that uses that vertex buffer. However, this is unnecessary:
`wgpu_hal::CommandEncoder::set_vertex_buffer` does not need to be
called simply because the stride or rate has changed.
  • Loading branch information
jimblandy authored Jun 7, 2022
1 parent be625f9 commit d26c04c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions wgpu-core/src/command/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,11 +1217,8 @@ impl<A: HalApi> State<A> {
self.index.pipeline_format = index_format;

for (vs, &(stride, step_mode)) in self.vertex.iter_mut().zip(vertex_strides) {
if vs.stride != stride || vs.rate != step_mode {
vs.stride = stride;
vs.rate = step_mode;
vs.is_dirty = true;
}
vs.stride = stride;
vs.rate = step_mode;
}

let push_constants_changed = self
Expand Down

0 comments on commit d26c04c

Please sign in to comment.