mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Validate strip_index_format (#2177)
The spec mandates that stripIndexFormat is set even when drawIndexed is not used. (https://www.w3.org/TR/webgpu/#primitive-state) There is some recent discussion about this though: https://github.com/gpuweb/gpuweb/issues/2199
This commit is contained in:
committed by
GitHub
parent
f25a45f4e2
commit
08b9c46ec4
@@ -2211,6 +2211,14 @@ impl<A: HalApi> Device<A> {
|
||||
);
|
||||
}
|
||||
|
||||
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)?;
|
||||
}
|
||||
|
||||
@@ -309,6 +309,8 @@ pub enum CreateRenderPipelineError {
|
||||
strip_index_format: Option<wgt::IndexFormat>,
|
||||
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)]
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user