radv: allow the depth decompress pass to emit dynamic sample locations

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset
2019-05-30 12:20:12 +02:00
parent 2dd8dfd913
commit a20925f2a9
3 changed files with 31 additions and 7 deletions

View File

@@ -4678,7 +4678,8 @@ static void radv_handle_depth_image_transition(struct radv_cmd_buffer *cmd_buffe
cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB |
RADV_CMD_FLAG_FLUSH_AND_INV_DB_META;
radv_decompress_depth_image_inplace(cmd_buffer, image, &local_range);
radv_decompress_depth_image_inplace(cmd_buffer, image,
&local_range, NULL);
cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB |
RADV_CMD_FLAG_FLUSH_AND_INV_DB_META;

View File

@@ -169,10 +169,12 @@ void radv_meta_clear_image_cs(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);
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);
void radv_fast_clear_flush_image_inplace(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
const VkImageSubresourceRange *subresourceRange);

View File

@@ -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);
}