radv: initialize with expanded cmask if the destination layout needs it

If radv_layout_can_fast_clear() is false, 028C70_COMPRESSION is unset when
the image is rendered to and CMASK isn't updated. This appears to cause
FMASK to be ignored and the 0th sample to always be used.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3449
Fixes: 7b21ce401f
   ('radv: disable FMASK compression when drawing with GENERAL layout')

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6745>
This commit is contained in:
Rhys Perry 2020-09-15 19:55:47 +01:00 committed by Marge Bot
parent 6f2b6952be
commit 85cc2950a0

View file

@ -6037,8 +6037,16 @@ static void radv_init_color_image_metadata(struct radv_cmd_buffer *cmd_buffer,
if (radv_image_has_cmask(image)) {
uint32_t value = 0xffffffffu; /* Fully expanded mode. */
/* TODO: clarify this. */
if (radv_image_has_fmask(image)) {
/* TODO: clarify why 0xccccccccu is used. */
/* If CMASK isn't updated with the new layout, we should use the
* fully expanded mode so that the image is read correctly if
* CMASK is used (such as when transitioning to a compressed
* layout).
*/
if (radv_image_has_fmask(image) &&
radv_layout_can_fast_clear(image, dst_layout,
dst_render_loop, dst_queue_mask)) {
value = 0xccccccccu;
}