Skip to content
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Bottom level categories:
- Added support for obtaining `AdapterInfo` from `Device`. By @sagudev in [#8807](https://github.com/gfx-rs/wgpu/pull/8807).
- Added `Limits::or_worse_values_from`. By @atlv24 in [#8870](https://github.com/gfx-rs/wgpu/pull/8870).

#### General

- Pipelines using passthrough shaders now correctly require explicit pipeline layout. By @inner-daemons in #8881.

#### Naga

- Allow parsing shaders which make use of `SPV_KHR_non_semantic_info` for debug info. Also removes `naga::front::spv::SUPPORTED_EXT_SETS`. By @inner-daemons in #8827.
Expand Down
24 changes: 24 additions & 0 deletions wgpu-core/src/device/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,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) => {
Expand All @@ -1408,6 +1409,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(),
Expand Down Expand Up @@ -1435,6 +1439,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(),
Expand All @@ -1459,6 +1466,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(),
Expand Down Expand Up @@ -1487,6 +1497,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(),
Expand All @@ -1501,6 +1514,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,
Expand Down Expand Up @@ -1634,6 +1653,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(),
Expand Down
3 changes: 3 additions & 0 deletions wgpu-core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,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 {
Expand All @@ -207,6 +209,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()
}
Expand Down