BufferView test: check if sparseBinding feature is enabled
authorpflisiko <pawel.flisikowski@intel.com>
Thu, 10 Dec 2015 14:56:55 +0000 (15:56 +0100)
committerscygan <slawomir.cygan@intel.com>
Thu, 17 Dec 2015 13:39:40 +0000 (14:39 +0100)
external/vulkancts/modules/vulkan/api/vktApiBufferViewCreateTests.cpp

index d9a4ef7..a01adf4 100644 (file)
@@ -65,10 +65,7 @@ class BufferViewTestInstance : public TestInstance
 {
 public:
                                                                BufferViewTestInstance          (Context&                                       ctx,
-                                                                                                                        BufferViewCaseParameters       createInfo)
-                                                                       : TestInstance                  (ctx)
-                                                                       , m_testCase                    (createInfo)
-                                                               {}
+                                                                                                                        BufferViewCaseParameters       createInfo);
        virtual tcu::TestStatus         iterate                                         (void);
 
 private:
@@ -96,6 +93,15 @@ private:
        BufferViewCaseParameters        m_testCase;
 };
 
+BufferViewTestInstance::BufferViewTestInstance (Context&                                       ctx,
+                                                                                               BufferViewCaseParameters        createInfo)
+       : TestInstance  (ctx)\r
+       , m_testCase    (createInfo)
+{
+       if (m_context.getDeviceFeatures().sparseBinding == 0 && m_testCase.beforeAllocateMemory == false)\r
+               throw tcu::NotSupportedError("The test is not supported - it needs missing 'sparseBinding' feature of Vulkan");
+}
+
 tcu::TestStatus BufferViewTestInstance::iterate (void)
 {
        // Create buffer
@@ -107,14 +113,14 @@ tcu::TestStatus BufferViewTestInstance::iterate (void)
        VkMemoryRequirements            memReqs;
        const VkBufferCreateInfo        bufferParams                    =
        {
-               VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,           //      VkStructureType                 sType;
-               DE_NULL,                                                                        //      const void*                             pNext;
-               VK_BUFFER_CREATE_SPARSE_BINDING_BIT,            //      VkBufferCreateFlags             flags;
-               size,                                                                           //      VkDeviceSize                    size;
-               m_testCase.usage,                                                       //      VkBufferUsageFlags              usage;
-               VK_SHARING_MODE_EXCLUSIVE,                                      //      VkSharingMode                   sharingMode;
-               1u,                                                                                     //      deUint32                                queueFamilyCount;
-               &queueFamilyIndex,                                                      //      const deUint32*                 pQueueFamilyIndices;
+               VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,                                                                                                   //      VkStructureType                 sType;
+               DE_NULL,                                                                                                                                                                //      const void*                             pNext;
+               m_testCase.beforeAllocateMemory == true ? 0 : VK_BUFFER_CREATE_SPARSE_BINDING_BIT,              //      VkBufferCreateFlags             flags;
+               size,                                                                                                                                                                   //      VkDeviceSize                    size;
+               m_testCase.usage,                                                                                                                                               //      VkBufferUsageFlags              usage;
+               VK_SHARING_MODE_EXCLUSIVE,                                                                                                                              //      VkSharingMode                   sharingMode;
+               1u,                                                                                                                                                                             //      deUint32                                queueFamilyCount;
+               &queueFamilyIndex,                                                                                                                                              //      const deUint32*                 pQueueFamilyIndices;
        };
 
        if (vk.createBuffer(vkDevice, &bufferParams, (const VkAllocationCallbacks*)DE_NULL, &testBuffer) != VK_SUCCESS)