From: Jason Ekstrand Date: Tue, 20 Oct 2015 20:01:15 +0000 (-0700) Subject: anv/meta: Use the actual render pass for creating blit pipelines X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f5224f2566b091835989759f8d9f1277a192021;p=mesa.git anv/meta: Use the actual render pass for creating blit pipelines --- diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 591a89928a6..8bfab1f8323 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -529,6 +529,42 @@ meta_blit_get_dest_view_base_array_slice(const struct anv_image *dest_image, static void anv_device_init_meta_blit_state(struct anv_device *device) { + anv_CreateRenderPass(anv_device_to_handle(device), + &(VkRenderPassCreateInfo) { + .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, + .attachmentCount = 1, + .pAttachments = &(VkAttachmentDescription) { + .sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION, + .format = VK_FORMAT_UNDEFINED, /* Our shaders don't care */ + .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) { + .sType = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION, + .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, + .inputCount = 0, + .colorCount = 1, + .pColorAttachments = &(VkAttachmentReference) { + .attachment = 0, + .layout = VK_IMAGE_LAYOUT_GENERAL, + }, + .pResolveAttachments = NULL, + .depthStencilAttachment = (VkAttachmentReference) { + .attachment = VK_ATTACHMENT_UNUSED, + .layout = VK_IMAGE_LAYOUT_GENERAL, + }, + .preserveCount = 1, + .pPreserveAttachments = &(VkAttachmentReference) { + .attachment = 0, + .layout = VK_IMAGE_LAYOUT_GENERAL, + }, + }, + .dependencyCount = 0, + }, &device->meta_state.blit.render_pass); + /* We don't use a vertex shader for clearing, but instead build and pass * the VUEs directly to the rasterization backend. However, we do need * to provide GLSL source for the vertex shader so that the compiler @@ -702,7 +738,7 @@ anv_device_init_meta_blit_state(struct anv_device *device) }, .flags = 0, .layout = device->meta_state.blit.pipeline_layout, - .renderPass = anv_render_pass_to_handle(&anv_meta_dummy_renderpass), + .renderPass = device->meta_state.blit.render_pass, .subpass = 0, }; @@ -862,47 +898,10 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, .layers = 1 }, &fb); - VkRenderPass pass; - anv_CreateRenderPass(anv_device_to_handle(device), - &(VkRenderPassCreateInfo) { - .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, - .attachmentCount = 1, - .pAttachments = &(VkAttachmentDescription) { - .sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION, - .format = dest_iview->format->vk_format, - .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) { - .sType = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION, - .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, - .inputCount = 0, - .colorCount = 1, - .pColorAttachments = &(VkAttachmentReference) { - .attachment = 0, - .layout = VK_IMAGE_LAYOUT_GENERAL, - }, - .pResolveAttachments = NULL, - .depthStencilAttachment = (VkAttachmentReference) { - .attachment = VK_ATTACHMENT_UNUSED, - .layout = VK_IMAGE_LAYOUT_GENERAL, - }, - .preserveCount = 1, - .pPreserveAttachments = &(VkAttachmentReference) { - .attachment = 0, - .layout = VK_IMAGE_LAYOUT_GENERAL, - }, - }, - .dependencyCount = 0, - }, &pass); - ANV_CALL(CmdBeginRenderPass)(anv_cmd_buffer_to_handle(cmd_buffer), &(VkRenderPassBeginInfo) { .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, - .renderPass = pass, + .renderPass = device->meta_state.blit.render_pass, .framebuffer = fb, .renderArea = { .offset = { dest_offset.x, dest_offset.y }, @@ -958,7 +957,6 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, */ anv_descriptor_set_destroy(device, anv_descriptor_set_from_handle(set)); anv_DestroyFramebuffer(anv_device_to_handle(device), fb); - anv_DestroyRenderPass(anv_device_to_handle(device), pass); } static void @@ -1809,6 +1807,8 @@ anv_device_finish_meta(struct anv_device *device) device->meta_state.clear.pipeline); /* Blit */ + anv_DestroyRenderPass(anv_device_to_handle(device), + device->meta_state.blit.render_pass); anv_DestroyPipeline(anv_device_to_handle(device), device->meta_state.blit.pipeline_2d_src); anv_DestroyPipeline(anv_device_to_handle(device), diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index aadedb8b53a..c0d9373b643 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -451,6 +451,8 @@ struct anv_meta_state { } clear; struct { + VkRenderPass render_pass; + /** Pipeline that blits from a 2D image. */ VkPipeline pipeline_2d_src;