Skip to content

Commit

Permalink
Unset existing vertex attributes on gles set_render_pipeline (#2131)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlunch authored Oct 30, 2021
1 parent 9887169 commit 5f1b3e5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions wgpu-hal/src/gles/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,6 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
unsafe fn set_render_pipeline(&mut self, pipeline: &super::RenderPipeline) {
self.state.topology = conv::map_primitive_topology(pipeline.primitive.topology);

for index in self.state.vertex_attributes.len()..pipeline.vertex_attributes.len() {
self.cmd_buffer
.commands
.push(C::UnsetVertexAttribute(index as u32));
}

if self
.private_caps
.contains(super::PrivateCapabilities::VERTEX_BUFFER_LAYOUT)
Expand All @@ -626,6 +620,13 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
});
}
} else {
for index in 0..self.state.vertex_attributes.len() {
self.cmd_buffer
.commands
.push(C::UnsetVertexAttribute(index as u32));
}
self.state.vertex_attributes.clear();

self.state.dirty_vbuf_mask = 0;
// copy vertex attributes
for vat in pipeline.vertex_attributes.iter() {
Expand Down

0 comments on commit 5f1b3e5

Please sign in to comment.