Skip to content

Commit 97a78c3

Browse files
committed
Make vertex buffers optional (#1485)
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.
1 parent 2e3af84 commit 97a78c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/bevy_render/src/pipeline/pipeline_compiler.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ impl PipelineCompiler {
235235

236236
//TODO: add other buffers (like instancing) here
237237
let mut vertex_buffer_descriptors = Vec::<VertexBufferLayout>::default();
238-
vertex_buffer_descriptors.push(compiled_vertex_buffer_descriptor);
238+
if !pipeline_layout.vertex_buffer_descriptors.is_empty() {
239+
vertex_buffer_descriptors.push(compiled_vertex_buffer_descriptor);
240+
}
239241

240242
pipeline_layout.vertex_buffer_descriptors = vertex_buffer_descriptors;
241243
specialized_descriptor.multisample.count = pipeline_specialization.sample_count;

0 commit comments

Comments
 (0)