radv: allow to save/restore sample locations during meta operations
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 30 May 2019 09:50:22 +0000 (11:50 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 7 Jun 2019 11:10:50 +0000 (13:10 +0200)
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.pitoiset@gmail.com>
Reviewed-By: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta.c
src/amd/vulkan/radv_meta.h

index 3bfe49b4dab515da9fc85586700771be3ce1cb3a..5e619c2f181644e936b0a0a7e100cfa87f81dde3 100644 (file)
@@ -73,6 +73,11 @@ radv_meta_save(struct radv_meta_saved_state *state,
                                           1 << VK_DYNAMIC_STATE_SCISSOR;
        }
 
+       if (state->flags & RADV_META_SAVE_SAMPLE_LOCATIONS) {
+               typed_memcpy(&state->sample_location,
+                            &cmd_buffer->state.dynamic.sample_location, 1);
+       }
+
        if (state->flags & RADV_META_SAVE_COMPUTE_PIPELINE) {
                assert(!(state->flags & RADV_META_SAVE_GRAPHICS_PIPELINE));
 
@@ -131,6 +136,13 @@ radv_meta_restore(const struct radv_meta_saved_state *state,
                                           RADV_CMD_DIRTY_DYNAMIC_SCISSOR;
        }
 
+       if (state->flags & RADV_META_SAVE_SAMPLE_LOCATIONS) {
+               typed_memcpy(&cmd_buffer->state.dynamic.sample_location.locations,
+                            &state->sample_location.locations, 1);
+
+               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,
index 4a7c37be9b3009722dfeb154f4847b1f3514e1b8..66c8df6b9e9cc6f26e78492de351e08ead5d9331 100644 (file)
@@ -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];