diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index d153515357..c67e925010 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -2211,6 +2211,14 @@ impl Device { ); } + if desc.primitive.strip_index_format.is_none() && desc.primitive.topology.is_strip() { + return Err( + pipeline::CreateRenderPipelineError::NoStripIndexFormatForStripTopology { + topology: desc.primitive.topology, + }, + ); + } + if desc.primitive.unclipped_depth { self.require_features(wgt::Features::DEPTH_CLIP_CONTROL)?; } diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 2436f8cf25..bb8df5e6d0 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -309,6 +309,8 @@ pub enum CreateRenderPipelineError { strip_index_format: Option, topology: wgt::PrimitiveTopology, }, + #[error("strip index format is None while using the strip topology {topology:?}")] + NoStripIndexFormatForStripTopology { topology: wgt::PrimitiveTopology }, #[error("Conservative Rasterization is only supported for wgt::PolygonMode::Fill")] ConservativeRasterizationNonFillPolygonMode, #[error(transparent)] diff --git a/wgpu/examples/bunnymark/main.rs b/wgpu/examples/bunnymark/main.rs index f8c1c2b879..b99cc7fdad 100644 --- a/wgpu/examples/bunnymark/main.rs +++ b/wgpu/examples/bunnymark/main.rs @@ -125,6 +125,7 @@ impl framework::Example for Example { }), primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleStrip, + strip_index_format: Some(wgpu::IndexFormat::Uint16), ..wgpu::PrimitiveState::default() }, depth_stencil: None, diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index f53bbc0ea4..82fd40e62b 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -99,6 +99,7 @@ impl Example { }), primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleStrip, + strip_index_format: Some(wgpu::IndexFormat::Uint16), ..Default::default() }, depth_stencil: None, @@ -292,6 +293,7 @@ impl framework::Example for Example { }), primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleStrip, + strip_index_format: Some(wgpu::IndexFormat::Uint16), front_face: wgpu::FrontFace::Ccw, cull_mode: Some(wgpu::Face::Back), ..Default::default()