Skip to content

Commit b739e52

Browse files
Handle WGPUVertexStepMode_Undefined
stepMode defaults to "vertex" when attributes is not empty.
1 parent d231ff7 commit b739e52

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,8 +2156,15 @@ pub unsafe extern "C" fn wgpuDeviceCreateRenderPipeline(
21562156
.map(|buffer| wgc::pipeline::VertexBufferLayout {
21572157
array_stride: buffer.arrayStride,
21582158
step_mode: match buffer.stepMode {
2159+
native::WGPUVertexStepMode_Undefined if buffer.attributeCount > 0 => {
2160+
wgt::VertexStepMode::Vertex
2161+
}
21592162
native::WGPUVertexStepMode_Vertex => wgt::VertexStepMode::Vertex,
21602163
native::WGPUVertexStepMode_Instance => wgt::VertexStepMode::Instance,
2164+
native::WGPUVertexStepMode_VertexBufferNotUsed
2165+
| native::WGPUVertexStepMode_Undefined => {
2166+
panic!("Unused vertex buffers are currently not supported in vertex buffer layout. Instead, use a vertex buffer with no attributes and a defined vertex step mode.")
2167+
}
21612168
_ => panic!("invalid vertex step mode for vertex buffer layout"),
21622169
},
21632170
attributes: Cow::Owned(

0 commit comments

Comments
 (0)