Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Bottom level categories:

#### General

- 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).
- 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).

### Documentation
Expand Down
28 changes: 28 additions & 0 deletions cts_runner/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,31 @@ webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribu
webgpu:api,validation,buffer,create:*
webgpu:api,validation,buffer,destroy:*
fails-if(dx12) webgpu:api,validation,capability_checks,limits,maxBindGroups:setBindGroup,*
// NOTE: Only test some of these `maxInterStageShaderVariables` cases, because of a CTS bug (see
// below). CTS (incorrectly) only deducts once for any set of them being enabled, but it should
// deduct for _each_ built-in.
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=false;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=false;frontFacing=true;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=false;frontFacing=false;sampleIndex=true;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=false;frontFacing=false;sampleIndex=false;sampleMaskIn=true;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=false;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=true
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=true;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=true;frontFacing=true;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=true;frontFacing=false;sampleIndex=true;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=true;frontFacing=false;sampleIndex=false;sampleMaskIn=true;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=false;pointList=true;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=true
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=false;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=false;frontFacing=true;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=false;frontFacing=false;sampleIndex=true;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=false;frontFacing=false;sampleIndex=false;sampleMaskIn=true;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=false;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=true
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=true;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=true;frontFacing=true;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=true;frontFacing=false;sampleIndex=true;sampleMaskIn=false;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=true;frontFacing=false;sampleIndex=false;sampleMaskIn=true;sampleMaskOut=false
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:limitTest="atDefault";testValueName="atLimit";async=true;pointList=true;frontFacing=false;sampleIndex=false;sampleMaskIn=false;sampleMaskOut=true
//FAIL: webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:*
// https://github.com/gpuweb/cts/issues/4538
webgpu:api,validation,createBindGroup:buffer_offset_and_size_for_bind_groups_match:*
webgpu:api,validation,createBindGroup:buffer,effective_buffer_binding_size:*
webgpu:api,validation,createBindGroup:buffer,resource_binding_size:*
Expand Down Expand Up @@ -137,6 +162,9 @@ webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,*
webgpu:api,validation,render_pass,resolve:resolve_attachment:*
webgpu:api,validation,render_pipeline,depth_stencil_state:format:*
webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:*
webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=false;*
//FAIL: webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=true;*
// https://github.com/gfx-rs/wgpu/pull/8712
webgpu:api,validation,resource_usages,buffer,in_pass_encoder:*
// FAIL: 2 other cases in resource_usages,texture,in_pass_encoder. https://github.com/gfx-rs/wgpu/issues/3126
webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,*
Expand Down
3 changes: 1 addition & 2 deletions deno_webgpu/01_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ ObjectDefineProperty(GPUSupportedLimitsPrototype, privateCustomInspect, {
"maxBufferSize",
"maxVertexAttributes",
"maxVertexBufferArrayStride",
// TODO(@crowlKats): support max_inter_stage_shader_variables
// "maxInterStageShaderVariables",
"maxInterStageShaderVariables",
"maxColorAttachments",
"maxColorAttachmentBytesPerSample",
"maxComputeWorkgroupStorageSize",
Expand Down
5 changes: 4 additions & 1 deletion deno_webgpu/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ impl GPUSupportedLimits {
self.0.max_vertex_buffer_array_stride
}

// TODO(@crowlKats): support max_inter_stage_shader_variables
#[getter]
fn maxInterStageShaderVariables(&self) -> u32 {
self.0.max_inter_stage_shader_variables
}

#[getter]
fn maxColorAttachments(&self) -> u32 {
Expand Down
65 changes: 38 additions & 27 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3743,10 +3743,10 @@ impl Device {
let final_entry_point_name;

{
let stage = wgt::ShaderStages::COMPUTE;
let stage = validation::ShaderStageForValidation::Compute;

final_entry_point_name = shader_module.finalize_entry_point_name(
stage,
stage.to_naga(),
desc.stage.entry_point.as_ref().map(|ep| ep.as_ref()),
)?;

Expand All @@ -3757,7 +3757,6 @@ impl Device {
&final_entry_point_name,
stage,
io,
None,
)?;
}
}
Expand Down Expand Up @@ -4238,17 +4237,23 @@ impl Device {
pipeline::RenderPipelineVertexProcessor::Vertex(ref vertex) => {
vertex_stage = {
let stage_desc = &vertex.stage;
let stage = wgt::ShaderStages::VERTEX;
let stage = validation::ShaderStageForValidation::Vertex {
topology: desc.primitive.topology,
compare_function: desc.depth_stencil.as_ref().map(|d| d.depth_compare),
};
let stage_bit = stage.to_wgt_bit();

let vertex_shader_module = &stage_desc.module;
vertex_shader_module.same_device(self)?;

let stage_err =
|error| pipeline::CreateRenderPipelineError::Stage { stage, error };
let stage_err = |error| pipeline::CreateRenderPipelineError::Stage {
stage: stage_bit,
error,
};

_vertex_entry_point_name = vertex_shader_module
.finalize_entry_point_name(
stage,
stage.to_naga(),
stage_desc.entry_point.as_ref().map(|ep| ep.as_ref()),
)
.map_err(stage_err)?;
Expand All @@ -4261,10 +4266,9 @@ impl Device {
&_vertex_entry_point_name,
stage,
io,
desc.depth_stencil.as_ref().map(|d| d.depth_compare),
)
.map_err(stage_err)?;
validated_stages |= stage;
validated_stages |= stage_bit;
}
Some(hal::ProgrammableStage {
module: vertex_shader_module.raw(),
Expand All @@ -4280,16 +4284,19 @@ impl Device {

task_stage = if let Some(task) = task {
let stage_desc = &task.stage;
let stage = wgt::ShaderStages::TASK;
let stage = validation::ShaderStageForValidation::Task;
let stage_bit = stage.to_wgt_bit();
let task_shader_module = &stage_desc.module;
task_shader_module.same_device(self)?;

let stage_err =
|error| pipeline::CreateRenderPipelineError::Stage { stage, error };
let stage_err = |error| pipeline::CreateRenderPipelineError::Stage {
stage: stage_bit,
error,
};

_task_entry_point_name = task_shader_module
.finalize_entry_point_name(
stage,
stage.to_naga(),
stage_desc.entry_point.as_ref().map(|ep| ep.as_ref()),
)
.map_err(stage_err)?;
Expand All @@ -4302,10 +4309,9 @@ impl Device {
&_task_entry_point_name,
stage,
io,
desc.depth_stencil.as_ref().map(|d| d.depth_compare),
)
.map_err(stage_err)?;
validated_stages |= stage;
validated_stages |= stage_bit;
}
Some(hal::ProgrammableStage {
module: task_shader_module.raw(),
Expand All @@ -4319,16 +4325,19 @@ impl Device {
};
mesh_stage = {
let stage_desc = &mesh.stage;
let stage = wgt::ShaderStages::MESH;
let stage = validation::ShaderStageForValidation::Mesh;
let stage_bit = stage.to_wgt_bit();
let mesh_shader_module = &stage_desc.module;
mesh_shader_module.same_device(self)?;

let stage_err =
|error| pipeline::CreateRenderPipelineError::Stage { stage, error };
let stage_err = |error| pipeline::CreateRenderPipelineError::Stage {
stage: stage_bit,
error,
};

_mesh_entry_point_name = mesh_shader_module
.finalize_entry_point_name(
stage,
stage.to_naga(),
stage_desc.entry_point.as_ref().map(|ep| ep.as_ref()),
)
.map_err(stage_err)?;
Expand All @@ -4341,10 +4350,9 @@ impl Device {
&_mesh_entry_point_name,
stage,
io,
desc.depth_stencil.as_ref().map(|d| d.depth_compare),
)
.map_err(stage_err)?;
validated_stages |= stage;
validated_stages |= stage_bit;
}
Some(hal::ProgrammableStage {
module: mesh_shader_module.raw(),
Expand All @@ -4360,16 +4368,20 @@ impl Device {
let fragment_entry_point_name;
let fragment_stage = match desc.fragment {
Some(ref fragment_state) => {
let stage = wgt::ShaderStages::FRAGMENT;
let stage = validation::ShaderStageForValidation::Fragment;
let stage_bit = stage.to_wgt_bit();

let shader_module = &fragment_state.stage.module;
shader_module.same_device(self)?;

let stage_err = |error| pipeline::CreateRenderPipelineError::Stage { stage, error };
let stage_err = |error| pipeline::CreateRenderPipelineError::Stage {
stage: stage_bit,
error,
};

fragment_entry_point_name = shader_module
.finalize_entry_point_name(
stage,
stage.to_naga(),
fragment_state
.stage
.entry_point
Expand All @@ -4386,17 +4398,16 @@ impl Device {
&fragment_entry_point_name,
stage,
io,
desc.depth_stencil.as_ref().map(|d| d.depth_compare),
)
.map_err(stage_err)?;
validated_stages |= stage;
validated_stages |= stage_bit;
}

if let Some(ref interface) = shader_module.interface {
shader_expects_dual_source_blending = interface
.fragment_uses_dual_source_blending(&fragment_entry_point_name)
.map_err(|error| pipeline::CreateRenderPipelineError::Stage {
stage,
stage: stage_bit,
error,
})?;
}
Expand Down
4 changes: 2 additions & 2 deletions wgpu-core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ impl ShaderModule {

pub(crate) fn finalize_entry_point_name(
&self,
stage_bit: wgt::ShaderStages,
stage: naga::ShaderStage,
entry_point: Option<&str>,
) -> Result<String, validation::StageError> {
match &self.interface {
Some(interface) => interface.finalize_entry_point_name(stage_bit, entry_point),
Some(interface) => interface.finalize_entry_point_name(stage, entry_point),
None => entry_point
.map(|ep| ep.to_string())
.ok_or(validation::StageError::NoEntryPointFound),
Expand Down
Loading