mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Add depth-clamping support for Metal
This CL adds depth clamping support to Metal by invoking MTLRenderCommandEncoder::setDepthClipMode. I only implemented the feature for the new-style of RenderPipelineDescriptor since the old one seems to be deprecated. Bug: dawn:716 Change-Id: Icd63c72294546042ae452360863a7f9c16b40f95 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45640 Commit-Queue: Brian Ho <hob@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
cb0bdb3401
commit
2cccd5a70c
@@ -550,6 +550,28 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test that specifying a clampDepth value results in an error if the feature is not enabled.
|
||||
TEST_F(RenderPipelineValidationTest, ClampDepthWithoutExtension) {
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
wgpu::PrimitiveDepthClampingState clampingState;
|
||||
clampingState.clampDepth = true;
|
||||
descriptor.primitive.nextInChain = &clampingState;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||
}
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
wgpu::PrimitiveDepthClampingState clampingState;
|
||||
clampingState.clampDepth = false;
|
||||
descriptor.primitive.nextInChain = &clampingState;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
// Test that the entryPoint names must be present for the correct stage in the shader module.
|
||||
TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
@@ -739,3 +761,34 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) {
|
||||
descriptor.layout = layout1;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||
}
|
||||
|
||||
class DepthClampingValidationTest : public RenderPipelineValidationTest {
|
||||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredExtensions = {"depth_clamping"};
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
};
|
||||
|
||||
// Tests that specifying a clampDepth value succeeds if the extension is enabled.
|
||||
TEST_F(DepthClampingValidationTest, Success) {
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
wgpu::PrimitiveDepthClampingState clampingState;
|
||||
clampingState.clampDepth = true;
|
||||
descriptor.primitive.nextInChain = &clampingState;
|
||||
device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
wgpu::PrimitiveDepthClampingState clampingState;
|
||||
clampingState.clampDepth = false;
|
||||
descriptor.primitive.nextInChain = &clampingState;
|
||||
device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user