Dawn: Refactor adapter features, part 1

This CL make adapter base holds it supported features set as private
instead of protected and provide a method to set features enabled. This
CL also rename SetSupportedFeatures in null adapter to
SetSupportedFeaturesForTesting.
This is a pre-CL for implementing UseDXC as instance toggle, which may
require further refactor and adapter features logic to handle the toggles.

Bug: dawn:1495
Change-Id: I0a07e5653b43f18278cb4a2fe90985cc90b66068
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124421
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Zhaoming Jiang 2023-03-16 19:06:33 +00:00 committed by Dawn LUCI CQ
parent 498e91826e
commit 981d5a6f08
12 changed files with 104 additions and 104 deletions

View File

@ -40,8 +40,8 @@ MaybeError AdapterBase::Initialize() {
DAWN_TRY_CONTEXT(InitializeImpl(), "initializing adapter (backend=%s)", mBackend);
InitializeVendorArchitectureImpl();
mSupportedFeatures.EnableFeature(Feature::DawnNative);
mSupportedFeatures.EnableFeature(Feature::DawnInternalUsages);
EnableFeature(Feature::DawnNative);
EnableFeature(Feature::DawnInternalUsages);
InitializeSupportedFeaturesImpl();
DAWN_TRY_CONTEXT(
@ -213,9 +213,12 @@ const TogglesState& AdapterBase::GetTogglesState() const {
return mTogglesState;
}
MaybeError AdapterBase::ValidateFeatureSupportedWithDeviceToggles(
wgpu::FeatureName feature,
const TogglesState& deviceTogglesState) {
void AdapterBase::EnableFeature(Feature feature) {
mSupportedFeatures.EnableFeature(feature);
}
MaybeError AdapterBase::ValidateFeatureSupportedWithToggles(wgpu::FeatureName feature,
const TogglesState& toggles) const {
DAWN_TRY(ValidateFeatureName(feature));
DAWN_INVALID_IF(!mSupportedFeatures.IsEnabled(feature),
"Requested feature %s is not supported.", feature);
@ -224,12 +227,20 @@ MaybeError AdapterBase::ValidateFeatureSupportedWithDeviceToggles(
// Experimental features are guarded by toggle DisallowUnsafeAPIs.
if (featureInfo->featureState == FeatureInfo::FeatureState::Experimental) {
// DisallowUnsafeAPIs toggle is by default enabled if not explicitly disabled.
DAWN_INVALID_IF(deviceTogglesState.IsEnabled(Toggle::DisallowUnsafeAPIs),
DAWN_INVALID_IF(toggles.IsEnabled(Toggle::DisallowUnsafeAPIs),
"Feature %s is guarded by toggle disallow_unsafe_apis.", featureInfo->name);
}
// Do backend-specific validation.
return ValidateFeatureSupportedWithDeviceTogglesImpl(feature, deviceTogglesState);
return ValidateFeatureSupportedWithTogglesImpl(feature, toggles);
}
void AdapterBase::SetSupportedFeaturesForTesting(
const std::vector<wgpu::FeatureName>& requiredFeatures) {
mSupportedFeatures = {};
for (wgpu::FeatureName f : requiredFeatures) {
mSupportedFeatures.EnableFeature(f);
}
}
ResultOrError<Ref<DeviceBase>> AdapterBase::CreateDeviceInternal(
@ -285,7 +296,7 @@ ResultOrError<Ref<DeviceBase>> AdapterBase::CreateDeviceInternal(
// supported features using adapter toggles or device toggles.
for (uint32_t i = 0; i < descriptor->requiredFeaturesCount; ++i) {
wgpu::FeatureName feature = descriptor->requiredFeatures[i];
DAWN_TRY(ValidateFeatureSupportedWithDeviceToggles(feature, deviceToggles));
DAWN_TRY(ValidateFeatureSupportedWithToggles(feature, deviceToggles));
}
if (descriptor->requiredLimits != nullptr) {

View File

@ -16,6 +16,7 @@
#define SRC_DAWN_NATIVE_ADAPTER_H_
#include <string>
#include <vector>
#include "dawn/native/DawnNative.h"
@ -82,15 +83,15 @@ class AdapterBase : public RefCounted {
gpu_info::DriverVersion mDriverVersion;
std::string mDriverDescription;
// Features set that CAN be supported by devices of this adapter. Some features in this set may
// be guarded by toggles, and creating a device with these features required may result in a
// validation error if proper toggles are not enabled/disabled.
FeaturesSet mSupportedFeatures;
// Mark a feature as enabled in mSupportedFeatures.
void EnableFeature(Feature feature);
// Check if a feature os supported by this adapter AND suitable with given toggles.
// TODO(dawn:1495): After implementing adapter toggles, remove this and use adapter toggles
// instead of device toggles to validate supported features.
MaybeError ValidateFeatureSupportedWithDeviceToggles(wgpu::FeatureName feature,
const TogglesState& deviceTogglesState);
MaybeError ValidateFeatureSupportedWithToggles(wgpu::FeatureName feature,
const TogglesState& toggles) const;
// Used for the tests that intend to use an adapter without all features enabled.
void SetSupportedFeaturesForTesting(const std::vector<wgpu::FeatureName>& requiredFeatures);
private:
// Backend-specific force-setting and defaulting device toggles
@ -109,9 +110,9 @@ class AdapterBase : public RefCounted {
virtual void InitializeVendorArchitectureImpl();
virtual MaybeError ValidateFeatureSupportedWithDeviceTogglesImpl(
virtual MaybeError ValidateFeatureSupportedWithTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceTogglesState) = 0;
const TogglesState& toggles) const = 0;
ResultOrError<Ref<DeviceBase>> CreateDeviceInternal(const DeviceDescriptor* descriptor);
@ -122,6 +123,11 @@ class AdapterBase : public RefCounted {
// Adapter toggles state, currently only inherited from instance toggles state.
TogglesState mTogglesState;
// Features set that CAN be supported by devices of this adapter. Some features in this set may
// be guarded by toggles, and creating a device with these features required may result in a
// validation error if proper toggles are not enabled/disabled.
FeaturesSet mSupportedFeatures;
CombinedLimits mLimits;
bool mUseTieredLimits = false;
};

View File

@ -135,26 +135,26 @@ bool Adapter::AreTimestampQueriesSupported() const {
}
void Adapter::InitializeSupportedFeaturesImpl() {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC);
mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats);
mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8);
mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance);
mSupportedFeatures.EnableFeature(Feature::RG11B10UfloatRenderable);
mSupportedFeatures.EnableFeature(Feature::DepthClipControl);
EnableFeature(Feature::TextureCompressionBC);
EnableFeature(Feature::MultiPlanarFormats);
EnableFeature(Feature::Depth32FloatStencil8);
EnableFeature(Feature::IndirectFirstInstance);
EnableFeature(Feature::RG11B10UfloatRenderable);
EnableFeature(Feature::DepthClipControl);
if (AreTimestampQueriesSupported()) {
mSupportedFeatures.EnableFeature(Feature::TimestampQuery);
mSupportedFeatures.EnableFeature(Feature::TimestampQueryInsidePasses);
EnableFeature(Feature::TimestampQuery);
EnableFeature(Feature::TimestampQueryInsidePasses);
}
mSupportedFeatures.EnableFeature(Feature::PipelineStatisticsQuery);
EnableFeature(Feature::PipelineStatisticsQuery);
// Both Dp4a and ShaderF16 features require DXC version being 1.4 or higher
if (GetBackend()->IsDXCAvailableAndVersionAtLeast(1, 4, 1, 4)) {
if (mDeviceInfo.supportsDP4a) {
mSupportedFeatures.EnableFeature(Feature::ChromiumExperimentalDp4a);
EnableFeature(Feature::ChromiumExperimentalDp4a);
}
if (mDeviceInfo.supportsShaderF16) {
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
EnableFeature(Feature::ShaderF16);
}
}
@ -164,7 +164,7 @@ void Adapter::InitializeSupportedFeaturesImpl() {
D3D12_FEATURE_FORMAT_SUPPORT, &bgra8unormFormatInfo, sizeof(bgra8unormFormatInfo));
if (SUCCEEDED(hr) &&
(bgra8unormFormatInfo.Support1 & D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW)) {
mSupportedFeatures.EnableFeature(Feature::BGRA8UnormStorage);
EnableFeature(Feature::BGRA8UnormStorage);
}
}
@ -342,16 +342,13 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
return {};
}
MaybeError Adapter::ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceTogglesState) {
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const {
// shader-f16 feature and chromium-experimental-dp4a feature require DXC 1.4 or higher for
// D3D12.
// D3D12. Note that DXC version is checked in InitializeSupportedFeaturesImpl.
if (feature == wgpu::FeatureName::ShaderF16 ||
feature == wgpu::FeatureName::ChromiumExperimentalDp4a) {
DAWN_INVALID_IF(!(deviceTogglesState.IsEnabled(Toggle::UseDXC) &&
GetBackend()->IsDXCAvailableAndVersionAtLeast(1, 4, 1, 4)),
"Feature %s requires DXC for D3D12.",
DAWN_INVALID_IF(!toggles.IsEnabled(Toggle::UseDXC), "Feature %s requires DXC for D3D12.",
GetInstance()->GetFeatureInfo(feature)->name);
}
return {};

View File

@ -55,9 +55,8 @@ class Adapter : public d3d::Adapter {
void InitializeSupportedFeaturesImpl() override;
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
MaybeError ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceTogglesState) override;
MaybeError ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const override;
MaybeError InitializeDebugLayerFilters();
void CleanUpDebugLayerFilters();

View File

@ -431,28 +431,28 @@ class Adapter : public AdapterBase {
// Check compressed texture format with deprecated MTLFeatureSet way.
#if DAWN_PLATFORM_IS(MACOS)
if ([*mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC);
EnableFeature(Feature::TextureCompressionBC);
}
#endif
#if DAWN_PLATFORM_IS(IOS)
if ([*mDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v1]) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionETC2);
EnableFeature(Feature::TextureCompressionETC2);
}
if ([*mDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v1]) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionASTC);
EnableFeature(Feature::TextureCompressionASTC);
}
#endif
// Check compressed texture format with MTLGPUFamily
if (@available(macOS 10.15, iOS 13.0, *)) {
if ([*mDevice supportsFamily:MTLGPUFamilyMac1]) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC);
EnableFeature(Feature::TextureCompressionBC);
}
if ([*mDevice supportsFamily:MTLGPUFamilyApple2]) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionETC2);
EnableFeature(Feature::TextureCompressionETC2);
}
if ([*mDevice supportsFamily:MTLGPUFamilyApple3]) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionASTC);
EnableFeature(Feature::TextureCompressionASTC);
}
}
@ -462,7 +462,7 @@ class Adapter : public AdapterBase {
{MTLCommonCounterVertexInvocations, MTLCommonCounterClipperInvocations,
MTLCommonCounterClipperPrimitivesOut, MTLCommonCounterFragmentInvocations,
MTLCommonCounterComputeKernelInvocations})) {
mSupportedFeatures.EnableFeature(Feature::PipelineStatisticsQuery);
EnableFeature(Feature::PipelineStatisticsQuery);
}
if (IsGPUCounterSupported(*mDevice, MTLCommonCounterSetTimestamp,
@ -486,33 +486,33 @@ class Adapter : public AdapterBase {
#endif
if (enableTimestampQuery) {
mSupportedFeatures.EnableFeature(Feature::TimestampQuery);
EnableFeature(Feature::TimestampQuery);
}
if (enableTimestampQueryInsidePasses) {
mSupportedFeatures.EnableFeature(Feature::TimestampQueryInsidePasses);
EnableFeature(Feature::TimestampQueryInsidePasses);
}
}
}
if (@available(macOS 10.11, iOS 11.0, *)) {
mSupportedFeatures.EnableFeature(Feature::DepthClipControl);
EnableFeature(Feature::DepthClipControl);
}
if (@available(macOS 10.11, iOS 9.0, *)) {
mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8);
EnableFeature(Feature::Depth32FloatStencil8);
}
// Uses newTextureWithDescriptor::iosurface::plane which is available
// on ios 11.0+ and macOS 11.0+
if (@available(macOS 10.11, iOS 11.0, *)) {
mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats);
EnableFeature(Feature::MultiPlanarFormats);
}
mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance);
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
mSupportedFeatures.EnableFeature(Feature::RG11B10UfloatRenderable);
mSupportedFeatures.EnableFeature(Feature::BGRA8UnormStorage);
EnableFeature(Feature::IndirectFirstInstance);
EnableFeature(Feature::ShaderF16);
EnableFeature(Feature::RG11B10UfloatRenderable);
EnableFeature(Feature::BGRA8UnormStorage);
}
void InitializeVendorArchitectureImpl() override {
@ -759,9 +759,8 @@ class Adapter : public AdapterBase {
return {};
}
MaybeError ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceToggles) override {
MaybeError ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const override {
return {};
}

View File

@ -50,21 +50,15 @@ bool Adapter::SupportsExternalImages() const {
return false;
}
// Used for the tests that intend to use an adapter without all features enabled.
void Adapter::SetSupportedFeatures(const std::vector<wgpu::FeatureName>& requiredFeatures) {
mSupportedFeatures = {};
for (wgpu::FeatureName f : requiredFeatures) {
mSupportedFeatures.EnableFeature(f);
}
}
MaybeError Adapter::InitializeImpl() {
return {};
}
void Adapter::InitializeSupportedFeaturesImpl() {
// Enable all features by default for the convenience of tests.
mSupportedFeatures.featuresBitSet.set();
for (uint32_t i = 0; i < static_cast<uint32_t>(Feature::EnumCount); i++) {
EnableFeature(static_cast<Feature>(i));
}
}
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
@ -79,9 +73,8 @@ ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor*
return Device::Create(this, descriptor, deviceToggles);
}
MaybeError Adapter::ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceToggles) {
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const {
return {};
}

View File

@ -181,16 +181,15 @@ class Adapter : public AdapterBase {
bool SupportsExternalImages() const override;
// Used for the tests that intend to use an adapter without all features enabled.
void SetSupportedFeatures(const std::vector<wgpu::FeatureName>& requiredFeatures);
using AdapterBase::SetSupportedFeaturesForTesting;
private:
MaybeError InitializeImpl() override;
void InitializeSupportedFeaturesImpl() override;
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
MaybeError ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceToggles) override;
MaybeError ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const override;
void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override;
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(const DeviceDescriptor* descriptor,

View File

@ -130,7 +130,7 @@ void Adapter::InitializeSupportedFeaturesImpl() {
if (supportsS3TC && (supportsTextureSRGB || supportsS3TCSRGB) && supportsRGTC &&
supportsBPTC) {
mSupportedFeatures.EnableFeature(dawn::native::Feature::TextureCompressionBC);
EnableFeature(dawn::native::Feature::TextureCompressionBC);
}
}
@ -140,12 +140,12 @@ void Adapter::InitializeSupportedFeaturesImpl() {
// OpenGL ES:
// https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsIndirect.xhtml
if (mFunctions.IsAtLeastGL(4, 2)) {
mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance);
EnableFeature(Feature::IndirectFirstInstance);
}
// ShaderF16
if (mFunctions.IsGLExtensionSupported("GL_AMD_gpu_shader_half_float")) {
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
EnableFeature(Feature::ShaderF16);
}
}
@ -226,9 +226,8 @@ ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor*
return Device::Create(this, descriptor, mFunctions, std::move(context), deviceToggles);
}
MaybeError Adapter::ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceToggles) {
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const {
return {};
}
} // namespace dawn::native::opengl

