radv: create pipeline layout objects for all meta operations
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 18 Dec 2017 18:38:52 +0000 (19:38 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 19 Dec 2017 20:22:06 +0000 (21:22 +0100)
They are dummy objects but the spec requires layout to not be
NULL, this just makes sure we are creating valid pipeline layout
objects. This will allow us to remove some useless checks.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta_decompress.c
src/amd/vulkan/radv_meta_fast_clear.c
src/amd/vulkan/radv_meta_resolve.c
src/amd/vulkan/radv_private.h

index b86f3925cf7f4c6a964e9b4aeb09e7c82b045b93..7a5681414ff1a8f78c49f57b5e6b313c35ee1a40 100644 (file)
@@ -75,11 +75,29 @@ create_pass(struct radv_device *device,
        return result;
 }
 
+static VkResult
+create_pipeline_layout(struct radv_device *device, VkPipelineLayout *layout)
+{
+       VkPipelineLayoutCreateInfo pl_create_info = {
+               .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
+               .setLayoutCount = 0,
+               .pSetLayouts = NULL,
+               .pushConstantRangeCount = 0,
+               .pPushConstantRanges = NULL,
+       };
+
+       return radv_CreatePipelineLayout(radv_device_to_handle(device),
+                                        &pl_create_info,
+                                        &device->meta_state.alloc,
+                                        layout);
+}
+
 static VkResult
 create_pipeline(struct radv_device *device,
                 VkShaderModule vs_module_h,
                uint32_t samples,
                VkRenderPass pass,
+               VkPipelineLayout layout,
                VkPipeline *decompress_pipeline,
                VkPipeline *resummarize_pipeline)
 {
@@ -165,6 +183,7 @@ create_pipeline(struct radv_device *device,
                                VK_DYNAMIC_STATE_SCISSOR,
                        },
                },
+               .layout = layout,
                .renderPass = pass,
                .subpass = 0,
        };
@@ -212,6 +231,9 @@ radv_device_finish_meta_depth_decomp_state(struct radv_device *device)
                radv_DestroyRenderPass(radv_device_to_handle(device),
                                       state->depth_decomp[i].pass,
                                       &state->alloc);
+               radv_DestroyPipelineLayout(radv_device_to_handle(device),
+                                          state->depth_decomp[i].p_layout,
+                                          &state->alloc);
                radv_DestroyPipeline(radv_device_to_handle(device),
                                     state->depth_decomp[i].decompress_pipeline,
                                     &state->alloc);
@@ -243,8 +265,14 @@ radv_device_init_meta_depth_decomp_state(struct radv_device *device)
                if (res != VK_SUCCESS)
                        goto fail;
 
+               res = create_pipeline_layout(device,
+                                            &state->depth_decomp[i].p_layout);
+               if (res != VK_SUCCESS)
+                       goto fail;
+
                res = create_pipeline(device, vs_module_h, samples,
                                      state->depth_decomp[i].pass,
+                                     state->depth_decomp[i].p_layout,
                                      &state->depth_decomp[i].decompress_pipeline,
                                      &state->depth_decomp[i].resummarize_pipeline);
                if (res != VK_SUCCESS)
index 38da63246a3973cd9648707613dc2cff638164e6..1acf510359d1d3d61fec79f69f37e292d516db26 100644 (file)
@@ -74,9 +74,27 @@ create_pass(struct radv_device *device)
        return result;
 }
 
+static VkResult
+create_pipeline_layout(struct radv_device *device, VkPipelineLayout *layout)
+{
+       VkPipelineLayoutCreateInfo pl_create_info = {
+               .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
+               .setLayoutCount = 0,
+               .pSetLayouts = NULL,
+               .pushConstantRangeCount = 0,
+               .pPushConstantRanges = NULL,
+       };
+
+       return radv_CreatePipelineLayout(radv_device_to_handle(device),
+                                        &pl_create_info,
+                                        &device->meta_state.alloc,
+                                        layout);
+}
+
 static VkResult
 create_pipeline(struct radv_device *device,
-                VkShaderModule vs_module_h)
+               VkShaderModule vs_module_h,
+               VkPipelineLayout layout)
 {
        VkResult result;
        VkDevice device_h = radv_device_to_handle(device);
@@ -173,6 +191,7 @@ create_pipeline(struct radv_device *device,
                                                                VK_DYNAMIC_STATE_SCISSOR,
                                                        },
                                                },
+                                               .layout = layout,
                                                .renderPass = device->meta_state.fast_clear_flush.pass,
                                                .subpass = 0,
                                               },
