Module: Mesa Branch: main Commit: 81e8a5d83a56b86c2fd74ac03f1acfca4d33311f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=81e8a5d83a56b86c2fd74ac03f1acfca4d33311f
Author: Boris Brezillon <[email protected]> Date: Mon Sep 6 16:18:45 2021 +0200 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 <[email protected]> Reviewed-by: Tomeu Vizoso <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12762> --- src/panfrost/vulkan/panvk_cmd_buffer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/panfrost/vulkan/panvk_cmd_buffer.c b/src/panfrost/vulkan/panvk_cmd_buffer.c index 4b0c990fa38..ae13cd4d394 100644 --- a/src/panfrost/vulkan/panvk_cmd_buffer.c +++ b/src/panfrost/vulkan/panvk_cmd_buffer.c @@ -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); } } }
