Fixes incorrect PipelineCompiler::compile_pipeline() step_mode (#2126)

There's what might be considered a proper bug in `PipelineCompiler::compile_pipeline()`, where it overwrites the `step_mode` for the passed in `VertexBufferLayout` with `InputStepMode::Vertex`. Due to this some ugly workarounds are needed to do any kind of instancing.

In the somewhat longer term, `PipelineCompiler::compile_pipeline()` should probably also handle a `Vec<VertexBufferLayout>`, but that would be a (slightly) larger PR, rather than a bugfix. And I'd love to have this fix in sooner than we can deal with a bigger PR.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This commit is contained in:
Jonas Matser 2021-05-07 00:28:35 +00:00
parent 1690a9db97
commit bfd15d2d4b

View file

@ -1,6 +1,6 @@
use super::{state_descriptors::PrimitiveTopology, IndexFormat, PipelineDescriptor};
use crate::{
pipeline::{BindType, InputStepMode, VertexBufferLayout},
pipeline::{BindType, VertexBufferLayout},
renderer::RenderResourceContext,
shader::{Shader, ShaderError},
};
@ -205,7 +205,7 @@ impl PipelineCompiler {
// the vertex buffer descriptor that will be used for this pipeline
let mut compiled_vertex_buffer_descriptor = VertexBufferLayout {
step_mode: InputStepMode::Vertex,
step_mode: mesh_vertex_buffer_layout.step_mode,
stride: mesh_vertex_buffer_layout.stride,
..Default::default()
};