[Mesa-dev] [PATCH 18/19] radeonsi: properly set cmask_buffer in si_reallocate_texture_inplace
Marek Olšák
maraeo at gmail.com
Fri Jun 22 22:32:09 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeonsi/si_texture.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index 3152f742ae6..307062daf2f 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -567,21 +567,31 @@ static void si_reallocate_texture_inplace(struct si_context *sctx,
tex->buffer.flags = new_tex->buffer.flags;
tex->surface = new_tex->surface;
tex->size = new_tex->size;
si_texture_reference(&tex->flushed_depth_texture,
new_tex->flushed_depth_texture);
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,
sizeof(tex->color_clear_value));
tex->last_msaa_resolve_target_micro_mode = new_tex->last_msaa_resolve_target_micro_mode;
tex->htile_offset = new_tex->htile_offset;
tex->depth_clear_value = new_tex->depth_clear_value;
tex->dirty_level_mask = new_tex->dirty_level_mask;
tex->stencil_dirty_level_mask = new_tex->stencil_dirty_level_mask;
--
2.17.1
More information about the mesa-dev
mailing list