diff options
author | Marek Olšák <[email protected]> | 2014-03-06 02:44:07 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-03-11 18:51:20 +0100 |
commit | a38e1fd78ba406abe6c6dfd665804ec0d8f98172 (patch) | |
tree | ead562dfb1eca0604d9cce10e1f352831701deda /src/gallium/drivers/radeonsi/si_state.c | |
parent | 28eb0bcf19a2a82166f685bf68bb0366bc560ba9 (diff) |
radeonsi: implement fast color clear
This works for both multi-sample and single-sample color buffers.
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index b95e1e20c8c..b012d0991c1 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1667,6 +1667,20 @@ static void si_initialize_color_surface(struct si_context *sctx, if (rtex->fmask.size) { surf->cb_color_fmask = (offset + rtex->fmask.offset) >> 8; surf->cb_color_fmask_slice = S_028C88_TILE_MAX(rtex->fmask.slice_tile_max); + } else { + /* This must be set for fast clear to work without FMASK. */ + surf->cb_color_fmask = surf->cb_color_base; + surf->cb_color_fmask_slice = surf->cb_color_slice; + surf->cb_color_attrib |= S_028C74_FMASK_TILE_MODE_INDEX(tile_mode_index); + + if (sctx->b.chip_class == SI) { + unsigned bankh = util_logbase2(rtex->surface.bankh); + surf->cb_color_attrib |= S_028C74_FMASK_BANK_HEIGHT(bankh); + } + + if (sctx->b.chip_class >= CIK) { + surf->cb_color_pitch |= S_028C64_FMASK_TILE_MAX(pitch); + } } /* Determine pixel shader export format */ @@ -1866,7 +1880,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, sctx->framebuffer.export_16bpc |= 1 << i; } - if (rtex->fmask.size || rtex->cmask.size) { + if (rtex->fmask.size && rtex->cmask.size) { sctx->framebuffer.compressed_cb_mask |= 1 << i; } } @@ -2964,6 +2978,7 @@ void si_init_state_functions(struct si_context *sctx) sctx->custom_dsa_flush_inplace = si_create_db_flush_dsa(sctx, false, false, 0); sctx->custom_blend_resolve = si_create_blend_custom(sctx, V_028808_CB_RESOLVE); sctx->custom_blend_decompress = si_create_blend_custom(sctx, V_028808_CB_FMASK_DECOMPRESS); + sctx->custom_blend_fastclear = si_create_blend_custom(sctx, V_028808_CB_ELIMINATE_FAST_CLEAR); sctx->b.b.set_clip_state = si_set_clip_state; sctx->b.b.set_scissor_states = si_set_scissor_states; |