View File

@ -39,9 +39,8 @@ class Adapter : public AdapterBase {
void InitializeSupportedFeaturesImpl() override;
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
MaybeError ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceTogglesState) override;
MaybeError ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const override;
void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override;
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(const DeviceDescriptor* descriptor,

View File

@ -186,35 +186,35 @@ MaybeError Adapter::InitializeImpl() {
void Adapter::InitializeSupportedFeaturesImpl() {
// Initialize supported extensions
if (mDeviceInfo.features.textureCompressionBC == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC);
EnableFeature(Feature::TextureCompressionBC);
}
if (mDeviceInfo.features.textureCompressionETC2 == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionETC2);
EnableFeature(Feature::TextureCompressionETC2);
}
if (mDeviceInfo.features.textureCompressionASTC_LDR == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::TextureCompressionASTC);
EnableFeature(Feature::TextureCompressionASTC);
}
if (mDeviceInfo.features.pipelineStatisticsQuery == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::PipelineStatisticsQuery);
EnableFeature(Feature::PipelineStatisticsQuery);
}
// TODO(dawn:1559) Resolving timestamp queries after a render pass is failing on Qualcomm-based
// Android devices.
if (mDeviceInfo.properties.limits.timestampComputeAndGraphics == VK_TRUE &&
!IsAndroidQualcomm()) {
mSupportedFeatures.EnableFeature(Feature::TimestampQuery);
mSupportedFeatures.EnableFeature(Feature::TimestampQueryInsidePasses);
EnableFeature(Feature::TimestampQuery);
EnableFeature(Feature::TimestampQueryInsidePasses);
}
if (IsDepthStencilFormatSupported(VK_FORMAT_D32_SFLOAT_S8_UINT)) {
mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8);
EnableFeature(Feature::Depth32FloatStencil8);
}
if (mDeviceInfo.features.drawIndirectFirstInstance == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance);
EnableFeature(Feature::IndirectFirstInstance);
}
if (mDeviceInfo.HasExt(DeviceExt::ShaderFloat16Int8) &&
@ -223,7 +223,7 @@ void Adapter::InitializeSupportedFeaturesImpl() {
mDeviceInfo._16BitStorageFeatures.storageBuffer16BitAccess == VK_TRUE &&
mDeviceInfo._16BitStorageFeatures.storageInputOutput16 == VK_TRUE &&
mDeviceInfo._16BitStorageFeatures.uniformAndStorageBuffer16BitAccess == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
EnableFeature(Feature::ShaderF16);
}
if (mDeviceInfo.HasExt(DeviceExt::ShaderIntegerDotProduct) &&
@ -231,14 +231,14 @@ void Adapter::InitializeSupportedFeaturesImpl() {
.integerDotProduct4x8BitPackedSignedAccelerated == VK_TRUE &&
mDeviceInfo.shaderIntegerDotProductProperties
.integerDotProduct4x8BitPackedUnsignedAccelerated == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::ChromiumExperimentalDp4a);
EnableFeature(Feature::ChromiumExperimentalDp4a);
}
// unclippedDepth=true translates to depthClipEnable=false, depthClamp=true
if (mDeviceInfo.features.depthClamp == VK_TRUE &&
mDeviceInfo.HasExt(DeviceExt::DepthClipEnable) &&
mDeviceInfo.depthClipEnableFeatures.depthClipEnable == VK_TRUE) {
mSupportedFeatures.EnableFeature(Feature::DepthClipControl);
EnableFeature(Feature::DepthClipControl);
}
VkFormatProperties rg11b10Properties;
@ -248,20 +248,20 @@ void Adapter::InitializeSupportedFeaturesImpl() {
if (IsSubset(static_cast<VkFormatFeatureFlags>(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT),
rg11b10Properties.optimalTilingFeatures)) {
mSupportedFeatures.EnableFeature(Feature::RG11B10UfloatRenderable);
EnableFeature(Feature::RG11B10UfloatRenderable);
}
VkFormatProperties bgra8unormProperties;
mVulkanInstance->GetFunctions().GetPhysicalDeviceFormatProperties(
mPhysicalDevice, VK_FORMAT_B8G8R8A8_UNORM, &bgra8unormProperties);
if (bgra8unormProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) {
mSupportedFeatures.EnableFeature(Feature::BGRA8UnormStorage);
EnableFeature(Feature::BGRA8UnormStorage);
}
#if DAWN_PLATFORM_IS(ANDROID) || DAWN_PLATFORM_IS(CHROMEOS)
// TODO(chromium:1258986): Precisely enable the feature by querying the device's format
// features.
mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats);
EnableFeature(Feature::MultiPlanarFormats);
#endif // DAWN_PLATFORM_IS(ANDROID) || DAWN_PLATFORM_IS(CHROMEOS)
}
@ -460,9 +460,8 @@ ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor*
return Device::Create(this, descriptor, deviceToggles);
}
MaybeError Adapter::ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceToggles) {
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const {
return {};
}

View File

@ -49,9 +49,8 @@ class Adapter : public AdapterBase {
void InitializeSupportedFeaturesImpl() override;
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
MaybeError ValidateFeatureSupportedWithDeviceTogglesImpl(
wgpu::FeatureName feature,
const TogglesState& deviceToggles) override;
MaybeError ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const override;
void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override;
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(const DeviceDescriptor* descriptor,

View File

@ -64,7 +64,7 @@ TEST_F(FeatureTests, AdapterWithRequiredFeatureDisabled) {
// Test that the adapter with unsafe apis disallowed validate features as expected.
{
mAdapterBase.SetSupportedFeatures(featureNamesWithoutOne);
mAdapterBase.SetSupportedFeaturesForTesting(featureNamesWithoutOne);
dawn::native::Adapter adapterWithoutFeature(&mAdapterBase);
wgpu::DeviceDescriptor deviceDescriptor;
@ -79,7 +79,7 @@ TEST_F(FeatureTests, AdapterWithRequiredFeatureDisabled) {
// Test that the adapter with unsafe apis allowed validate features as expected.
{
mUnsafeAdapterBase.SetSupportedFeatures(featureNamesWithoutOne);
mUnsafeAdapterBase.SetSupportedFeaturesForTesting(featureNamesWithoutOne);
dawn::native::Adapter adapterWithoutFeature(&mUnsafeAdapterBase);
wgpu::DeviceDescriptor deviceDescriptor;