aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta_decompress.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-05-30 12:20:12 +0200
committerSamuel Pitoiset <[email protected]>2019-06-07 13:11:00 +0200
commita20925f2a97c5ba1c74a402d348d8c5a6f2642a9 (patch)
tree8c3e43dce134b511c4b96d41aa5e8449a146360d /src/amd/vulkan/radv_meta_decompress.c
parent2dd8dfd9137ac561aac3c453c1c7ad6683bd17b4 (diff)
radv: allow the depth decompress pass to emit dynamic sample locations
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-By: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta_decompress.c')
-rw-r--r--src/amd/vulkan/radv_meta_decompress.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c
index c51beb0c32d..578a287d07b 100644
--- a/src/amd/vulkan/radv_meta_decompress.c
+++ b/src/amd/vulkan/radv_meta_decompress.c
@@ -323,6 +323,7 @@ enum radv_depth_op {
static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
VkImageSubresourceRange *subresourceRange,
+ struct radv_sample_locations_state *sample_locs,
enum radv_depth_op op)
{
struct radv_meta_saved_state saved_state;
@@ -354,6 +355,7 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
radv_meta_save(&saved_state, cmd_buffer,
RADV_META_SAVE_GRAPHICS_PIPELINE |
+ RADV_META_SAVE_SAMPLE_LOCATIONS |
RADV_META_SAVE_PASS);
switch (op) {
@@ -384,6 +386,21 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
.extent = { width, height },
});
+ if (sample_locs) {
+ assert(image->flags & VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT);
+
+ /* Set the sample locations specified during explicit or
+ * automatic layout transitions, otherwise the depth decompress
+ * pass uses the default HW locations.
+ */
+ radv_CmdSetSampleLocationsEXT(cmd_buffer_h, &(VkSampleLocationsInfoEXT) {
+ .sampleLocationsPerPixel = sample_locs->per_pixel,
+ .sampleLocationGridSize = sample_locs->grid_size,
+ .sampleLocationsCount = sample_locs->count,
+ .pSampleLocations = sample_locs->locations,
+ });
+ }
+
for (uint32_t layer = 0; layer < radv_get_layerCount(image, subresourceRange); layer++) {
struct radv_image_view iview;
@@ -449,16 +466,20 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
void radv_decompress_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
- VkImageSubresourceRange *subresourceRange)
+ VkImageSubresourceRange *subresourceRange,
+ struct radv_sample_locations_state *sample_locs)
{
assert(cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL);
- radv_process_depth_image_inplace(cmd_buffer, image, subresourceRange, DEPTH_DECOMPRESS);
+ radv_process_depth_image_inplace(cmd_buffer, image, subresourceRange,
+ sample_locs, DEPTH_DECOMPRESS);
}
void radv_resummarize_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
- VkImageSubresourceRange *subresourceRange)
+ VkImageSubresourceRange *subresourceRange,
+ struct radv_sample_locations_state *sample_locs)
{
assert(cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL);
- radv_process_depth_image_inplace(cmd_buffer, image, subresourceRange, DEPTH_RESUMMARIZE);
+ radv_process_depth_image_inplace(cmd_buffer, image, subresourceRange,
+ sample_locs, DEPTH_RESUMMARIZE);
}