Skip to content

Commit

Permalink
Make vertex buffers optional (#1485)
Browse files Browse the repository at this point in the history
For some cases, like driving a full screen fragment shader, it is sometimes convenient to not have to create and upload a mesh because the necessary vertices are simple to synthesize in the vertex shader. Bevy's existing pipeline compiler assumes that there will always be a vertex buffer. This PR changes that such that vertex buffer descriptor is only added to the pipeline layout if there are vertex attributes in the shader.
  • Loading branch information
alec-deason committed Feb 22, 2021
1 parent 2e3af84 commit 97a78c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/bevy_render/src/pipeline/pipeline_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ impl PipelineCompiler {

//TODO: add other buffers (like instancing) here
let mut vertex_buffer_descriptors = Vec::<VertexBufferLayout>::default();
vertex_buffer_descriptors.push(compiled_vertex_buffer_descriptor);
if !pipeline_layout.vertex_buffer_descriptors.is_empty() {
vertex_buffer_descriptors.push(compiled_vertex_buffer_descriptor);
}

pipeline_layout.vertex_buffer_descriptors = vertex_buffer_descriptors;
specialized_descriptor.multisample.count = pipeline_specialization.sample_count;
Expand Down

0 comments on commit 97a78c3

Please sign in to comment.