From: Samuel Pitoiset Date: Tue, 3 Oct 2017 12:26:38 +0000 (+0200) Subject: radv: merge radv_meta_{save,restore}_pass() with RADV_META_SAVE_PASS X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d91f4e45fa2e09a0d80916c00ca1e36025059fc;p=mesa.git radv: merge radv_meta_{save,restore}_pass() with RADV_META_SAVE_PASS Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c index 4a45f083f69..33be7d68cca 100644 --- a/src/amd/vulkan/radv_meta.c +++ b/src/amd/vulkan/radv_meta.c @@ -61,6 +61,14 @@ radv_meta_save_novertex(struct radv_meta_saved_state *state, memcpy(state->push_constants, cmd_buffer->push_constants, MAX_PUSH_CONSTANTS_SIZE); } + + if (state->flags & RADV_META_SAVE_PASS) { + state->pass = cmd_buffer->state.pass; + state->subpass = cmd_buffer->state.subpass; + state->framebuffer = cmd_buffer->state.framebuffer; + state->attachments = cmd_buffer->state.attachments; + state->render_area = cmd_buffer->state.render_area; + } } void @@ -101,30 +109,16 @@ radv_meta_restore(const struct radv_meta_saved_state *state, cmd_buffer->push_constant_stages |= VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_COMPUTE_BIT; } -} - -void -radv_meta_save_pass(struct radv_meta_saved_pass_state *state, - const struct radv_cmd_buffer *cmd_buffer) -{ - state->pass = cmd_buffer->state.pass; - state->subpass = cmd_buffer->state.subpass; - state->framebuffer = cmd_buffer->state.framebuffer; - state->attachments = cmd_buffer->state.attachments; - state->render_area = cmd_buffer->state.render_area; -} -void -radv_meta_restore_pass(const struct radv_meta_saved_pass_state *state, - struct radv_cmd_buffer *cmd_buffer) -{ - cmd_buffer->state.pass = state->pass; - cmd_buffer->state.subpass = state->subpass; - cmd_buffer->state.framebuffer = state->framebuffer; - cmd_buffer->state.attachments = state->attachments; - cmd_buffer->state.render_area = state->render_area; - if (state->subpass) - radv_emit_framebuffer_state(cmd_buffer); + if (state->flags & RADV_META_SAVE_PASS) { + cmd_buffer->state.pass = state->pass; + cmd_buffer->state.subpass = state->subpass; + cmd_buffer->state.framebuffer = state->framebuffer; + cmd_buffer->state.attachments = state->attachments; + cmd_buffer->state.render_area = state->render_area; + if (state->subpass) + radv_emit_framebuffer_state(cmd_buffer); + } } void diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h index 0ea7ec537be..c7e5de7580f 100644 --- a/src/amd/vulkan/radv_meta.h +++ b/src/amd/vulkan/radv_meta.h @@ -49,9 +49,7 @@ struct radv_meta_saved_state { struct radv_scissor_state scissor; char push_constants[128]; -}; -struct radv_meta_saved_pass_state { struct radv_render_pass *pass; const struct radv_subpass *subpass; struct radv_attachment_state *attachments; @@ -100,12 +98,6 @@ void radv_device_finish_meta_resolve_fragment_state(struct radv_device *device); void radv_meta_restore(const struct radv_meta_saved_state *state, struct radv_cmd_buffer *cmd_buffer); -void radv_meta_save_pass(struct radv_meta_saved_pass_state *state, - const struct radv_cmd_buffer *cmd_buffer); - -void radv_meta_restore_pass(const struct radv_meta_saved_pass_state *state, - struct radv_cmd_buffer *cmd_buffer); - void radv_meta_save_compute(struct radv_meta_saved_compute_state *state, const struct radv_cmd_buffer *cmd_buffer, unsigned push_constant_size); diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c index 2a5459da06e..f2dcda581f1 100644 --- a/src/amd/vulkan/radv_meta_decompress.c +++ b/src/amd/vulkan/radv_meta_decompress.c @@ -301,7 +301,6 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer, enum radv_depth_op op) { struct radv_meta_saved_state saved_state; - struct radv_meta_saved_pass_state saved_pass_state; VkDevice device_h = radv_device_to_handle(cmd_buffer->device); VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer); uint32_t width = radv_minify(image->info.width, @@ -315,10 +314,10 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer, if (!image->surface.htile_size) return; - radv_meta_save_pass(&saved_pass_state, cmd_buffer); radv_meta_save_graphics_reset_vport_scissor_novertex(&saved_state, cmd_buffer, - RADV_META_SAVE_GRAPHICS_PIPELINE); + RADV_META_SAVE_GRAPHICS_PIPELINE | + RADV_META_SAVE_PASS); switch (op) { case DEPTH_DECOMPRESS: @@ -392,7 +391,6 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer, &cmd_buffer->pool->alloc); } radv_meta_restore(&saved_state, cmd_buffer); - radv_meta_restore_pass(&saved_pass_state, cmd_buffer); } void radv_decompress_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer, diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c index b903135b632..21ebc2b32a9 100644 --- a/src/amd/vulkan/radv_meta_fast_clear.c +++ b/src/amd/vulkan/radv_meta_fast_clear.c @@ -336,16 +336,16 @@ radv_fast_clear_flush_image_inplace(struct radv_cmd_buffer *cmd_buffer, const VkImageSubresourceRange *subresourceRange) { struct radv_meta_saved_state saved_state; - struct radv_meta_saved_pass_state saved_pass_state; VkDevice device_h = radv_device_to_handle(cmd_buffer->device); VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer); uint32_t layer_count = radv_get_layerCount(image, subresourceRange); VkPipeline pipeline; assert(cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL); - radv_meta_save_pass(&saved_pass_state, cmd_buffer); + radv_meta_save_graphics_reset_vport_scissor_novertex(&saved_state, cmd_buffer, - RADV_META_SAVE_GRAPHICS_PIPELINE); + RADV_META_SAVE_GRAPHICS_PIPELINE | + RADV_META_SAVE_PASS); if (image->fmask.size > 0) { pipeline = cmd_buffer->device->meta_state.fast_clear_flush.fmask_decompress_pipeline; @@ -424,5 +424,4 @@ radv_fast_clear_flush_image_inplace(struct radv_cmd_buffer *cmd_buffer, radv_emit_set_predication_state_from_image(cmd_buffer, image, false); } radv_meta_restore(&saved_state, cmd_buffer); - radv_meta_restore_pass(&saved_pass_state, cmd_buffer); }