Validation fix for dEQP-VK.ssbo
authorMaciej Jesionowski <maciej.jesionowski@mobica.com>
Mon, 25 Apr 2016 11:43:37 +0000 (13:43 +0200)
committerPyry Haulos <phaulos@google.com>
Thu, 19 May 2016 21:48:56 +0000 (14:48 -0700)
Fixed an issue where descriptor set bindings were updated incorrectly
(array of descriptors vs a few bindings of a single descriptor).

(cherry picked from commit 517e989710e57ac0008c0ea26bafb67418e52610)

external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutCase.cpp

index ed1ca88..ca02de0 100644 (file)
@@ -1925,9 +1925,6 @@ tcu::TestStatus SSBOLayoutCaseInstance::iterate (void)
                                m_uniformBuffers.push_back(VkBufferSp(new vk::Unique<vk::VkBuffer>(buffer)));
                                m_uniformAllocs.push_back(AllocationSp(alloc.release()));
                        }
-
-                       setUpdateBuilder.writeArray(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(1),
-                                                                               vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, numBlocks, &descriptors[0]);
                }
                else
                {
@@ -1963,13 +1960,25 @@ tcu::TestStatus SSBOLayoutCaseInstance::iterate (void)
                                descriptors[blockNdx] = makeDescriptorBufferInfo(*buffer, offset, bufferSize);
                        }
 
-                       setUpdateBuilder.writeArray(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(1),
-                                                                               vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, numBlocks, &descriptors[0]);
-
                        m_uniformBuffers.push_back(VkBufferSp(new vk::Unique<vk::VkBuffer>(buffer)));
                        m_uniformAllocs.push_back(AllocationSp(alloc.release()));
                }
 
+               // Update remaining bindings
+               {
+                       int blockNdx = 0;
+                       for (int bindingNdx = 0; bindingNdx < numBindings; ++bindingNdx)
+                       {
+                               const BufferBlock&      block                           = m_interface.getBlock(bindingNdx);
+                               const int                       numBlocksInBinding      = (block.isArray() ? block.getArraySize() : 1);
+
+                               setUpdateBuilder.writeArray(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(bindingNdx + 1),
+                                       vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, numBlocksInBinding, &descriptors[blockNdx]);
+
+                               blockNdx += numBlocksInBinding;
+                       }
+               }
+
                // Copy the initial data to the storage buffers
                {
                        mappedBlockPtrs = blockLocationsToPtrs(m_refLayout, blockLocations, mapPtrs);