radv: merge radv_meta_{save,restore}_pass() with RADV_META_SAVE_PASS
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 3 Oct 2017 12:26:38 +0000 (14:26 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 6 Oct 2017 07:49:06 +0000 (09:49 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta.c
src/amd/vulkan/radv_meta.h
src/amd/vulkan/radv_meta_decompress.c
src/amd/vulkan/radv_meta_fast_clear.c

index 4a45f083f6993f2101797b604272b6c9f77dc34e..33be7d68ccaf5bb3f7dff6d3e93b90ee88c4db71 100644 (file)
@@ -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
index 0ea7ec537be02ecd72fc18fa29fb77033cad0e9b..c7e5de7580f94373534600fc0eb29491ac7dedee 100644 (file)
@@ -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);
index 2a5459da06e1016a5bd3e72e37485f53c7843c45..f2dcda581f1aaa9c2d1f7ef91d2861c04418c04d 100644 (file)
@@ -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,
index b903135b6325ce6a83961ef9c2914500d1cfe384..21ebc2b32a914a07b48eb21ea019b87a8fa632b3 100644 (file)
@@ -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);
 }