Use only required buffer usage bit in robustness tests
authorziga-lunarg <ziga@lunarg.com>
Sat, 17 Sep 2022 19:25:08 +0000 (21:25 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 6 Oct 2022 15:47:10 +0000 (15:47 +0000)
Using all bits requires additional checks for format support

Components: Vulkan

VK-GL-CTS issue: 3959

Affected tests:
dEQP-VK.robustness.*

Change-Id: I7a7c9e338b1e38a2d028f1fcffd6196bb75fa285

external/vulkancts/modules/vulkan/robustness/vktRobustnessExtsTests.cpp

index 660aca4..7e81c45 100644 (file)
@@ -1719,15 +1719,26 @@ tcu::TestStatus RobustnessExtsTestInstance::iterate (void)
                        (VkDeviceSize)(m_data.bufferLen ? m_data.bufferLen : 1),
                        (VkDeviceSize)256);
 
+               VkBufferUsageFlags usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
                if (m_data.descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER ||
                        m_data.descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
                {
                        size = deIntRoundToPow2((int)size, (int)robustness2Properties.robustUniformBufferAccessSizeAlignment);
+                       usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
                }
                else if (m_data.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ||
                                 m_data.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)
                {
                        size = deIntRoundToPow2((int)size, (int)robustness2Properties.robustStorageBufferAccessSizeAlignment);
+                       usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
+               }
+               else if (m_data.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
+               {
+                       usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
+               }
+               else if (m_data.descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER)
+               {
+                       usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
                }
                else if (m_data.descriptorType == VERTEX_ATTRIBUTE_FETCH)
                {
@@ -1735,13 +1746,7 @@ tcu::TestStatus RobustnessExtsTestInstance::iterate (void)
                }
 
                buffer = de::MovePtr<BufferWithMemory>(new BufferWithMemory(
-                       vk, device, allocator, makeBufferCreateInfo(size,
-                                                                                                               VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
-                                                                                                               VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
-                                                                                                               VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT |
-                                                                                                               VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT |
-                                                                                                               VK_BUFFER_USAGE_VERTEX_BUFFER_BIT),
-                                                                                                               MemoryRequirement::HostVisible));
+                       vk, device, allocator, makeBufferCreateInfo(size, usage), MemoryRequirement::HostVisible));
                bufferPtr = (deUint8 *)buffer->getAllocation().getHostPtr();
 
                deMemset(bufferPtr, 0x3f, (size_t)size);