Add a separate pipeline constants error (#6094)

This commit is contained in:
Teodor Tanasoaia 2024-08-12 09:20:36 +02:00 committed by GitHub
parent 28e15dcce1
commit 94f54b3dc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 21 additions and 4 deletions

View File

@ -2762,6 +2762,9 @@ impl<A: HalApi> Device<A> {
hal::PipelineError::EntryPoint(_stage) => {
pipeline::CreateComputePipelineError::Internal(ENTRYPOINT_FAILURE_ERROR.to_string())
}
hal::PipelineError::PipelineConstants(_stages, msg) => {
pipeline::CreateComputePipelineError::PipelineConstants(msg)
}
})?;
let pipeline = pipeline::ComputePipeline {
@ -3343,6 +3346,9 @@ impl<A: HalApi> Device<A> {
error: ENTRYPOINT_FAILURE_ERROR.to_string(),
}
}
hal::PipelineError::PipelineConstants(stage, error) => {
pipeline::CreateRenderPipelineError::PipelineConstants { stage, error }
}
})?;
let pass_context = RenderPassContext {

View File

@ -234,6 +234,8 @@ pub enum CreateComputePipelineError {
Stage(#[from] validation::StageError),
#[error("Internal error: {0}")]
Internal(String),
#[error("Pipeline constant error: {0}")]
PipelineConstants(String),
#[error(transparent)]
MissingDownlevelFlags(#[from] MissingDownlevelFlags),
}
@ -525,6 +527,11 @@ pub enum CreateRenderPipelineError {
stage: wgt::ShaderStages,
error: String,
},
#[error("Pipeline constant error in {stage:?} shader: {error}")]
PipelineConstants {
stage: wgt::ShaderStages,
error: String,
},
#[error("In the provided shader, the type given for group {group} binding {binding} has a size of {size}. As the device does not support `DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`, the type must have a size that is a multiple of 16 bytes.")]
UnalignedShader { group: u32, binding: u32, size: u64 },
#[error("Using the blend factor {factor:?} for render target {target} is not possible. Only the first render target may be used when dual-source blending.")]

View File

@ -234,7 +234,7 @@ impl super::Device {
&stage.module.naga.info,
stage.constants,
)
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("HLSL: {e:?}")))?;
.map_err(|e| crate::PipelineError::PipelineConstants(stage_bit, format!("HLSL: {e:?}")))?;
let needs_temp_options = stage.zero_initialize_workgroup_memory
!= layout.naga_options.zero_initialize_workgroup_memory;

View File

@ -223,7 +223,7 @@ impl super::Device {
)
.map_err(|e| {
let msg = format!("{e}");
crate::PipelineError::Linkage(map_naga_stage(naga_stage), msg)
crate::PipelineError::PipelineConstants(map_naga_stage(naga_stage), msg)
})?;
let entry_point_index = module

View File

@ -321,6 +321,8 @@ pub enum PipelineError {
EntryPoint(naga::ShaderStage),
#[error(transparent)]
Device(#[from] DeviceError),
#[error("Pipeline constant error for stage {0:?}: {1}")]
PipelineConstants(wgt::ShaderStages, String),
}
#[derive(Clone, Debug, Eq, PartialEq, Error)]

View File

@ -112,7 +112,7 @@ impl super::Device {
&stage.module.naga.info,
stage.constants,
)
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("MSL: {:?}", e)))?;
.map_err(|e| crate::PipelineError::PipelineConstants(stage_bit, format!("MSL: {:?}", e)))?;
let ep_resources = &layout.per_stage_map[naga_stage];

View File

@ -764,7 +764,9 @@ impl super::Device {
&naga_shader.info,
stage.constants,
)
.map_err(|e| crate::PipelineError::Linkage(stage_flags, format!("{e}")))?;
.map_err(|e| {
crate::PipelineError::PipelineConstants(stage_flags, format!("{e}"))
})?;
let spv = {
profiling::scope!("naga::spv::write_vec");