panvk: Initialize clear values to zero when load_op != OP_CLEAR

This is easier to detect when something goes wrong with this default
initialization in place.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12762>
This commit is contained in:
Boris Brezillon
2021-09-06 16:18:45 +02:00
parent 55e3d0e256
commit 81e8a5d83a
+10 -3
View File
@@ -326,10 +326,17 @@ panvk_cmd_prepare_clear_values(struct panvk_cmd_buffer *cmdbuf,
attachment->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
cmdbuf->state.clear[i].depth = in[i].depthStencil.depth;
cmdbuf->state.clear[i].stencil = in[i].depthStencil.stencil;
} else {
cmdbuf->state.clear[i].depth = 0;
cmdbuf->state.clear[i].stencil = 0;
}
} else {
if (attachment->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
union pipe_color_union *col = (union pipe_color_union *) &in[i].color;
pan_pack_color(cmdbuf->state.clear[i].color, col, fmt, false);
} else {
memset(cmdbuf->state.clear[i].color, 0, sizeof(cmdbuf->state.clear[0].color));
}
} else if (attachment->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
union pipe_color_union *col = (union pipe_color_union *) &in[i].color;
pan_pack_color(cmdbuf->state.clear[i].color, col, fmt, false);
}
}
}