diff --git a/src/dawn_native/vulkan/AdapterVk.cpp b/src/dawn_native/vulkan/AdapterVk.cpp index 532def483f..a8f936e683 100644 --- a/src/dawn_native/vulkan/AdapterVk.cpp +++ b/src/dawn_native/vulkan/AdapterVk.cpp @@ -39,11 +39,7 @@ namespace dawn_native { namespace vulkan { MaybeError Adapter::Initialize() { DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this)); - if (!mDeviceInfo.HasExt(DeviceExt::Maintenance1)) { - return DAWN_INTERNAL_ERROR( - "Dawn requires Vulkan 1.1 or Vulkan 1.0 with KHR_Maintenance1 in order to support " - "viewport flipY"); - } + DAWN_TRY(CheckCoreWebGPUSupport()); if (mDeviceInfo.HasExt(DeviceExt::DriverProperties)) { mDriverDescription = mDeviceInfo.driverProperties.driverName; @@ -79,6 +75,42 @@ namespace dawn_native { namespace vulkan { return {}; } + MaybeError Adapter::CheckCoreWebGPUSupport() { + // Needed for viewport Y-flip. + if (!mDeviceInfo.HasExt(DeviceExt::Maintenance1)) { + return DAWN_INTERNAL_ERROR("Vulkan 1.1 or Vulkan 1.0 with KHR_Maintenance1 required."); + } + + // Needed for security + if (!mDeviceInfo.features.robustBufferAccess) { + return DAWN_INTERNAL_ERROR("Vulkan robustBufferAccess feature required."); + } + + // TODO(crbug.com/dawn/955): Require BC || (ETC && ASTC) instead. + if (!mDeviceInfo.features.textureCompressionBC) { + return DAWN_INTERNAL_ERROR("Vulkan textureCompressionBC feature required."); + } + + // Needed for the respective WebGPU features. + if (!mDeviceInfo.features.depthBiasClamp) { + return DAWN_INTERNAL_ERROR("Vulkan depthBiasClamp feature required."); + } + if (!mDeviceInfo.features.fragmentStoresAndAtomics) { + return DAWN_INTERNAL_ERROR("Vulkan fragmentStoresAndAtomics feature required."); + } + if (!mDeviceInfo.features.fullDrawIndexUint32) { + return DAWN_INTERNAL_ERROR("Vulkan fullDrawIndexUint32 feature required."); + } + if (!mDeviceInfo.features.imageCubeArray) { + return DAWN_INTERNAL_ERROR("Vulkan imageCubeArray feature required."); + } + if (!mDeviceInfo.features.independentBlend) { + return DAWN_INTERNAL_ERROR("Vulkan independentBlend feature required."); + } + + return {}; + } + void Adapter::InitializeSupportedExtensions() { if (mDeviceInfo.features.textureCompressionBC == VK_TRUE) { mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC); diff --git a/src/dawn_native/vulkan/AdapterVk.h b/src/dawn_native/vulkan/AdapterVk.h index 67f77d9c7a..94939d2572 100644 --- a/src/dawn_native/vulkan/AdapterVk.h +++ b/src/dawn_native/vulkan/AdapterVk.h @@ -37,6 +37,7 @@ namespace dawn_native { namespace vulkan { private: ResultOrError CreateDeviceImpl(const DeviceDescriptor* descriptor) override; + MaybeError CheckCoreWebGPUSupport(); void InitializeSupportedExtensions(); VkPhysicalDevice mPhysicalDevice; diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp index 8f94b169af..2f7cbad73a 100644 --- a/src/dawn_native/vulkan/DeviceVk.cpp +++ b/src/dawn_native/vulkan/DeviceVk.cpp @@ -315,14 +315,12 @@ namespace dawn_native { namespace vulkan { features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; PNextChainBuilder featuresChain(&features2); - // Always require independentBlend because it is a core Dawn feature - usedKnobs.features.independentBlend = VK_TRUE; - // Always require imageCubeArray because it is a core Dawn feature - usedKnobs.features.imageCubeArray = VK_TRUE; - // Always require fragmentStoresAndAtomics because it is required by end2end tests. - usedKnobs.features.fragmentStoresAndAtomics = VK_TRUE; - // Always require depthBiasClamp because it is a core Dawn feature + // Required for core WebGPU features. usedKnobs.features.depthBiasClamp = VK_TRUE; + usedKnobs.features.fragmentStoresAndAtomics = VK_TRUE; + usedKnobs.features.fullDrawIndexUint32 = VK_TRUE; + usedKnobs.features.imageCubeArray = VK_TRUE; + usedKnobs.features.independentBlend = VK_TRUE; if (IsRobustnessEnabled()) { usedKnobs.features.robustBufferAccess = VK_TRUE;