Fix binding issues with opaque_type_indexing tests. Descriptor layout must go through...
authorJeff Bolz <jbolz@nvidia.com>
Mon, 21 Dec 2015 08:31:44 +0000 (08:31 +0000)
committerJeff Bolz <jbolz@nvidia.com>
Mon, 21 Dec 2015 08:31:44 +0000 (08:31 +0000)
external/vulkancts/modules/vulkan/shaderexecutor/vktOpaqueTypeIndexingTests.cpp
external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp

index 2103fe5..089ed9a 100644 (file)
@@ -181,12 +181,9 @@ static deUint32 getFirstFreeBindingLocation (const glu::ShaderType shaderType, c
                case glu::SHADERTYPE_TESSELLATION_CONTROL:
                case glu::SHADERTYPE_TESSELLATION_EVALUATION:
                case glu::SHADERTYPE_COMPUTE:
-                       // 0 - output buffer
-                       // 1 - input buffer (if any)
-                       if (hasInputParam)
-                               location = 2u;
-                       else
-                               location = 1u;
+                       // 0 - input buffer
+                       // 1 - output buffer
+                       location = 2u;
                        break;
 
                default:
@@ -952,11 +949,13 @@ void BlockArrayIndexingCase::createShaderSpec (void)
                global << "const highp int indexBase = 1;\n";
 
        global <<
-               "layout(set = 0, binding = " << binding++ << ") " << interfaceName << " " << blockName << "\n"
+               "layout(set = 0, binding = " << binding << ") " << interfaceName << " " << blockName << "\n"
                "{\n"
                "       highp uint value;\n"
                "} " << instanceName << "[" << numInstances << "];\n";
 
+       binding += numInstances;
+
        if (m_indexExprType == INDEX_EXPR_TYPE_DYNAMIC_UNIFORM)
        {
                for (int readNdx = 0; readNdx < numReads; readNdx++)
index 3ba4b29..18d2ba3 100644 (file)
@@ -1965,56 +1965,15 @@ void ComputeShaderExecutor::execute (const Context& ctx, int numValues, const vo
 
        };
 
-       addUniforms(vkDevice, vk, queueFamilyIndex, memAlloc);
-
-       const VkDescriptorSetLayoutBinding layoutBindings[2] =
-       {
-               {
-                       0u,                                                                                             // deUint32                                     binding;
-                       VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                              // VkDescriptorType                     descriptorType;
-                       1u,                                                                                             // deUint32                                     descriptorCount;
-                       VK_SHADER_STAGE_COMPUTE_BIT,                                    // VkShaderStageFlags           stageFlags;
-                       DE_NULL                                                                                 // const VkSampler*                     pImmutableSamplers;
-               },
-               {
-                       1u,                                                                                             // deUint32                                     binding;
-                       VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                              // VkDescriptorType                     descriptorType;
-                       1u,                                                                                             // deUint32                                     descriptorCount;
-                       VK_SHADER_STAGE_COMPUTE_BIT,                                    // VkShaderStageFlags           stageFlags;
-                       DE_NULL                                                                                 // const VkSampler*                     pImmutableSamplers;
-               }
-       };
-
-       const VkDescriptorSetLayoutCreateInfo descriptorLayoutParams =
-       {
-               VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,    // VkStructureType                                              sType;
-               DE_NULL,                                                                                                // cost void*                                                   pNexŧ;
-               (VkDescriptorSetLayoutCreateFlags)0,                                    // VkDescriptorSetLayoutCreateFlags             flags;
-               DE_LENGTH_OF_ARRAY(layoutBindings),                                             // deUint32                                                             count;
-               layoutBindings                                                                                  // const VkDescriptorSetLayoutBinding   pBinding;
-       };
+       m_descriptorSetLayoutBuilder.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_COMPUTE_BIT);
+       m_descriptorPoolBuilder.addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
+       m_descriptorSetLayoutBuilder.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_COMPUTE_BIT);
+       m_descriptorPoolBuilder.addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
 
