validate for strip_index_format being used with non-strip topology

This commit is contained in:
Andreas Reich 2021-02-01 21:35:54 +01:00
parent aea2af588c
commit 9dd88cb338
2 changed files with 18 additions and 1 deletions

View File

@ -2004,6 +2004,18 @@ impl<B: GfxBackend> Device<B> {
}
}
if desc.primitive.strip_index_format.is_some()
&& desc.primitive.topology != wgt::PrimitiveTopology::LineStrip
&& desc.primitive.topology != wgt::PrimitiveTopology::TriangleStrip
{
return Err(
pipeline::CreateRenderPipelineError::StripIndexFormatForNonStripTopology {
strip_index_format: desc.primitive.strip_index_format,
topology: desc.primitive.topology,
},
);
}
let input_assembler = conv::map_primitive_state_to_input_assembler(&desc.primitive);
let blender = hal::pso::BlendDesc {

View File

@ -191,7 +191,7 @@ pub struct RenderPipelineDescriptor<'a> {
pub enum CreateRenderPipelineError {
#[error(transparent)]
Device(#[from] DeviceError),
#[error("pipelie layout is invalid")]
#[error("pipeline layout is invalid")]
InvalidLayout,
#[error("unable to derive an implicit layout")]
Implicit(#[from] ImplicitLayoutError),
@ -211,6 +211,11 @@ pub enum CreateRenderPipelineError {
location: wgt::ShaderLocation,
offset: wgt::BufferAddress,
},
#[error("strip index format was not set to None but to {strip_index_format:?} while using the non-strip topology {topology:?}")]
StripIndexFormatForNonStripTopology {
strip_index_format: Option<wgt::IndexFormat>,
topology: wgt::PrimitiveTopology,
},
#[error("missing required device features {0:?}")]
MissingFeature(wgt::Features),
#[error("error in stage {flag:?}")]