Correct vertex input tests on null driver
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Thu, 25 Oct 2018 14:50:20 +0000 (16:50 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 1 Nov 2018 09:49:29 +0000 (05:49 -0400)
On Null driver all features are enabled and this triggered execution
of tests for 128 vertex attributes that are not commonly supported.
Tests allocate buffer for verification which is not big enough for
128 attributes. This causes memory corruption and crash.
This change resolves those issues.

Components: Vulkan

VK-GL-CTS issue: 1443

Affects:
dEQP-VK.pipeline.vertex_input.*

Change-Id: I9a89cc62fdd34f9da40ebf9d84e6cf5b5aed07d5

external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexInputTests.cpp

index eda5fef..2fe9f5b 100644 (file)
@@ -1031,12 +1031,17 @@ VertexInputInstance::VertexInputInstance (Context&                                                                                              context,
 
        // Create vertex buffer
        {
+               // calculate buffer size
+               // 32 is maximal attribute size (4*sizeof(double)),
+               // 8 maximal vertex count used in writeVertexInputData
+               VkDeviceSize bufferSize = 32 * 8 * attributeDescriptions.size();
+
                const VkBufferCreateInfo vertexBufferParams =
                {
                        VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,           // VkStructureType              sType;
                        DE_NULL,                                                                        // const void*                  pNext;
                        0u,                                                                                     // VkBufferCreateFlags  flags;
-                       4096u,                                                                          // VkDeviceSize                 size;
+                       bufferSize,                                                                     // VkDeviceSize                 size;
                        VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,                      // VkBufferUsageFlags   usage;
                        VK_SHARING_MODE_EXCLUSIVE,                                      // VkSharingMode                sharingMode;
                        1u,                                                                                     // deUint32                             queueFamilyIndexCount;