Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a separate pipeline constants error #6094

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2745,6 +2745,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 {
Expand Down Expand Up @@ -3326,6 +3329,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 {
Expand Down
7 changes: 7 additions & 0 deletions wgpu-core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down Expand Up @@ -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.")]
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/gles/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions wgpu-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/metal/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
4 changes: 3 additions & 1 deletion wgpu-hal/src/vulkan/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading