summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_cmd_buffer.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-06-19 15:56:19 +0200
committerSamuel Pitoiset <[email protected]>2018-06-20 13:21:42 +0200
commit204cf5714ab4acb6d800a137f8489624a7909526 (patch)
tree59f745977df93cc7b7346699d202c5ea3056de2c /src/amd/vulkan/radv_cmd_buffer.c
parent4b564bd612247b3d6590046b4591c9efcceabb17 (diff)
radv: always initialize the clear color values to 0
Having random data in there is probably not the best. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_cmd_buffer.c')
-rw-r--r--src/amd/vulkan/radv_cmd_buffer.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index e13f7a94e1d..fb775c1cc48 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -1354,10 +1354,9 @@ radv_update_bound_fast_clear_color(struct radv_cmd_buffer *cmd_buffer,
/**
* Set the clear color values to the image's metadata.
*/
-void
+static void
radv_set_color_clear_metadata(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
- int cb_idx,
uint32_t color_values[2])
{
struct radeon_cmdbuf *cs = cmd_buffer->cs;
@@ -1375,6 +1374,20 @@ radv_set_color_clear_metadata(struct radv_cmd_buffer *cmd_buffer,
radeon_emit(cs, va >> 32);
radeon_emit(cs, color_values[0]);
radeon_emit(cs, color_values[1]);
+}
+
+/**
+ * Update the clear color values for this image.
+ */
+void
+radv_update_color_clear_metadata(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *image,
+ int cb_idx,
+ uint32_t color_values[2])
+{
+ assert(radv_image_has_cmask(image) || radv_image_has_dcc(image));
+
+ radv_set_color_clear_metadata(cmd_buffer, image, color_values);
radv_update_bound_fast_clear_color(cmd_buffer, image, cb_idx,
color_values);
@@ -4061,6 +4074,11 @@ static void radv_init_color_image_metadata(struct radv_cmd_buffer *cmd_buffer,
radv_set_dcc_need_cmask_elim_pred(cmd_buffer, image, false);
}
+
+ if (radv_image_has_cmask(image) || radv_image_has_dcc(image)) {
+ uint32_t color_values[2] = {};
+ radv_set_color_clear_metadata(cmd_buffer, image, color_values);
+ }
}
/**