This will be used for the depth decompress pass that might need
to emit variable sample locations during layout transitions.

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
 src/amd/vulkan/radv_meta.c | 20 ++++++++++++++++++++
 src/amd/vulkan/radv_meta.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index 3bfe49b4dab..44715483565 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -73,6 +73,15 @@ radv_meta_save(struct radv_meta_saved_state *state,
                                           1 << VK_DYNAMIC_STATE_SCISSOR;
        }
 
+       if (state->flags & RADV_META_SAVE_SAMPLE_LOCATIONS) {
+               state->sample_location.per_pixel = 
cmd_buffer->state.dynamic.sample_location.per_pixel;
+               state->sample_location.grid_size = 
cmd_buffer->state.dynamic.sample_location.grid_size;
+               state->sample_location.count = 
cmd_buffer->state.dynamic.sample_location.count;
+               typed_memcpy(state->sample_location.locations,
+                            
cmd_buffer->state.dynamic.sample_location.locations,
+                            MAX_SAMPLE_LOCATIONS);
+       }
+
        if (state->flags & RADV_META_SAVE_COMPUTE_PIPELINE) {
                assert(!(state->flags & RADV_META_SAVE_GRAPHICS_PIPELINE));
 
@@ -131,6 +140,17 @@ radv_meta_restore(const struct radv_meta_saved_state 
*state,
                                           RADV_CMD_DIRTY_DYNAMIC_SCISSOR;
        }
 
+       if (state->flags & RADV_META_SAVE_SAMPLE_LOCATIONS) {
+               cmd_buffer->state.dynamic.sample_location.per_pixel = 
state->sample_location.per_pixel;
+               cmd_buffer->state.dynamic.sample_location.grid_size = 
state->sample_location.grid_size;
+               cmd_buffer->state.dynamic.sample_location.count = 
state->sample_location.count;
+               
typed_memcpy(cmd_buffer->state.dynamic.sample_location.locations,
+                            state->sample_location.locations,
+                            MAX_SAMPLE_LOCATIONS);
+
+               cmd_buffer->state.dirty |= 
RADV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS;
+       }
+
        if (state->flags & RADV_META_SAVE_COMPUTE_PIPELINE) {
                radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
                                     VK_PIPELINE_BIND_POINT_COMPUTE,
diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h
index 4a7c37be9b3..66c8df6b9e9 100644
--- a/src/amd/vulkan/radv_meta.h
+++ b/src/amd/vulkan/radv_meta.h
@@ -39,6 +39,7 @@ enum radv_meta_save_flags {
        RADV_META_SAVE_DESCRIPTORS       = (1 << 2),
        RADV_META_SAVE_GRAPHICS_PIPELINE = (1 << 3),
        RADV_META_SAVE_COMPUTE_PIPELINE  = (1 << 4),
+       RADV_META_SAVE_SAMPLE_LOCATIONS  = (1 << 5),
 };
 
 struct radv_meta_saved_state {
@@ -48,6 +49,7 @@ struct radv_meta_saved_state {
        struct radv_pipeline *old_pipeline;
        struct radv_viewport_state viewport;
        struct radv_scissor_state scissor;
+       struct radv_sample_locations_state sample_location;
 
        char push_constants[128];
 
-- 
2.21.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to