Unset existing vertex attributes on gles set_render_pipeline (#2131)

This commit is contained in:
Inseok Lee authored and Dzmitry Malyshau committed 2021-12-01 22:40:11 -05:00
1 parent e7aeb4c218
commit 0deee81d90
1 file changed
+7 -6
+7 -6
View File
@@ -617,12 +617,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)
@@ -637,6 +631,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() {