-       descriptorSetLayout = createDescriptorSetLayout(vk, vkDevice, &descriptorLayoutParams);
-
-       const VkDescriptorPoolSize descriptorPoolSizes[] =
-       {
-               {
-                       VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                                      // VkDescriptorType             type;
-                       2u                                                                                                      // deUint32                             count;
-               },
-       };
-
-       const VkDescriptorPoolCreateInfo descriptorPoolParams =
-       {
-               VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,                  // VkStructureType                                      sType;
-               DE_NULL,                                                                                                // void*                                                        pNext;
-               VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,              // VkDescriptorPoolUsage                        poolUsage;
-               1u,                                                                                                             // deUint32                                                     maxSets;
-               DE_LENGTH_OF_ARRAY(descriptorPoolSizes),                                // deUint32                                                     count;
-               descriptorPoolSizes                                                                             // const VkDescriptorPoolSize*          pPoolSizes;
-       };
+       addUniforms(vkDevice, vk, queueFamilyIndex, memAlloc);
 
-       descriptorPool = createDescriptorPool(vk, vkDevice, &descriptorPoolParams);
+       descriptorSetLayout = m_descriptorSetLayoutBuilder.build(vk, vkDevice);
+       descriptorPool = m_descriptorPoolBuilder.build(vk, vkDevice, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u);
 
        const VkDescriptorSetAllocateInfo allocInfo =
        {
@@ -2364,55 +2323,15 @@ void TessellationExecutor::renderTess (const Context& ctx, deUint32 vertexCount)
 
        // Create descriptors
        {
-               const VkDescriptorSetLayoutBinding layoutBindings[2] =
-               {
-                       {
-                               0u,                                                                                             // deUint32                                     binding;
-                               VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                              // VkDescriptorType                     descriptorType;
-                               1u,                                                                                             // deUint32                                     arraySize;
-                               VK_SHADER_STAGE_ALL,                                                    // VkShaderStageFlags           stageFlags;
-                               DE_NULL                                                                                 // const VkSampler*                     pImmutableSamplers;
-                       },
-                       {
-                               1u,                                                                                             // deUint32                                     binding;
-                               VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                              // VkDescriptorType                     descriptorType;
-                               1u,                                                                                             // deUint32                                     arraySize;
-                               VK_SHADER_STAGE_ALL,                                                    // VkShaderStageFlags           stageFlags;
-                               DE_NULL                                                                                 // const VkSampler*                     pImmutableSamplers;
-                       }
-               };
-
-               const VkDescriptorSetLayoutCreateInfo descriptorLayoutParams =
-               {
-                       VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,    // VkStructureType                                              sType;
-                       DE_NULL,                                                                                                // cost void*                                                   pNexŧ;
-                       (VkDescriptorSetLayoutCreateFlags)0,                                    // VkDescriptorSetLayoutCreateFlags             flags;
-                       DE_LENGTH_OF_ARRAY(layoutBindings),                                             // deUint32                                                             count;
-                       layoutBindings                                                                                  // const VkDescriptorSetLayoutBinding   pBinding;
-               };
+               m_descriptorSetLayoutBuilder.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_ALL);
+               m_descriptorPoolBuilder.addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
+               m_descriptorSetLayoutBuilder.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_ALL);
+               m_descriptorPoolBuilder.addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
 
                addUniforms(vkDevice, vk, queueFamilyIndex, memAlloc);
-               descriptorSetLayout = createDescriptorSetLayout(vk, vkDevice, &descriptorLayoutParams);
-
-               const VkDescriptorPoolSize descriptorPoolSizes[] =
-               {
-                       {
-                               VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                              // VkDescriptorType             type;
-                               2u                                                                                              // deUint32                             count;
-                       },
-               };
 
-               const VkDescriptorPoolCreateInfo descriptorPoolParams =
-               {
-                       VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,          // VkStructureType                                      sType;
-                       DE_NULL,                                                                                        // void*                                                        pNext;
-                       VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,      //VkDescriptorPoolUsage                         poolUsage;
-                       1u,                                                                                                     //deUint32                                                      maxSets;
-                       DE_LENGTH_OF_ARRAY(descriptorPoolSizes),                        // deUint32                                                     count;
-                       descriptorPoolSizes                                                                     // const VkDescriptorPoolSize*          pTypeCount
-               };
-
-               descriptorPool = createDescriptorPool(vk, vkDevice, &descriptorPoolParams);
+               descriptorSetLayout = m_descriptorSetLayoutBuilder.build(vk, vkDevice);
+               descriptorPool = m_descriptorPoolBuilder.build(vk, vkDevice, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u);
 
                const VkDescriptorSetAllocateInfo allocInfo =
                {