[Mesa-dev] [PATCH 07/10] radv: merge radv_meta_{save, restore}_pass() with RADV_META_SAVE_PASS
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Oct 3 18:52:42 UTC 2017
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/amd/vulkan/radv_meta.c | 40 +++++++++++++++--------------------
src/amd/vulkan/radv_meta.h | 8 -------
src/amd/vulkan/radv_meta_decompress.c | 6 ++----
src/amd/vulkan/radv_meta_fast_clear.c | 7 +++---
4 files changed, 22 insertions(+), 39 deletions(-)
diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index d6966ed516..83932a84a3 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 0befecd043..6500c9118c 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 3edc1be2f0..6aa833ea23 100644
--- a/src/amd/vulkan/radv_meta_decompress.c
+++ b/src/amd/vulkan/radv_meta_decompress.c
@@ -305,7 +305,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,
@@ -319,10 +318,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);
+ RADV_META_SAVE_GRAPHICS |
+ RADV_META_SAVE_PASS);
switch (op) {
case DEPTH_DECOMPRESS:
@@ -396,7 +395,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 c1f42205fb..c02e201413 100644
--- a/src/amd/vulkan/radv_meta_fast_clear.c
+++ b/src/amd/vulkan/radv_meta_fast_clear.c
@@ -338,16 +338,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);
+ RADV_META_SAVE_GRAPHICS |
+ RADV_META_SAVE_PASS);
if (image->fmask.size > 0) {
pipeline = cmd_buffer->device->meta_state.fast_clear_flush.fmask_decompress_pipeline;
@@ -426,5 +426,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);
}
--
2.14.2
More information about the mesa-dev
mailing list