diff options
author | Samuel Pitoiset <[email protected]> | 2019-06-12 11:39:58 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-06-21 14:50:35 +0200 |
commit | e67fc11c26111ae7aa8d140a5f62074b5e0b43c3 (patch) | |
tree | ff6c0edae9bb1e2e8fe966dfcc82f2970d25712d | |
parent | 396da5c029549a78e0536f2a7910ee791bb6223b (diff) |
radv: pass sample locations for transitions before depth/stencil resolves
HTILE decompressions need the user sample locations if specified
in the current subpass.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_resolve.c | 30 | ||||
-rw-r--r-- | src/amd/vulkan/radv_private.h | 3 |
3 files changed, 34 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index bf2ecc4b0b4..9b4d4528028 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -2688,7 +2688,7 @@ void radv_subpass_barrier(struct radv_cmd_buffer *cmd_buffer, NULL); } -static uint32_t +uint32_t radv_get_subpass_id(struct radv_cmd_buffer *cmd_buffer) { struct radv_cmd_state *state = &cmd_buffer->state; diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index d1cfda5dc48..6517634df25 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -818,6 +818,20 @@ radv_decompress_resolve_subpass_src(struct radv_cmd_buffer *cmd_buffer) } } +static struct radv_sample_locations_state * +radv_get_resolve_sample_locations(struct radv_cmd_buffer *cmd_buffer) +{ + struct radv_cmd_state *state = &cmd_buffer->state; + uint32_t subpass_id = radv_get_subpass_id(cmd_buffer); + + for (uint32_t i = 0; i < state->num_subpass_sample_locs; i++) { + if (state->subpass_sample_locs[i].subpass_idx == subpass_id) + return &state->subpass_sample_locs[i].sample_location; + } + + return NULL; +} + /** * Decompress CMask/FMask before resolving a multisampled source image. */ @@ -848,6 +862,22 @@ radv_decompress_resolve_src(struct radv_cmd_buffer *cmd_buffer, .layerCount = region->srcSubresource.layerCount, }; + if (src_image->flags & VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT) { + /* If the depth/stencil image uses different sample + * locations, we need them during HTILE decompressions. + */ + struct radv_sample_locations_state *sample_locs = + radv_get_resolve_sample_locations(cmd_buffer); + + barrier.pNext = &(VkSampleLocationsInfoEXT) { + .sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT, + .sampleLocationsPerPixel = sample_locs->per_pixel, + .sampleLocationGridSize = sample_locs->grid_size, + .sampleLocationsCount = sample_locs->count, + .pSampleLocations = sample_locs->locations, + }; + } + radv_CmdPipelineBarrier(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 9de46494454..1249ad0445d 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -2003,6 +2003,9 @@ struct radv_subpass { VkSampleCountFlagBits max_sample_count; }; +uint32_t +radv_get_subpass_id(struct radv_cmd_buffer *cmd_buffer); + struct radv_render_pass_attachment { VkFormat format; uint32_t samples; |