From 51d13a4fa44ec3b0b9c2b70fc0ed0dca03d5b3c7 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 13 Jun 2022 19:18:55 +0000 Subject: [PATCH] Add depth-clip-control feature enum Not implemented on any of the backends yet. The feature has CTS coverage so tests can be enabled as implementation is written. Bug: dawn:1178 Change-Id: Ib0fa39346a42cbd996d3c42bf779767d159067e2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93309 Commit-Queue: Austin Eng Kokoro: Kokoro Reviewed-by: Shrek Shao Reviewed-by: Corentin Wallez --- dawn.json | 5 ++--- src/dawn/native/Features.cpp | 7 +++++++ src/dawn/native/Features.h | 1 + src/dawn/node/binding/GPUAdapter.cpp | 4 +++- src/dawn/wire/SupportedFeatures.cpp | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dawn.json b/dawn.json index d6cbc6b37f..d3eac41e20 100644 --- a/dawn.json +++ b/dawn.json @@ -1344,7 +1344,7 @@ "category": "enum", "values": [ {"value": 0, "name": "undefined", "jsrepr": "undefined"}, - {"value": 1, "name": "depth clip control", "tags": ["upstream", "emscripten"]}, + {"value": 1, "name": "depth clip control"}, {"value": 2, "name": "depth24 unorm stencil8"}, {"value": 3, "name": "depth32 float stencil8"}, {"value": 4, "name": "timestamp query"}, @@ -2141,7 +2141,6 @@ "primitive depth clip control": { "category": "structure", "chained": "in", - "tags": ["upstream", "emscripten"], "members": [ {"name": "unclipped depth", "type": "bool", "default": "false"} ] @@ -2469,7 +2468,7 @@ {"value": 4, "name": "surface descriptor from canvas HTML selector"}, {"value": 5, "name": "shader module SPIRV descriptor"}, {"value": 6, "name": "shader module WGSL descriptor"}, - {"value": 7, "name": "primitive depth clip control", "tags": ["upstream", "emscripten"]}, + {"value": 7, "name": "primitive depth clip control"}, {"value": 8, "name": "surface descriptor from wayland surface", "tags": ["native"]}, {"value": 9, "name": "surface descriptor from android native window", "tags": ["native"]}, {"value": 10, "name": "surface descriptor from xcb window", "tags": ["upstream"]}, diff --git a/src/dawn/native/Features.cpp b/src/dawn/native/Features.cpp index 7929a92822..7a8b2e91be 100644 --- a/src/dawn/native/Features.cpp +++ b/src/dawn/native/Features.cpp @@ -55,6 +55,9 @@ static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = {{ {Feature::TimestampQuery, {"timestamp-query", "Support Timestamp Query", "https://bugs.chromium.org/p/dawn/issues/detail?id=434"}}, + {Feature::DepthClipControl, + {"depth-clip-control", "Disable depth clipping of primitives to the clip volume", + "https://bugs.chromium.org/p/dawn/issues/detail?id=1178"}}, {Feature::DepthClamping, {"depth-clamping", "Clamp depth to [0, 1] in NDC space instead of clipping", "https://bugs.chromium.org/p/dawn/issues/detail?id=716"}}, @@ -100,6 +103,8 @@ Feature FromAPIFeature(wgpu::FeatureName feature) { return Feature::TextureCompressionETC2; case wgpu::FeatureName::TextureCompressionASTC: return Feature::TextureCompressionASTC; + case wgpu::FeatureName::DepthClipControl: + return Feature::DepthClipControl; case wgpu::FeatureName::DepthClamping: return Feature::DepthClamping; case wgpu::FeatureName::Depth24UnormStencil8: @@ -134,6 +139,8 @@ wgpu::FeatureName ToAPIFeature(Feature feature) { return wgpu::FeatureName::PipelineStatisticsQuery; case Feature::TimestampQuery: return wgpu::FeatureName::TimestampQuery; + case Feature::DepthClipControl: + return wgpu::FeatureName::DepthClipControl; case Feature::DepthClamping: return wgpu::FeatureName::DepthClamping; case Feature::Depth24UnormStencil8: diff --git a/src/dawn/native/Features.h b/src/dawn/native/Features.h index 3f4318b981..4846b03e9c 100644 --- a/src/dawn/native/Features.h +++ b/src/dawn/native/Features.h @@ -33,6 +33,7 @@ enum class Feature { ShaderFloat16, PipelineStatisticsQuery, TimestampQuery, + DepthClipControl, DepthClamping, Depth24UnormStencil8, Depth32FloatStencil8, diff --git a/src/dawn/node/binding/GPUAdapter.cpp b/src/dawn/node/binding/GPUAdapter.cpp index 58b89b65bc..a2d7248c0d 100644 --- a/src/dawn/node/binding/GPUAdapter.cpp +++ b/src/dawn/node/binding/GPUAdapter.cpp @@ -113,12 +113,14 @@ class Features : public interop::GPUSupportedFeatures { case wgpu::FeatureName::IndirectFirstInstance: enabled_.emplace(interop::GPUFeatureName::kIndirectFirstInstance); break; + case wgpu::FeatureName::DepthClipControl: + enabled_.emplace(interop::GPUFeatureName::kDepthClipControl); + break; default: break; } } // TODO(dawn:1123) add support for these extensions when possible. - // wgpu::interop::GPUFeatureName::kDepthClipControl // wgpu::interop::GPUFeatureName::kShaderF16 // wgpu::interop::GPUFeatureName::kBgra8UnormStorage } diff --git a/src/dawn/wire/SupportedFeatures.cpp b/src/dawn/wire/SupportedFeatures.cpp index 0e5688a119..352ed0f043 100644 --- a/src/dawn/wire/SupportedFeatures.cpp +++ b/src/dawn/wire/SupportedFeatures.cpp @@ -32,6 +32,7 @@ bool IsFeatureSupported(WGPUFeatureName feature) { case WGPUFeatureName_TextureCompressionETC2: case WGPUFeatureName_TextureCompressionASTC: case WGPUFeatureName_IndirectFirstInstance: + case WGPUFeatureName_DepthClipControl: case WGPUFeatureName_DepthClamping: case WGPUFeatureName_DawnShaderFloat16: case WGPUFeatureName_DawnInternalUsages: