sctx->cs_user_data[2] = (tex->surface.u.gfx9.color.display_dcc_pitch_max + 1) |
(tex->surface.u.gfx9.color.display_dcc_height << 16);
- /* There is only 1 shader variant because ac_surface only supports displayable DCC
- * with one swizzle mode and 32bpp.
- */
+ /* We have only 1 variant per bpp for now, so expect 32 bpp. */
assert(tex->surface.bpe == 4);
- assert(sctx->chip_class != GFX9 || tex->surface.u.gfx9.swizzle_mode == 25); /* 64KB_S_X */
- assert(sctx->chip_class != GFX10 || tex->surface.u.gfx9.swizzle_mode == 27); /* 64KB_R_X */
- assert(sctx->chip_class != GFX10_3 || tex->surface.u.gfx9.swizzle_mode == 27); /* 64KB_R_X */
- if (!sctx->cs_dcc_retile)
- sctx->cs_dcc_retile = si_create_dcc_retile_cs(sctx, &tex->surface);
+ void **shader = &sctx->cs_dcc_retile[tex->surface.u.gfx9.swizzle_mode];
+ if (!*shader)
+ *shader = si_create_dcc_retile_cs(sctx, &tex->surface);
/* Dispatch compute. */
unsigned width = DIV_ROUND_UP(tex->buffer.b.b.width0, tex->surface.u.gfx9.color.dcc_block_width);
info.grid[1] = DIV_ROUND_UP(height, info.block[1]);
info.grid[2] = 1;
- si_launch_grid_internal_ssbos(sctx, &info, sctx->cs_dcc_retile, SI_OP_SYNC_BEFORE,
+ si_launch_grid_internal_ssbos(sctx, &info, *shader, SI_OP_SYNC_BEFORE,
SI_COHERENCY_CB_META, 1, &sb, 0x1);
/* Don't flush caches. L2 will be flushed by the kernel fence. */
sctx->b.delete_compute_state(&sctx->b, sctx->cs_clear_12bytes_buffer);
if (sctx->cs_dcc_decompress)
sctx->b.delete_compute_state(&sctx->b, sctx->cs_dcc_decompress);
- if (sctx->cs_dcc_retile)
- sctx->b.delete_compute_state(&sctx->b, sctx->cs_dcc_retile);
+ for (unsigned i = 0; i < ARRAY_SIZE(sctx->cs_dcc_retile); i++) {
+ if (sctx->cs_dcc_retile[i])
+ sctx->b.delete_compute_state(&sctx->b, sctx->cs_dcc_retile[i]);
+ }
if (sctx->no_velems_state)
sctx->b.delete_vertex_elements_state(&sctx->b, sctx->no_velems_state);
void *cs_clear_render_target_1d_array;
void *cs_clear_12bytes_buffer;
void *cs_dcc_decompress;
- void *cs_dcc_retile;
+ void *cs_dcc_retile[32];
void *cs_fmask_expand[3][2]; /* [log2(samples)-1][is_array] */
struct si_screen *screen;
struct pipe_debug_callback debug;