mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 14:31:08 +01:00
Validate pipelines with passthrough shaders but no explicit layout passed (#8881)
This commit is contained in:
1 parent
db8270e3bc
commit
c82e37b683
3 files changed
+28
No files matched your search
@@ -80,6 +80,7 @@ Bottom level categories:
|
||||
- BREAKING: Migrated from the `maxInterStageShaderComponents` limit to `maxInterStageShaderVariables`, which changes validation in a way that should not affect most programs. This follows the latest changes of the WebGPU spec. By @ErichDonGubler in [#8652](https://github.com/gfx-rs/wgpu/pull/8652), [#8792](https://github.com/gfx-rs/wgpu/pull/8792).
|
||||
- Fixed validation of the texture format in GPUDepthStencilState when neither depth nor stencil is actually enabled. By @andyleiserson in [#8766](https://github.com/gfx-rs/wgpu/pull/8766).
|
||||
- Tracing support has been restored. By @andyleiserson in [#8429](https://github.com/gfx-rs/wgpu/pull/8429).
|
||||
- Pipelines using passthrough shaders now correctly require explicit pipeline layout. By @inner-daemons in #8881.
|
||||
|
||||
#### naga
|
||||
|
||||
|
||||
@@ -1392,6 +1392,7 @@ impl Global {
|
||||
Ok(cache) => cache,
|
||||
Err(e) => break 'error e.into(),
|
||||
};
|
||||
let mut passthrough_stages = wgt::ShaderStages::empty();
|
||||
|
||||
let vertex = match desc.vertex {
|
||||
RenderPipelineVertexProcessor::Vertex(ref vertex) => {
|
||||
@@ -1407,6 +1408,9 @@ impl Global {
|
||||
Ok(module) => module,
|
||||
Err(e) => break 'error e,
|
||||
};
|
||||
if module.interface.is_none() {
|
||||
passthrough_stages |= wgt::ShaderStages::VERTEX;
|
||||
}
|
||||
let stage = ResolvedProgrammableStageDescriptor {
|
||||
module,
|
||||
entry_point: vertex.stage.entry_point.clone(),
|
||||
@@ -1434,6 +1438,9 @@ impl Global {
|
||||
Ok(module) => module,
|
||||
Err(e) => break 'error e,
|
||||
};
|
||||
if module.interface.is_none() {
|
||||
passthrough_stages |= wgt::ShaderStages::TASK;
|
||||
}
|
||||
let state = ResolvedProgrammableStageDescriptor {
|
||||
module,
|
||||
entry_point: task.stage.entry_point.clone(),
|
||||
@@ -1458,6 +1465,9 @@ impl Global {
|
||||
Ok(module) => module,
|
||||
Err(e) => break 'error e,
|
||||
};
|
||||
if mesh_module.interface.is_none() {
|
||||
passthrough_stages |= wgt::ShaderStages::VERTEX;
|
||||
}
|
||||
let mesh_stage = ResolvedProgrammableStageDescriptor {
|
||||
module: mesh_module,
|
||||
entry_point: mesh.stage.entry_point.clone(),
|
||||
@@ -1486,6 +1496,9 @@ impl Global {
|
||||
Ok(module) => module,
|
||||
Err(e) => break 'error e,
|
||||
};
|
||||
if module.interface.is_none() {
|
||||
passthrough_stages |= wgt::ShaderStages::FRAGMENT;
|
||||
}
|
||||
let stage = ResolvedProgrammableStageDescriptor {
|
||||
module,
|
||||
entry_point: state.stage.entry_point.clone(),
|
||||
@@ -1500,6 +1513,12 @@ impl Global {
|
||||
None
|
||||
};
|
||||
|
||||
if !passthrough_stages.is_empty() && layout.is_none() {
|
||||
break 'error pipeline::CreateRenderPipelineError::Implicit(
|
||||
pipeline::ImplicitLayoutError::Passthrough(passthrough_stages),
|
||||
);
|
||||
}
|
||||
|
||||
let desc = ResolvedGeneralRenderPipelineDescriptor {
|
||||
label: desc.label.clone(),
|
||||
layout,
|
||||
@@ -1642,6 +1661,11 @@ impl Global {
|
||||
Ok(module) => module,
|
||||
Err(e) => break 'error e.into(),
|
||||
};
|
||||
if module.interface.is_none() && layout.is_none() {
|
||||
break 'error pipeline::CreateComputePipelineError::Implicit(
|
||||
pipeline::ImplicitLayoutError::Passthrough(wgt::ShaderStages::COMPUTE),
|
||||
);
|
||||
}
|
||||
let stage = ResolvedProgrammableStageDescriptor {
|
||||
module,
|
||||
entry_point: desc.stage.entry_point.clone(),
|
||||
|
||||
@@ -202,6 +202,8 @@ pub enum ImplicitLayoutError {
|
||||
BindGroup(#[from] CreateBindGroupLayoutError),
|
||||
#[error(transparent)]
|
||||
Pipeline(#[from] CreatePipelineLayoutError),
|
||||
#[error("Unable to create implicit pipeline layout from passthrough shader stage: {0:?}")]
|
||||
Passthrough(wgt::ShaderStages),
|
||||
}
|
||||
|
||||
impl WebGpuError for ImplicitLayoutError {
|
||||
@@ -210,6 +212,7 @@ impl WebGpuError for ImplicitLayoutError {
|
||||
Self::ReflectionError(_) => return ErrorType::Validation,
|
||||
Self::BindGroup(e) => e,
|
||||
Self::Pipeline(e) => e,
|
||||
Self::Passthrough(_) => return ErrorType::Validation,
|
||||
};
|
||||
e.webgpu_error_type()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user