Skip to content

Commit

Permalink
Fixes for no attachments being an error. (#3927)
Browse files Browse the repository at this point in the history
Previously Dawn didn't correctly validate that render pipelines with no
attachments are errors. After fixing Dawn some CTS tests hit the new
validation. Fix them up to follow the WebGPU spec.

See #3754
  • Loading branch information
Kangz authored Sep 3, 2024
1 parent 9b30f7a commit 07d31bd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function getPipelineDescriptor(device: GPUDevice, testValue: number): GPURenderP
module,
entryPoint: 'vs',
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function getPipelineDescriptor(device: GPUDevice, lastIndex: number): GPURenderP
},
],
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function getPipelineDescriptor(device: GPUDevice, testValue: number): GPURenderP
},
],
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function getPipelineDescriptor(device: GPUDevice, testValue: number): GPURenderP
module,
buffers,
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
};
}

Expand Down
1 change: 1 addition & 0 deletions src/webgpu/api/validation/layout_shader_compat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ g.test('pipeline_layout_shader_exact_match')
code: vertexShader,
}),
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
});
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/webgpu/api/validation/render_pipeline/misc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ g.test('no_attachment')
g.test('vertex_state_only')
.desc(
`Tests creating vertex-state-only render pipeline. A vertex-only render pipeline has no fragment
state (and thus has no color state), and can be created with or without depth stencil state.`
state (and thus has no color state), and must have a depth-stencil state as an attachment is required.`
)
.params(u =>
u
Expand Down Expand Up @@ -76,7 +76,7 @@ state (and thus has no color state), and can be created with or without depth st
targets: hasColor ? [{ format: 'rgba8unorm' }] : [],
});

t.doCreateRenderPipelineTest(isAsync, true, descriptor);
t.doCreateRenderPipelineTest(isAsync, depthStencilState !== undefined, descriptor);
});

g.test('pipeline_layout,device_mismatch')
Expand Down
2 changes: 2 additions & 0 deletions src/webgpu/api/validation/shader_module/entry_point.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ and check that the APIs only accept matching entryPoint.
module: t.device.createShaderModule({ code }),
entryPoint,
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
};
let _success = true;
if (shaderModuleStage !== 'vertex') {
Expand Down Expand Up @@ -258,6 +259,7 @@ an undefined entryPoint is valid if there's an extra shader stage.
}),
entryPoint: undefined,
},
depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' },
};

const success = extraShaderModuleStage !== 'vertex';
Expand Down

0 comments on commit 07d31bd

Please sign in to comment.