diff options
author | Marek Olšák <[email protected]> | 2016-09-07 01:39:09 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-09-08 22:51:33 +0200 |
commit | 831c0c80f121c10e873bdc08a07f2c8bad39a6de (patch) | |
tree | 565b424ef19583ffd312b18176a40bf8ee8f98af | |
parent | 93f3d8e10d712336b86ebe17dafaee0aac7ec429 (diff) |
radeonsi: clamp integer clear color values for DCC fast clear
It should be possible to get TC-compatible fast clear more often now.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 2f04019da02..aee768f7b6d 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -2251,13 +2251,21 @@ static void vi_get_fast_clear_parameters(enum pipe_format surface_format, desc->swizzle[i] > PIPE_SWIZZLE_W) continue; - if (util_format_is_pure_sint(surface_format)) { + if (desc->channel[i].pure_integer && + desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) { + /* Use the maximum value for clamping the clear color. */ + int max = u_bit_consecutive(0, desc->channel[i].size - 1); + values[i] = color->i[i] != 0; - if (color->i[i] != 0 && color->i[i] != INT32_MAX) + if (color->i[i] != 0 && MIN2(color->i[i], max) != max) return; - } else if (util_format_is_pure_uint(surface_format)) { + } else if (desc->channel[i].pure_integer && + desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED) { + /* Use the maximum value for clamping the clear color. */ + unsigned max = u_bit_consecutive(0, desc->channel[i].size); + values[i] = color->ui[i] != 0U; - if (color->ui[i] != 0U && color->ui[i] != UINT32_MAX) + if (color->ui[i] != 0U && MIN2(color->ui[i], max) != max) return; } else { values[i] = color->f[i] != 0.0F; |