radv: rely on pipeline layout when creating push descriptors with template
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 20 Dec 2019 12:30:28 +0000 (13:30 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 20 Dec 2019 12:41:29 +0000 (13:41 +0100)
descriptorSetLayout should be ignored for push descriptors. While
we are it, also ignore pipelineBindPoint.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2210
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3180>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3180>

src/amd/vulkan/radv_descriptor_set.c

index 051a51cdbe1239f9cf773c0922564f7dbda2cb84..8a6f2fc2121a1c5a8e0774ef7b66818d301f8463 100644 (file)
@@ -1153,7 +1153,18 @@ VkResult radv_CreateDescriptorUpdateTemplate(VkDevice _device,
                return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
 
        templ->entry_count = entry_count;
-       templ->bind_point = pCreateInfo->pipelineBindPoint;
+
+       if (pCreateInfo->templateType == VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR) {
+               RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->pipelineLayout);
+
+               /* descriptorSetLayout should be ignored for push descriptors
+                * and instead it refers to pipelineLayout and set.
+                */
+               assert(pCreateInfo->set < MAX_SETS);
+               set_layout = pipeline_layout->set[pCreateInfo->set].layout;
+
+               templ->bind_point = pCreateInfo->pipelineBindPoint;
+       }
 
        for (i = 0; i < entry_count; i++) {
                const VkDescriptorUpdateTemplateEntry *entry = &pCreateInfo->pDescriptorUpdateEntries[i];