diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp index 73286e08aa..a60e900553 100644 --- a/src/dawn/native/Adapter.cpp +++ b/src/dawn/native/Adapter.cpp @@ -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& requiredFeatures) { + mSupportedFeatures = {}; + for (wgpu::FeatureName f : requiredFeatures) { + mSupportedFeatures.EnableFeature(f); + } } ResultOrError> AdapterBase::CreateDeviceInternal( @@ -285,7 +296,7 @@ ResultOrError> 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) { diff --git a/src/dawn/native/Adapter.h b/src/dawn/native/Adapter.h index 08e0f234e9..9d0eb7c2c6 100644 --- a/src/dawn/native/Adapter.h +++ b/src/dawn/native/Adapter.h @@ -16,6 +16,7 @@ #define SRC_DAWN_NATIVE_ADAPTER_H_ #include +#include #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& 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> 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; }; diff --git a/src/dawn/native/d3d12/AdapterD3D12.cpp b/src/dawn/native/d3d12/AdapterD3D12.cpp index faecfe0985..d56ef2f27b 100644 --- a/src/dawn/native/d3d12/AdapterD3D12.cpp +++ b/src/dawn/native/d3d12/AdapterD3D12.cpp @@ -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 {}; diff --git a/src/dawn/native/d3d12/AdapterD3D12.h b/src/dawn/native/d3d12/AdapterD3D12.h index 8b46f7f6a7..63b0ae6547 100644 --- a/src/dawn/native/d3d12/AdapterD3D12.h +++ b/src/dawn/native/d3d12/AdapterD3D12.h @@ -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(); diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm index bc4438d816..2e9e5de872 100644 --- a/src/dawn/native/metal/BackendMTL.mm +++ b/src/dawn/native/metal/BackendMTL.mm @@ -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 {}; } diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp index 9827bdf267..897e0a0189 100644 --- a/src/dawn/native/null/DeviceNull.cpp +++ b/src/dawn/native/null/DeviceNull.cpp @@ -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& 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(Feature::EnumCount); i++) { + EnableFeature(static_cast(i)); + } } MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { @@ -79,9 +73,8 @@ ResultOrError> 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 {}; } diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h index d5ea66f5bc..402b155f65 100644 --- a/src/dawn/native/null/DeviceNull.h +++ b/src/dawn/native/null/DeviceNull.h @@ -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& 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> CreateDeviceImpl(const DeviceDescriptor* descriptor, diff --git a/src/dawn/native/opengl/AdapterGL.cpp b/src/dawn/native/opengl/AdapterGL.cpp index 4bffcf6840..afd75b4d6d 100644 --- a/src/dawn/native/opengl/AdapterGL.cpp +++ b/src/dawn/native/opengl/AdapterGL.cpp @@ -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> 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 diff --git a/src/dawn/native/opengl/AdapterGL.h b/src/dawn/native/opengl/AdapterGL.h index 22b47f0877..7f43ce0486 100644 --- a/src/dawn/native/opengl/AdapterGL.h +++ b/src/dawn/native/opengl/AdapterGL.h @@ -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> CreateDeviceImpl(const DeviceDescriptor* descriptor, diff --git a/src/dawn/native/vulkan/AdapterVk.cpp b/src/dawn/native/vulkan/AdapterVk.cpp index d29136a7cb..d6a61dcd0b 100644 --- a/src/dawn/native/vulkan/AdapterVk.cpp +++ b/src/dawn/native/vulkan/AdapterVk.cpp @@ -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(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> 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 {}; } diff --git a/src/dawn/native/vulkan/AdapterVk.h b/src/dawn/native/vulkan/AdapterVk.h index ebdbfcb150..0b8226a26a 100644 --- a/src/dawn/native/vulkan/AdapterVk.h +++ b/src/dawn/native/vulkan/AdapterVk.h @@ -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> CreateDeviceImpl(const DeviceDescriptor* descriptor, diff --git a/src/dawn/tests/unittests/FeatureTests.cpp b/src/dawn/tests/unittests/FeatureTests.cpp index f879225b2d..8153c20777 100644 --- a/src/dawn/tests/unittests/FeatureTests.cpp +++ b/src/dawn/tests/unittests/FeatureTests.cpp @@ -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;