[Piglit] [PATCH 1/8] cru: Conform to Vulkan Specification 1.0.20

Nanley Chery nanleychery at gmail.com
Wed Jul 13 19:58:09 UTC 2016


I used the Vulkan Validation layers to determine the areas of
non-conformance.

Changes:
 * Provide required fields:
   - VkFramebufferCreateInfo::renderPass
   - VkSubmitInfo::sType
   - VkDeviceQueueCreateInfo::sType
   - VkDeviceQueueCreateInfo::pQueuePriorities
 * Assign the right bit to VkDescriptorPoolCreateInfo::flags for the
   freeing which occurs during cleanup.
 * Use the correct VkDescriptorPoolCreateInfo::poolSizeCount value.
   This fixes a bug in DescriptorPool creation in which DescriptorTypes
   after STORAGE_TEXEL_BUFFER were not being added to the pool.
 * Set VkGraphicsPipelineCreateInfo::pDynamicState to NULL if
   VkPipelineDynamicStateCreateInfo::dynamicStateCount is zero

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/framework/test/t_phase_setup.c | 63 ++++++++++++++++++++++++++++++++++++--
 src/qonos/qonos.c                  |  1 +
 src/qonos/qonos_pipeline.c         | 14 +++++----
 src/util/cru_vk_image.c            |  1 +
 4 files changed, 71 insertions(+), 8 deletions(-)

diff --git a/src/framework/test/t_phase_setup.c b/src/framework/test/t_phase_setup.c
index a46b169..b3cd046 100644
--- a/src/framework/test/t_phase_setup.c
+++ b/src/framework/test/t_phase_setup.c
@@ -207,6 +207,30 @@ t_setup_framebuffer(void)
 
     attachments[n_attachments++] = t->vk.color_image_view;
 
+    VkRenderPass color_pass = qoCreateRenderPass(t_device,
+        .attachmentCount = 1,
+        .pAttachments = (VkAttachmentDescription[]) {
+            {
+                QO_ATTACHMENT_DESCRIPTION_DEFAULTS,
+                .format = VK_FORMAT_R8G8B8A8_UNORM,
+            },
+        },
+        .subpassCount = 1,
+        .pSubpasses = (VkSubpassDescription[]) {
+            {
+                QO_SUBPASS_DESCRIPTION_DEFAULTS,
+                .colorAttachmentCount = 1,
+                .pColorAttachments = (VkAttachmentReference[]) {
+                    {
+                        .attachment = 0,
+                        .layout = VK_IMAGE_LAYOUT_GENERAL,
+                    },
+                },
+            }
+        });
+
+    VkRenderPass pass = color_pass;
+
     if (t->def->depthstencil_format != VK_FORMAT_UNDEFINED) {
         t->vk.ds_image = qoCreateImage(t->vk.device,
             .format = t->def->depthstencil_format,
@@ -258,9 +282,42 @@ t_setup_framebuffer(void)
             });
 
         attachments[n_attachments++] = t->vk.depthstencil_image_view;
+
+        VkRenderPass color_depth_pass = qoCreateRenderPass(t_device,
+            .attachmentCount = 2,
+            .pAttachments = (VkAttachmentDescription[]) {
+                {
+                    QO_ATTACHMENT_DESCRIPTION_DEFAULTS,
+                    .format = VK_FORMAT_R8G8B8A8_UNORM,
+                },
+                {
+                    QO_ATTACHMENT_DESCRIPTION_DEFAULTS,
+                    .format = t->def->depthstencil_format,
+                },
+            },
+            .subpassCount = 1,
+            .pSubpasses = (VkSubpassDescription[]) {
+                {
+                    QO_SUBPASS_DESCRIPTION_DEFAULTS,
+                    .colorAttachmentCount = 1,
+                    .pColorAttachments = (VkAttachmentReference[]) {
+                        {
+                            .attachment = 0,
+                            .layout = VK_IMAGE_LAYOUT_GENERAL,
+                        },
+                    },
+                    .pDepthStencilAttachment = &(VkAttachmentReference) {
+                        .attachment = 1,
+                        .layout = VK_IMAGE_LAYOUT_GENERAL,
+                    },
+                },
+            });
+
+        pass = color_depth_pass;
     }
 
     t->vk.framebuffer = qoCreateFramebuffer(t->vk.device,
+        .renderPass = pass,
         .width = t->ref.width,
         .height = t->ref.height,
         .layers = 1,
@@ -283,9 +340,9 @@ t_setup_descriptor_pool(void)
     const VkDescriptorPoolCreateInfo create_info = {
         .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
         .pNext = NULL,
-        .flags = 0,
+        .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
         .maxSets = 1,
-        .poolSizeCount = 5,
+        .poolSizeCount = VK_DESCRIPTOR_TYPE_RANGE_SIZE,
         .pPoolSizes = pool_sizes
     };
 
@@ -320,8 +377,10 @@ t_setup_vulkan(void)
             .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
             .queueCreateInfoCount = 1,
             .pQueueCreateInfos = &(VkDeviceQueueCreateInfo) {
+                .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
                 .queueFamilyIndex = 0,
                 .queueCount = 1,
+                .pQueuePriorities = (float[]) {1.0f},
             },
         }, NULL, &t->vk.device);
 
diff --git a/src/qonos/qonos.c b/src/qonos/qonos.c
index 6d28f75..82a64e8 100644
--- a/src/qonos/qonos.c
+++ b/src/qonos/qonos.c
@@ -101,6 +101,7 @@ qoQueueSubmit(VkQueue queue, uint32_t cmdBufferCount,
 
     result = vkQueueSubmit(queue, 1,
         &(VkSubmitInfo) {
+            .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
             .commandBufferCount = cmdBufferCount,
             .pCommandBuffers = commandBuffers,
         }, fence);
diff --git a/src/qonos/qonos_pipeline.c b/src/qonos/qonos_pipeline.c
index 498eec8..c95a937 100644
--- a/src/qonos/qonos_pipeline.c
+++ b/src/qonos/qonos_pipeline.c
@@ -130,12 +130,14 @@ qoCreateGraphicsPipeline(VkDevice device,
                 dynamic_states[count++] = s;
         }
 
-        dy_info = (VkPipelineDynamicStateCreateInfo) {
-            .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
-            .dynamicStateCount = count,
-            .pDynamicStates = dynamic_states,
-        };
-        pipeline_info.pDynamicState = &dy_info;
+        if (count > 0) {
+           dy_info = (VkPipelineDynamicStateCreateInfo) {
+               .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
+               .dynamicStateCount = count,
+               .pDynamicStates = dynamic_states,
+           };
+           pipeline_info.pDynamicState = &dy_info;
+        }
     }
 
     // Look for vertex or fragment shaders in the chain
diff --git a/src/util/cru_vk_image.c b/src/util/cru_vk_image.c
index e2ff334..308095a 100644
--- a/src/util/cru_vk_image.c
+++ b/src/util/cru_vk_image.c
@@ -199,6 +199,7 @@ copy(cru_vk_image_t *self, enum copy_direction dir)
 
     r = vkQueueSubmit(self->vk_queue, 1,
         &(VkSubmitInfo) {
+            .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
             .commandBufferCount = 1,
             .pCommandBuffers = &cmd,
         }, fence);
-- 
2.9.0



More information about the Piglit mailing list