@@ -218,6 +237,7 @@ create_pipeline(struct radv_device *device,
                                                                VK_DYNAMIC_STATE_SCISSOR,
                                                        },
                                                },
+                                               .layout = layout,
                                                .renderPass = device->meta_state.fast_clear_flush.pass,
                                                .subpass = 0,
                                               },
@@ -245,6 +265,9 @@ radv_device_finish_meta_fast_clear_flush_state(struct radv_device *device)
 
        radv_DestroyRenderPass(radv_device_to_handle(device),
                               state->fast_clear_flush.pass, &state->alloc);
+       radv_DestroyPipelineLayout(radv_device_to_handle(device),
+                                  state->fast_clear_flush.p_layout,
+                                  &state->alloc);
        radv_DestroyPipeline(radv_device_to_handle(device),
                             state->fast_clear_flush.cmask_eliminate_pipeline,
                             &state->alloc);
@@ -269,8 +292,14 @@ radv_device_init_meta_fast_clear_flush_state(struct radv_device *device)
        if (res != VK_SUCCESS)
                goto fail;
 
+       res = create_pipeline_layout(device,
+                                    &device->meta_state.fast_clear_flush.p_layout);
+       if (res != VK_SUCCESS)
+               goto fail;
+
        VkShaderModule vs_module_h = radv_shader_module_to_handle(&vs_module);
-       res = create_pipeline(device, vs_module_h);
+       res = create_pipeline(device, vs_module_h,
+                             device->meta_state.fast_clear_flush.p_layout);
        if (res != VK_SUCCESS)
                goto fail;
 
index 254861ad18a9df6c0e499b31477e4b81427277d4..e73a950ab7cf7094f8d14b166271d4fe26270cd5 100644 (file)
@@ -121,6 +121,21 @@ create_pipeline(struct radv_device *device,
                goto cleanup;
        }
 
+       VkPipelineLayoutCreateInfo pl_create_info = {
+               .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
+               .setLayoutCount = 0,
+               .pSetLayouts = NULL,
+               .pushConstantRangeCount = 0,
+               .pPushConstantRanges = NULL,
+       };
+
+       result = radv_CreatePipelineLayout(radv_device_to_handle(device),
+                                          &pl_create_info,
+                                          &device->meta_state.alloc,
+                                          &device->meta_state.resolve.p_layout);
+       if (result != VK_SUCCESS)
+               goto cleanup;
+
        result = radv_graphics_pipeline_create(device_h,
                                               radv_pipeline_cache_to_handle(&device->meta_state.cache),
                                               &(VkGraphicsPipelineCreateInfo) {
@@ -196,6 +211,7 @@ create_pipeline(struct radv_device *device,
                                                                VK_DYNAMIC_STATE_SCISSOR,
                                                        },
                                                },
+                                               .layout = device->meta_state.resolve.p_layout,
                                                                                                                                       .renderPass = device->meta_state.resolve.pass,
                                                                                                                                       .subpass = 0,
                                                                                                                                       },
@@ -222,6 +238,8 @@ radv_device_finish_meta_resolve_state(struct radv_device *device)
 
        radv_DestroyRenderPass(radv_device_to_handle(device),
                               state->resolve.pass, &state->alloc);
+       radv_DestroyPipelineLayout(radv_device_to_handle(device),
+                                  state->resolve.p_layout, &state->alloc);
        radv_DestroyPipeline(radv_device_to_handle(device),
                             state->resolve.pipeline, &state->alloc);
 }
index 9ef1f789329d4dc6a5d872d659e12cf501f42904..244ab8967b68d0e54e3a71c6daf70249423da71d 100644 (file)
@@ -434,6 +434,7 @@ struct radv_meta_state {
        } cleari;
 
        struct {
+               VkPipelineLayout                          p_layout;
                VkPipeline                                pipeline;
                VkRenderPass                              pass;
        } resolve;
@@ -459,12 +460,14 @@ struct radv_meta_state {
        } resolve_fragment;
 
        struct {
+               VkPipelineLayout                          p_layout;
                VkPipeline                                decompress_pipeline;
                VkPipeline                                resummarize_pipeline;
                VkRenderPass                              pass;
        } depth_decomp[1 + MAX_SAMPLES_LOG2];
 
        struct {
+               VkPipelineLayout                          p_layout;
                VkPipeline                                cmask_eliminate_pipeline;
                VkPipeline                                fmask_decompress_pipeline;
                VkRenderPass                              pass;