0

Fix WGPU features exposed to Render process

This CL make `DepthClipControl` always exposed rather than behind
DisallowUnsafeApis toggle since it is now stable, and add a comment
about GPU process hiding `DawnMultiPlanarFormats` feature from Render
process as unsafe apis.
This CL prepares for refactoring adapter features validation with
adapter toggles.

Bug: dawn:1495
Change-Id: I1879e8d7a600cc19b747e63ff1d1b21bb2e859b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4169134
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1093348}
This commit is contained in:
Zhaoming Jiang
2023-01-17 16:28:53 +00:00
committed by Chromium LUCI CQ
parent 13244ccc83
commit 79d2b707e1
2 changed files with 10 additions and 2 deletions
AUTHORS
gpu/command_buffer/service

@ -1382,6 +1382,7 @@ Zeno Albisser <zeno.albisser@digia.com>
Zeqin Chen <talonchen@tencent.com>
Zhang Hao <zhanghao.m@bytedance.com>
Zhang Hao <15686357310a@gmail.com>
Zhaoming Jiang <zhaoming.jiang@intel.com>
Zhaoze Zhou <zhaoze.zhou@partner.samsung.com>
Zheda Chen <zheda.chen@intel.com>
Zheng Chuang <zhengchuangscu@gmail.com>

@ -385,6 +385,7 @@ class WebGPUDecoderImpl final : public WebGPUDecoder {
int32_t GetPreferredAdapterIndex(WGPUPowerPreference power_preference,
bool force_fallback) const;
// Decide if a device feature is exposed to render process.
bool IsFeatureExposed(WGPUFeatureName feature) const;
// Dawn wire uses procs which forward their calls to these methods.
@ -1199,10 +1200,14 @@ bool WebGPUDecoderImpl::IsFeatureExposed(WGPUFeatureName feature) const {
case WGPUFeatureName_TimestampQueryInsidePasses:
case WGPUFeatureName_PipelineStatisticsQuery:
case WGPUFeatureName_ChromiumExperimentalDp4a:
// TODO(crbug.com/1258986): DawnMultiPlanarFormats is a stable feature in
// Dawn, but currently we hide it from Render process as unsafe apis, so
// that 0-copy code path, which explicitly checks this feature, is protected
// under unsafe apis as well.
case WGPUFeatureName_DawnMultiPlanarFormats:
case WGPUFeatureName_DepthClipControl:
return allow_unsafe_apis_;
case WGPUFeatureName_Depth32FloatStencil8:
case WGPUFeatureName_DepthClipControl:
case WGPUFeatureName_TextureCompressionBC:
case WGPUFeatureName_TextureCompressionETC2:
case WGPUFeatureName_TextureCompressionASTC:
@ -1344,7 +1349,9 @@ void WebGPUDecoderImpl::RequestDeviceImpl(
// SharedImage / interop methods that would need specific usages.
required_features.push_back(WGPUFeatureName_DawnInternalUsages);
// Always enable "multi-planar-formats" as long as available.
// Always require "multi-planar-formats" as long as supported, although
// currently this feature is not exposed to render process if unsafe apis
// disallowed.
if (dawn::native::GetProcs().adapterHasFeature(
adapter, WGPUFeatureName_DawnMultiPlanarFormats)) {
required_features.push_back(WGPUFeatureName_DawnMultiPlanarFormats);