radv: allocate and initialize the FCE predicate value for CMASK too
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 5 Jan 2021 14:07:47 +0000 (15:07 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 13 Jan 2021 11:24:29 +0000 (12:24 +0100)
In case we don't have DCC, we can still predicate FCE with CMASK.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8332>

src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_image.c

index c4d1d1e..3563c0d 100644 (file)
@@ -2135,7 +2135,7 @@ radv_update_fce_metadata(struct radv_cmd_buffer *cmd_buffer,
        uint32_t level_count = radv_get_levelCount(image, range);
        uint32_t count = 2 * level_count;
 
-       assert(radv_dcc_enabled(image, range->baseMipLevel));
+       assert(image->fce_pred_offset != 0);
 
        radeon_emit(cmd_buffer->cs, PKT3(PKT3_WRITE_DATA, 2 + count, 0));
        radeon_emit(cmd_buffer->cs, S_370_DST_SEL(V_370_MEM) |
@@ -6210,12 +6210,12 @@ static void radv_init_color_image_metadata(struct radv_cmd_buffer *cmd_buffer,
                }
 
                radv_initialize_dcc(cmd_buffer, image, range, value);
-
-               radv_update_fce_metadata(cmd_buffer, image, range, false);
        }
 
        if (radv_image_has_cmask(image) ||
            radv_dcc_enabled(image, range->baseMipLevel)) {
+               radv_update_fce_metadata(cmd_buffer, image, range, false);
+
                uint32_t color_values[2] = {0};
                radv_set_color_clear_metadata(cmd_buffer, image, range,
                                              color_values);
index f532564..0ed0e07 100644 (file)
@@ -1272,10 +1272,12 @@ radv_image_alloc_single_sample_cmask(const struct radv_device *device,
 static void
 radv_image_alloc_values(const struct radv_device *device, struct radv_image *image)
 {
-       if (radv_image_has_dcc(image)) {
+       if (radv_image_has_cmask(image) || radv_image_has_dcc(image)) {
                image->fce_pred_offset = image->size;
                image->size += 8 * image->info.levels;
+       }
 
+       if (radv_image_has_dcc(image)) {
                image->dcc_pred_offset = image->size;
                image->size += 8 * image->info.levels;
        }