Commit 4e5a50b6 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Drop dependency to VK_EXT_shader_atomic_float

This VK extension exposes features that are not necessary for GL_OES_shader_image_atomic. Instead, support for necessary features for VK_FORMAT_R32_SFLOAT is used to determine support for this GL extension. Bug: angleproject:5342 Change-Id: Ia504cba69ffe51cfd7da69df28f58563cb1f0744 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2536908 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarMohan Maiya <m.maiya@samsung.com>
parent 777749aa
...@@ -347,14 +347,6 @@ struct FeaturesVk : FeatureSetBase ...@@ -347,14 +347,6 @@ struct FeaturesVk : FeatureSetBase
"and has the shaderFloat16 feature", "and has the shaderFloat16 feature",
&members, "http://anglebug.com/4551"}; &members, "http://anglebug.com/4551"};
// Whether the VkDevice supports the VK_EXT_shader_atomic_flat extension and has the
// shaderImageFloat32Atomics feature
Feature supportsShaderImageFloat32Atomics = {
"supportsShaderImageFloat32Atomics", FeatureCategory::VulkanFeatures,
"VkDevice supports the VK_EXT_shader_atomic_float extension and has the "
"shaderImageFloat32Atomics feature.",
&members, "http://anglebug.com/3578"};
// Some devices don't meet the limits required to perform mipmap generation using the built-in // Some devices don't meet the limits required to perform mipmap generation using the built-in
// compute shader. On some other devices, VK_IMAGE_USAGE_STORAGE_BIT is detrimental to // compute shader. On some other devices, VK_IMAGE_USAGE_STORAGE_BIT is detrimental to
// performance, making this solution impractical. // performance, making this solution impractical.
......
...@@ -950,10 +950,6 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic ...@@ -950,10 +950,6 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
mShaderFloat16Int8Features.sType = mShaderFloat16Int8Features.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES;
mShaderAtomicFloatFeature = {};
mShaderAtomicFloatFeature.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT;
mDepthStencilResolveProperties = {}; mDepthStencilResolveProperties = {};
mDepthStencilResolveProperties.sType = mDepthStencilResolveProperties.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES;
...@@ -1029,12 +1025,6 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic ...@@ -1029,12 +1025,6 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
vk::AddToPNextChain(&deviceFeatures, &mShaderFloat16Int8Features); vk::AddToPNextChain(&deviceFeatures, &mShaderFloat16Int8Features);
} }
// Query shader atomic float features
if (ExtensionFound(VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME, deviceExtensionNames))
{
vk::AddToPNextChain(&deviceFeatures, &mShaderAtomicFloatFeature);
}
// Query depth/stencil resolve properties // Query depth/stencil resolve properties
if (ExtensionFound(VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, deviceExtensionNames)) if (ExtensionFound(VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, deviceExtensionNames))
{ {
...@@ -1079,7 +1069,6 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic ...@@ -1079,7 +1069,6 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
mSubgroupProperties.pNext = nullptr; mSubgroupProperties.pNext = nullptr;
mExternalMemoryHostProperties.pNext = nullptr; mExternalMemoryHostProperties.pNext = nullptr;
mShaderFloat16Int8Features.pNext = nullptr; mShaderFloat16Int8Features.pNext = nullptr;
mShaderAtomicFloatFeature.pNext = nullptr;
mDepthStencilResolveProperties.pNext = nullptr; mDepthStencilResolveProperties.pNext = nullptr;
mSamplerYcbcrConversionFeatures.pNext = nullptr; mSamplerYcbcrConversionFeatures.pNext = nullptr;
} }
...@@ -1439,12 +1428,6 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF ...@@ -1439,12 +1428,6 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
vk::AddToPNextChain(&createInfo, &mShaderFloat16Int8Features); vk::AddToPNextChain(&createInfo, &mShaderFloat16Int8Features);
} }
if (getFeatures().supportsShaderImageFloat32Atomics.enabled)
{
enabledDeviceExtensions.push_back(VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME);
vk::AddToPNextChain(&createInfo, &mShaderAtomicFloatFeature);
}
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.queueCreateInfoCount = 1; createInfo.queueCreateInfoCount = 1;
...@@ -1951,9 +1934,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk, ...@@ -1951,9 +1934,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
ANGLE_FEATURE_CONDITION(&mFeatures, supportsShaderFloat16, ANGLE_FEATURE_CONDITION(&mFeatures, supportsShaderFloat16,
mShaderFloat16Int8Features.shaderFloat16 == VK_TRUE); mShaderFloat16Int8Features.shaderFloat16 == VK_TRUE);
ANGLE_FEATURE_CONDITION(&mFeatures, supportsShaderImageFloat32Atomics,
mShaderAtomicFloatFeature.shaderImageFloat32Atomics == VK_TRUE);
// http://issuetracker.google.com/173636783 Qualcomm driver appears having issues with // http://issuetracker.google.com/173636783 Qualcomm driver appears having issues with
// specialization constant // specialization constant
ANGLE_FEATURE_CONDITION(&mFeatures, forceDriverUniformOverSpecConst, ANGLE_FEATURE_CONDITION(&mFeatures, forceDriverUniformOverSpecConst,
......
...@@ -380,7 +380,6 @@ class RendererVk : angle::NonCopyable ...@@ -380,7 +380,6 @@ class RendererVk : angle::NonCopyable
VkPhysicalDeviceSubgroupProperties mSubgroupProperties; VkPhysicalDeviceSubgroupProperties mSubgroupProperties;
VkPhysicalDeviceExternalMemoryHostPropertiesEXT mExternalMemoryHostProperties; VkPhysicalDeviceExternalMemoryHostPropertiesEXT mExternalMemoryHostProperties;
VkPhysicalDeviceShaderFloat16Int8FeaturesKHR mShaderFloat16Int8Features; VkPhysicalDeviceShaderFloat16Int8FeaturesKHR mShaderFloat16Int8Features;
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT mShaderAtomicFloatFeature;
VkPhysicalDeviceDepthStencilResolvePropertiesKHR mDepthStencilResolveProperties; VkPhysicalDeviceDepthStencilResolvePropertiesKHR mDepthStencilResolveProperties;
VkExternalFenceProperties mExternalFenceProperties; VkExternalFenceProperties mExternalFenceProperties;
VkExternalSemaphoreProperties mExternalSemaphoreProperties; VkExternalSemaphoreProperties mExternalSemaphoreProperties;
......
...@@ -31,6 +31,25 @@ namespace vk ...@@ -31,6 +31,25 @@ namespace vk
{ {
namespace namespace
{ {
bool HasShaderImageAtomicsSupport(const RendererVk *rendererVk,
const gl::Extensions &supportedExtensions)
{
// Only VK_FORMAT_R32_SFLOAT doesn't have mandatory support for the STORAGE_IMAGE_ATOMIC and
// STORAGE_TEXEL_BUFFER_ATOMIC features.
const vk::Format &formatVk = rendererVk->getFormat(GL_R32F);
const bool hasImageAtomicSupport = rendererVk->hasImageFormatFeatureBits(
formatVk.vkImageFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT);
bool hasBufferAtomicSupport = true;
if (supportedExtensions.textureBufferAny())
{
hasBufferAtomicSupport = rendererVk->hasBufferFormatFeatureBits(
formatVk.vkBufferFormat, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT);
}
return hasImageAtomicSupport && hasBufferAtomicSupport;
}
bool FormatReinterpretationSupported(const std::vector<GLenum> &optionalSizedFormats, bool FormatReinterpretationSupported(const std::vector<GLenum> &optionalSizedFormats,
const RendererVk *rendererVk, const RendererVk *rendererVk,
bool checkLinearColorspace) bool checkLinearColorspace)
...@@ -460,13 +479,6 @@ void RendererVk::ensureCapsInitialized() const ...@@ -460,13 +479,6 @@ void RendererVk::ensureCapsInitialized() const
mNativeExtensions.sampleVariablesOES = mNativeExtensions.sampleVariablesOES =
supportSampleRateShading && (vk_gl::GetMaxSampleCount(kNotSupportedSampleCounts) == 0); supportSampleRateShading && (vk_gl::GetMaxSampleCount(kNotSupportedSampleCounts) == 0);
// Atomic image operations in the vertex and fragment shaders require the
// vertexPipelineStoresAndAtomics and fragmentStoresAndAtomics Vulkan features respectively.
// If either of these features is not present, the number of image uniforms for that stage is
// advertized as zero, so image atomic operations support can be agnostic of shader stages.
mNativeExtensions.shaderImageAtomicOES =
getFeatures().supportsShaderImageFloat32Atomics.enabled;
// https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html // https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html
mNativeCaps.maxElementIndex = std::numeric_limits<GLuint>::max() - 1; mNativeCaps.maxElementIndex = std::numeric_limits<GLuint>::max() - 1;
mNativeCaps.max3DTextureSize = LimitToInt(limitsVk.maxImageDimension3D); mNativeCaps.max3DTextureSize = LimitToInt(limitsVk.maxImageDimension3D);
...@@ -840,6 +852,19 @@ void RendererVk::ensureCapsInitialized() const ...@@ -840,6 +852,19 @@ void RendererVk::ensureCapsInitialized() const
LimitToInt(limitsVk.minTexelBufferOffsetAlignment); LimitToInt(limitsVk.minTexelBufferOffsetAlignment);
} }
// Atomic image operations in the vertex and fragment shaders require the
// vertexPipelineStoresAndAtomics and fragmentStoresAndAtomics Vulkan features respectively.
// If either of these features is not present, the number of image uniforms for that stage is
// advertized as zero, so image atomic operations support can be agnostic of shader stages.
//
// GL_OES_shader_image_atomic requires that image atomic functions have support for r32i and
// r32ui formats. These formats have mandatory support for STORAGE_IMAGE_ATOMIC and
// STORAGE_TEXEL_BUFFER_ATOMIC features in Vulkan. Additionally, it requires that
// imageAtomicExchange supports r32f. Exposing this extension is thus restricted to this format
// having support for the aforementioned features.
mNativeExtensions.shaderImageAtomicOES =
vk::HasShaderImageAtomicsSupport(this, mNativeExtensions);
// Geometry shader is optional. // Geometry shader is optional.
if (mPhysicalDeviceFeatures.geometryShader) if (mPhysicalDeviceFeatures.geometryShader)
{ {
......
...@@ -317,6 +317,9 @@ ...@@ -317,6 +317,9 @@
5276 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.compressed.viewclass_etc* = FAIL 5276 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.compressed.viewclass_etc* = FAIL
5276 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.mixed.*eac* = FAIL 5276 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.mixed.*eac* = FAIL
// imageAtomicExchange failure with r32f format
5353 NVIDIA VULKAN : dEQP-GLES31.functional.image_load_store.*.atomic.exchange_r32f* = FAIL
// Vulkan Android failures with these formats // Vulkan Android failures with these formats
5277 VULKAN ANDROID : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgba8_snorm_rgb10_a2* = FAIL 5277 VULKAN ANDROID : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgba8_snorm_rgb10_a2* = FAIL
5277 VULKAN ANDROID : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgba8_snorm_rgb9_e5* = FAIL 5277 VULKAN ANDROID : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgba8_snorm_rgb9_e5* = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment