summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-06-22 00:00:11 -0400
committerMarek Olšák <[email protected]>2018-06-25 18:33:58 -0400
commiteabeeb86b272ff010a9fffcbf48ecf76d44c74cb (patch)
tree2c3c22cc6eff448939606d4c42f05bfe054fd8dc
parentd4755ef3892635e6e252af21ef7faf934ddd3da1 (diff)
radeonsi: properly set cmask_buffer in si_reallocate_texture_inplace
Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index a577778a9f1..ac50103a74b 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -574,7 +574,17 @@ static void si_reallocate_texture_inplace(struct si_context *sctx,
tex->fmask_offset = new_tex->fmask_offset;
tex->cmask_offset = new_tex->cmask_offset;
tex->cmask_base_address_reg = new_tex->cmask_base_address_reg;
- r600_resource_reference(&tex->cmask_buffer, new_tex->cmask_buffer);
+
+ if (tex->cmask_buffer == &tex->buffer)
+ tex->cmask_buffer = NULL;
+ else
+ r600_resource_reference(&tex->cmask_buffer, NULL);
+
+ if (new_tex->cmask_buffer == &new_tex->buffer)
+ tex->cmask_buffer = &tex->buffer;
+ else
+ r600_resource_reference(&tex->cmask_buffer, new_tex->cmask_buffer);
+
tex->dcc_offset = new_tex->dcc_offset;
tex->cb_color_info = new_tex->cb_color_info;
memcpy(tex->color_clear_value, new_tex->color_clear_value,