From ffc4927c1ceaec788fe190e2120a376de6a5544a Mon Sep 17 00:00:00 2001 From: Graeme Leese Date: Tue, 5 Nov 2019 12:56:45 +0000 Subject: [PATCH] Enable storage image tests for more formats On implementations that don't support the whole ExtendedFormat set, tests that used any format from that set would return NotSupported. Changing this to checking the actual format for storage image support allows us still to run these tests on implementations where they're supported. Component: Vulkan VK-GL-CTS issue: 2090 Affects: dEQP-VK.image.mutable.* dEQP-VK.image.texel_view_compatible.* dEQP-VK.synchronization.* Change-Id: I7de9c0bde1613d2cc1fc9f8490955c580a1939c1 --- .../vktImageCompressionTranscodingSupport.cpp | 10 +++-- .../modules/vulkan/image/vktImageLoadStoreUtil.cpp | 34 ---------------- .../modules/vulkan/image/vktImageLoadStoreUtil.hpp | 1 - .../modules/vulkan/image/vktImageMutableTests.cpp | 7 ---- .../vktSynchronizationOperation.cpp | 45 ++-------------------- .../synchronization/vktSynchronizationUtil.cpp | 8 +++- .../synchronization/vktSynchronizationUtil.hpp | 2 +- 7 files changed, 17 insertions(+), 90 deletions(-) diff --git a/external/vulkancts/modules/vulkan/image/vktImageCompressionTranscodingSupport.cpp b/external/vulkancts/modules/vulkan/image/vktImageCompressionTranscodingSupport.cpp index 6f5a7b8..8f696bb 100644 --- a/external/vulkancts/modules/vulkan/image/vktImageCompressionTranscodingSupport.cpp +++ b/external/vulkancts/modules/vulkan/image/vktImageCompressionTranscodingSupport.cpp @@ -2882,10 +2882,12 @@ void TexelViewCompatibleCase::checkSupport (Context& context) const !physicalDeviceFeatures.textureCompressionASTC_LDR) TCU_THROW(NotSupportedError, "textureCompressionASTC_LDR not supported"); - if ((m_parameters.uncompressedImageUsage & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) && - isStorageImageExtendedFormat(m_parameters.formatUncompressed) && - !physicalDeviceFeatures.shaderStorageImageExtendedFormats) - TCU_THROW(NotSupportedError, "Storage view format requires shaderStorageImageExtended"); + if (m_parameters.uncompressedImageUsage & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) + { + const VkFormatProperties p = getPhysicalDeviceFormatProperties(vk, physicalDevice, m_parameters.formatUncompressed); + if ((p.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) == 0) + TCU_THROW(NotSupportedError, "Storage view format not supported"); + } } } diff --git a/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.cpp b/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.cpp index c5cbd40..a92f45c 100644 --- a/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.cpp +++ b/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.cpp @@ -112,40 +112,6 @@ VkDeviceSize getOptimalUniformBufferChunkSize (const InstanceInterface& vki, con return alignment; } -bool isStorageImageExtendedFormat (const vk::VkFormat format) -{ - switch (format) - { - case VK_FORMAT_R32G32_SFLOAT: - case VK_FORMAT_R32G32_SINT: - case VK_FORMAT_R32G32_UINT: - case VK_FORMAT_R16G16B16A16_UNORM: - case VK_FORMAT_R16G16B16A16_SNORM: - case VK_FORMAT_R16G16_SFLOAT: - case VK_FORMAT_R16G16_UNORM: - case VK_FORMAT_R16G16_SNORM: - case VK_FORMAT_R16G16_SINT: - case VK_FORMAT_R16G16_UINT: - case VK_FORMAT_R16_SFLOAT: - case VK_FORMAT_R16_UNORM: - case VK_FORMAT_R16_SNORM: - case VK_FORMAT_R16_SINT: - case VK_FORMAT_R16_UINT: - case VK_FORMAT_R8G8_UNORM: - case VK_FORMAT_R8G8_SNORM: - case VK_FORMAT_R8G8_SINT: - case VK_FORMAT_R8G8_UINT: - case VK_FORMAT_R8_UNORM: - case VK_FORMAT_R8_SNORM: - case VK_FORMAT_R8_SINT: - case VK_FORMAT_R8_UINT: - return true; - - default: - return false; - } -} - bool isRepresentableIntegerValue (tcu::Vector value, tcu::TextureFormat format) { const tcu::IVec4 formatBitDepths = tcu::getTextureFormatBitDepth(format); diff --git a/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.hpp b/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.hpp index 6a941e0..24e8fd0 100644 --- a/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.hpp +++ b/external/vulkancts/modules/vulkan/image/vktImageLoadStoreUtil.hpp @@ -72,7 +72,6 @@ float computeStoreColorScale (const vk::VkFormat format, const tcu::IVec3 ImageType getImageTypeForSingleLayer (const ImageType imageType); vk::VkImageCreateInfo makeImageCreateInfo (const Texture& texture, const vk::VkFormat format, const vk::VkImageUsageFlags usage, const vk::VkImageCreateFlags flags); vk::VkDeviceSize getOptimalUniformBufferChunkSize (const vk::InstanceInterface& vki, const vk::VkPhysicalDevice physDevice, vk::VkDeviceSize minimumRequiredChunkSizeBytes); -bool isStorageImageExtendedFormat (const vk::VkFormat format); bool isRepresentableIntegerValue (const tcu::Vector value, tcu::TextureFormat format); } // image diff --git a/external/vulkancts/modules/vulkan/image/vktImageMutableTests.cpp b/external/vulkancts/modules/vulkan/image/vktImageMutableTests.cpp index 0cac4d8..53be1fa 100644 --- a/external/vulkancts/modules/vulkan/image/vktImageMutableTests.cpp +++ b/external/vulkancts/modules/vulkan/image/vktImageMutableTests.cpp @@ -1696,13 +1696,6 @@ void checkSupport (Context& context, const CaseDef caseDef) break; } - if ((viewFormatFeatureFlags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) && - isStorageImageExtendedFormat(caseDef.viewFormat) && - !getPhysicalDeviceFeatures(vki, physDevice).shaderStorageImageExtendedFormats) - { - TCU_THROW(NotSupportedError, "View format requires shaderStorageImageExtended"); - } - if ((viewFormatProps.optimalTilingFeatures & viewFormatFeatureFlags) != viewFormatFeatureFlags) TCU_THROW(NotSupportedError, "View format doesn't support upload/download method"); diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperation.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperation.cpp index 5cfbc30..aebfbce 100644 --- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperation.cpp +++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperation.cpp @@ -386,41 +386,6 @@ void clearPixelBuffer (tcu::PixelBufferAccess& pixels, const VkClearValue& clear } } -//! Storage image format that requires StorageImageExtendedFormats SPIR-V capability (listed only Vulkan-defined formats). -bool isStorageImageExtendedFormat (const VkFormat format) -{ - switch (format) - { - case VK_FORMAT_R32G32_SFLOAT: - case VK_FORMAT_R32G32_SINT: - case VK_FORMAT_R32G32_UINT: - case VK_FORMAT_R16G16B16A16_UNORM: - case VK_FORMAT_R16G16B16A16_SNORM: - case VK_FORMAT_R16G16_SFLOAT: - case VK_FORMAT_R16G16_UNORM: - case VK_FORMAT_R16G16_SNORM: - case VK_FORMAT_R16G16_SINT: - case VK_FORMAT_R16G16_UINT: - case VK_FORMAT_R16_SFLOAT: - case VK_FORMAT_R16_UNORM: - case VK_FORMAT_R16_SNORM: - case VK_FORMAT_R16_SINT: - case VK_FORMAT_R16_UINT: - case VK_FORMAT_R8G8_UNORM: - case VK_FORMAT_R8G8_SNORM: - case VK_FORMAT_R8G8_SINT: - case VK_FORMAT_R8G8_UINT: - case VK_FORMAT_R8_UNORM: - case VK_FORMAT_R8_SNORM: - case VK_FORMAT_R8_SINT: - case VK_FORMAT_R8_UINT: - return true; - - default: - return false; - } -} - VkImageViewType getImageViewType (const VkImageType imageType) { switch (imageType) @@ -1723,9 +1688,8 @@ public: // Image stores are always required, in either access mode. requireFeaturesForSSBOAccess(m_context, m_stage); - // Some storage image formats require additional capability. - if (isStorageImageExtendedFormat(m_resource.getImage().format)) - requireFeatures(vki, physDevice, FEATURE_SHADER_STORAGE_IMAGE_EXTENDED_FORMATS); + // Some storage image formats may not be supported + requireStorageImageSupport(vki, physDevice, m_resource.getImage().format); m_hostBuffer = de::MovePtr(new Buffer( vk, device, allocator, makeBufferCreateInfo(m_hostBufferSizeBytes, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT), @@ -2468,9 +2432,8 @@ public: // Image stores are always required, in either access mode. requireFeaturesForSSBOAccess(m_context, m_stage); - // Some storage image formats require additional capability. - if (isStorageImageExtendedFormat(m_inResource.getImage().format)) - requireFeatures(vki, physDevice, FEATURE_SHADER_STORAGE_IMAGE_EXTENDED_FORMATS); + // Some storage image formats may not be supported + requireStorageImageSupport(vki, physDevice, m_inResource.getImage().format); // Image resources { diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp index a3f594f..f703185 100644 --- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp +++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp @@ -395,9 +395,13 @@ void requireFeatures (const InstanceInterface& vki, const VkPhysicalDevice physD if (((flags & FEATURE_SHADER_TESSELLATION_AND_GEOMETRY_POINT_SIZE) != 0) && !features.shaderTessellationAndGeometryPointSize) throw tcu::NotSupportedError("Tessellation and geometry shaders don't support PointSize built-in"); +} - if (((flags & FEATURE_SHADER_STORAGE_IMAGE_EXTENDED_FORMATS) != 0) && !features.shaderStorageImageExtendedFormats) - throw tcu::NotSupportedError("Storage image extended formats not supported"); +void requireStorageImageSupport(const InstanceInterface& vki, const VkPhysicalDevice physDevice, const VkFormat fmt) +{ + const VkFormatProperties p = getPhysicalDeviceFormatProperties(vki, physDevice, fmt); + if ((p.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) == 0) + throw tcu::NotSupportedError("Storage image format not supported"); } std::string getResourceName (const ResourceDescription& resource) diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.hpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.hpp index fb95a8d..df0bf02 100644 --- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.hpp +++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.hpp @@ -176,7 +176,6 @@ enum FeatureFlagBits FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS = 1u << 3, FEATURE_FRAGMENT_STORES_AND_ATOMICS = 1u << 4, FEATURE_SHADER_TESSELLATION_AND_GEOMETRY_POINT_SIZE = 1u << 5, - FEATURE_SHADER_STORAGE_IMAGE_EXTENDED_FORMATS = 1u << 6, }; typedef deUint32 FeatureFlags; @@ -229,6 +228,7 @@ vk::Move makeCommandBuffer (const vk::DeviceInterface vk::Move makeComputePipeline (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkPipelineLayout pipelineLayout, const vk::VkShaderModule shaderModule, const vk::VkSpecializationInfo* specInfo, PipelineCacheData& pipelineCacheData); void beginRenderPassWithRasterizationDisabled (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const vk::VkFramebuffer framebuffer); void requireFeatures (const vk::InstanceInterface& vki, const vk::VkPhysicalDevice physDevice, const FeatureFlags flags); +void requireStorageImageSupport (const vk::InstanceInterface& vki, const vk::VkPhysicalDevice physDevice, const vk::VkFormat fmt); std::string getResourceName (const ResourceDescription& resource); bool isIndirectBuffer (const ResourceType type); -- 2.7.4