mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 02:00:12 +01:00
radeonsi: update compressed_colortex_masks when a cmask is created or disabled
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
da68a9b215
commit
59c5508b9a
3 changed files with 51 additions and 2 deletions
|
|
@ -352,9 +352,18 @@ si_decompress_color_textures(struct si_context *sctx,
|
|||
|
||||
void si_decompress_textures(struct si_context *sctx)
|
||||
{
|
||||
unsigned compressed_colortex_counter;
|
||||
|
||||
if (sctx->blitter->running)
|
||||
return;
|
||||
|
||||
/* Update the compressed_colortex_mask if necessary. */
|
||||
compressed_colortex_counter = p_atomic_read(&sctx->screen->b.compressed_colortex_counter);
|
||||
if (compressed_colortex_counter != sctx->b.last_compressed_colortex_counter) {
|
||||
sctx->b.last_compressed_colortex_counter = compressed_colortex_counter;
|
||||
si_update_compressed_colortex_masks(sctx);
|
||||
}
|
||||
|
||||
/* Flush depth textures which need to be flushed. */
|
||||
for (int i = 0; i < SI_NUM_SHADERS; i++) {
|
||||
if (sctx->samplers[i].depth_texture_mask) {
|
||||
|
|
|
|||
|
|
@ -224,6 +224,12 @@ static void si_set_sampler_view(struct si_context *sctx,
|
|||
views->desc.list_dirty = true;
|
||||
}
|
||||
|
||||
static bool is_compressed_colortex(struct r600_texture *rtex)
|
||||
{
|
||||
return rtex->cmask.size || rtex->fmask.size ||
|
||||
(rtex->dcc_offset && rtex->dirty_level_mask);
|
||||
}
|
||||
|
||||
static void si_set_sampler_views(struct pipe_context *ctx,
|
||||
unsigned shader, unsigned start,
|
||||
unsigned count,
|
||||
|
|
@ -257,8 +263,7 @@ static void si_set_sampler_views(struct pipe_context *ctx,
|
|||
} else {
|
||||
samplers->depth_texture_mask &= ~(1 << slot);
|
||||
}
|
||||
if (rtex->cmask.size || rtex->fmask.size ||
|
||||
(rtex->dcc_offset && rtex->dirty_level_mask)) {
|
||||
if (is_compressed_colortex(rtex)) {
|
||||
samplers->compressed_colortex_mask |= 1 << slot;
|
||||
} else {
|
||||
samplers->compressed_colortex_mask &= ~(1 << slot);
|
||||
|
|
@ -270,6 +275,27 @@ static void si_set_sampler_views(struct pipe_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
si_samplers_update_compressed_colortex_mask(struct si_textures_info *samplers)
|
||||
{
|
||||
uint64_t mask = samplers->views.desc.enabled_mask;
|
||||
|
||||
while (mask) {
|
||||
int i = u_bit_scan64(&mask);
|
||||
struct pipe_resource *res = samplers->views.views[i]->texture;
|
||||
|
||||
if (res && res->target != PIPE_BUFFER) {
|
||||
struct r600_texture *rtex = (struct r600_texture *)res;
|
||||
|
||||
if (is_compressed_colortex(rtex)) {
|
||||
samplers->compressed_colortex_mask |= 1 << i;
|
||||
} else {
|
||||
samplers->compressed_colortex_mask &= ~(1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SAMPLER STATES */
|
||||
|
||||
static void si_bind_sampler_states(struct pipe_context *ctx, unsigned shader,
|
||||
|
|
@ -762,6 +788,19 @@ static void si_desc_reset_buffer_offset(struct pipe_context *ctx,
|
|||
S_008F04_BASE_ADDRESS_HI(va >> 32);
|
||||
}
|
||||
|
||||
/* TEXTURE METADATA ENABLE/DISABLE */
|
||||
|
||||
/* CMASK can be enabled (for fast clear) and disabled (for texture export)
|
||||
* while the texture is bound, possibly by a different context. In that case,
|
||||
* call this function to update compressed_colortex_masks.
|
||||
*/
|
||||
void si_update_compressed_colortex_masks(struct si_context *sctx)
|
||||
{
|
||||
for (int i = 0; i < SI_NUM_SHADERS; ++i) {
|
||||
si_samplers_update_compressed_colortex_mask(&sctx->samplers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* BUFFER DISCARD/INVALIDATION */
|
||||
|
||||
/* Reallocate a buffer a update all resource bindings where the buffer is
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ void si_all_descriptors_begin_new_cs(struct si_context *sctx);
|
|||
void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuffer,
|
||||
const uint8_t *ptr, unsigned size, uint32_t *const_offset);
|
||||
void si_shader_change_notify(struct si_context *sctx);
|
||||
void si_update_compressed_colortex_masks(struct si_context *sctx);
|
||||
void si_emit_shader_userdata(struct si_context *sctx, struct r600_atom *atom);
|
||||
|
||||
/* si_state.c */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue