Re: [Mesa-dev] [PATCH] radv/meta: split color renderpass creation out.

2017-01-16 Thread Bas Nieuwenhuizen
Reviewed-by: Bas Nieuwenhuizen 

On Mon, Jan 16, 2017 at 9:44 PM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> This is just prep work for layered clears, it doesn't change
> anything.
>
> Signed-off-by: Dave Airlie 
> ---
>  src/amd/vulkan/radv_meta_clear.c | 87 
> ++--
>  1 file changed, 49 insertions(+), 38 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta_clear.c 
> b/src/amd/vulkan/radv_meta_clear.c
> index 601c3de..ff779ea 100644
> --- a/src/amd/vulkan/radv_meta_clear.c
> +++ b/src/amd/vulkan/radv_meta_clear.c
> @@ -205,12 +205,50 @@ create_pipeline(struct radv_device *device,
>  }
>
>  static VkResult
> +create_color_renderpass(struct radv_device *device,
> +   VkFormat vk_format,
> +   uint32_t samples,
> +   VkRenderPass *pass)
> +{
> +   return radv_CreateRenderPass(radv_device_to_handle(device),
> +  &(VkRenderPassCreateInfo) {
> +  .sType = 
> VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
> +  .attachmentCount = 1,
> +  .pAttachments = 
> &(VkAttachmentDescription) {
> +  .format = vk_format,
> +  .samples = samples,
> +  .loadOp = 
> VK_ATTACHMENT_LOAD_OP_LOAD,
> +  .storeOp = 
> VK_ATTACHMENT_STORE_OP_STORE,
> +  .initialLayout = 
> VK_IMAGE_LAYOUT_GENERAL,
> +  .finalLayout = 
> VK_IMAGE_LAYOUT_GENERAL,
> +  },
> +  .subpassCount = 1,
> +   .pSubpasses = 
> &(VkSubpassDescription) {
> +  .pipelineBindPoint = 
> VK_PIPELINE_BIND_POINT_GRAPHICS,
> +  .inputAttachmentCount 
> = 0,
> +  .colorAttachmentCount 
> = 1,
> +  .pColorAttachments = 
> &(VkAttachmentReference) {
> +  .attachment = 
> 0,
> +  .layout = 
> VK_IMAGE_LAYOUT_GENERAL,
> +  },
> +  .pResolveAttachments = 
> NULL,
> +  
> .pDepthStencilAttachment = &(VkAttachmentReference) {
> +  .attachment = 
> VK_ATTACHMENT_UNUSED,
> +  .layout = 
> VK_IMAGE_LAYOUT_GENERAL,
> +  },
> +  
> .preserveAttachmentCount = 1,
> +  .pPreserveAttachments 
> = (uint32_t[]) { 0 },
> +  },
> +   
> .dependencyCount = 0,
> +}, 
> >meta_state.alloc, pass);
> +}
> +
> +static VkResult
>  create_color_pipeline(struct radv_device *device,
> -  VkFormat vk_format,
>   uint32_t samples,
>uint32_t frag_output,
>struct radv_pipeline **pipeline,
> - VkRenderPass *pass)
> + VkRenderPass pass)
>  {
> struct nir_shader *vs_nir;
> struct nir_shader *fs_nir;
> @@ -270,44 +308,11 @@ create_color_pipeline(struct radv_device *device,
> .pAttachments = blend_attachment_state
> };
>
> -   result = radv_CreateRenderPass(radv_device_to_handle(device),
> -  &(VkRenderPassCreateInfo) {
> -  .sType = 
> VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
> -  .attachmentCount = 1,
> -  .pAttachments = 
> &(VkAttachmentDescription) {
> -  .format = vk_format,
> -  .samples = samples,
> -  .loadOp = 
> VK_ATTACHMENT_LOAD_OP_LOAD,
> -  

[Mesa-dev] [PATCH] radv/meta: split color renderpass creation out.

2017-01-16 Thread Dave Airlie
From: Dave Airlie 

This is just prep work for layered clears, it doesn't change
anything.

Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/radv_meta_clear.c | 87 ++--
 1 file changed, 49 insertions(+), 38 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c
index 601c3de..ff779ea 100644
--- a/src/amd/vulkan/radv_meta_clear.c
+++ b/src/amd/vulkan/radv_meta_clear.c
@@ -205,12 +205,50 @@ create_pipeline(struct radv_device *device,
 }
 
 static VkResult
+create_color_renderpass(struct radv_device *device,
+   VkFormat vk_format,
+   uint32_t samples,
+   VkRenderPass *pass)
+{
+   return radv_CreateRenderPass(radv_device_to_handle(device),
+  &(VkRenderPassCreateInfo) {
+  .sType = 
VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+  .attachmentCount = 1,
+  .pAttachments = 
&(VkAttachmentDescription) {
+  .format = vk_format,
+  .samples = samples,
+  .loadOp = 
VK_ATTACHMENT_LOAD_OP_LOAD,
+  .storeOp = 
VK_ATTACHMENT_STORE_OP_STORE,
+  .initialLayout = 
VK_IMAGE_LAYOUT_GENERAL,
+  .finalLayout = 
VK_IMAGE_LAYOUT_GENERAL,
+  },
+  .subpassCount = 1,
+   .pSubpasses = 
&(VkSubpassDescription) {
+  .pipelineBindPoint = 
VK_PIPELINE_BIND_POINT_GRAPHICS,
+  .inputAttachmentCount = 
0,
+  .colorAttachmentCount = 
1,
+  .pColorAttachments = 
&(VkAttachmentReference) {
+  .attachment = 0,
+  .layout = 
VK_IMAGE_LAYOUT_GENERAL,
+  },
+  .pResolveAttachments = 
NULL,
+  .pDepthStencilAttachment 
= &(VkAttachmentReference) {
+  .attachment = 
VK_ATTACHMENT_UNUSED,
+  .layout = 
VK_IMAGE_LAYOUT_GENERAL,
+  },
+  .preserveAttachmentCount 
= 1,
+  .pPreserveAttachments = 
(uint32_t[]) { 0 },
+  },
+   
.dependencyCount = 0,
+}, 
>meta_state.alloc, pass);
+}
+
+static VkResult
 create_color_pipeline(struct radv_device *device,
-  VkFormat vk_format,
  uint32_t samples,
   uint32_t frag_output,
   struct radv_pipeline **pipeline,
- VkRenderPass *pass)
+ VkRenderPass pass)
 {
struct nir_shader *vs_nir;
struct nir_shader *fs_nir;
@@ -270,44 +308,11 @@ create_color_pipeline(struct radv_device *device,
.pAttachments = blend_attachment_state
};
 
-   result = radv_CreateRenderPass(radv_device_to_handle(device),
-  &(VkRenderPassCreateInfo) {
-  .sType = 
VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
-  .attachmentCount = 1,
-  .pAttachments = 
&(VkAttachmentDescription) {
-  .format = vk_format,
-  .samples = samples,
-  .loadOp = 
VK_ATTACHMENT_LOAD_OP_LOAD,
-  .storeOp = 
VK_ATTACHMENT_STORE_OP_STORE,
-  .initialLayout = 
VK_IMAGE_LAYOUT_GENERAL,
-  .finalLayout = 
VK_IMAGE_LAYOUT_GENERAL,
-  },
-