From 110d550941fd26f5e9ae450521a177d5be20a445 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 6 Dec 2022 09:46:25 -0800 Subject: [PATCH] zink: Don't set dynamic color attachment state for 0 attachments. Fixes some validation failures like: VUID-vkCmdSetColorBlendEquationEXT-attachmentCount-arraylength(ERROR / SPEC): msgNum: -175001922 - Validation Error: [ VUID-vkCmdSetColorBlendEquationEXT-attachmentCount-arraylength ] Object 0: handle = 0xaaaae7632fa0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf591aebe | vkCmdSetColorBlendEquationEXT: parameter attachmentCount must be greater than 0. The Vulkan spec states: attachmentCount must be greater than 0 (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdSetColorBlendEquationEXT-attachmentCount-arraylength) However, we still have some around dynamic color attachment state: Objects: 1 [0] 0xaaaafcab4150, type: 6, name: NULL VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0xaaaafcab4150, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x79de34d4 | VkCommandBuffer 0xaaaafcab4150[]: Dynamic color blend enable state not set for this command buffer. Objects: 1 [0] 0xaaaafcab4150, type: 6, name: NULL VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0xaaaafcab4150, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x79de34d4 | VkCommandBuffer 0xaaaafcab4150[]: Dynamic color blend equation state not set for this command buffer. Objects: 1 [0] 0xaaaafcab4150, type: 6, name: NULL VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0xaaaafcab4150, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x79de34d4 | VkCommandBuffer 0xaaaafcab4150[]: Dynamic color write mask state not set for this command buffer. Part-of: --- src/gallium/drivers/zink/zink_draw.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index fbcb04f..3caf7cd 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -704,9 +704,11 @@ zink_draw(struct pipe_context *pctx, VKCTX(CmdSetAlphaToCoverageEnableEXT)(batch->state->cmdbuf, ctx->gfx_pipeline_state.blend_state->alpha_to_coverage); if (screen->info.feats.features.alphaToOne) VKCTX(CmdSetAlphaToOneEnableEXT)(batch->state->cmdbuf, ctx->gfx_pipeline_state.blend_state->alpha_to_one); - VKCTX(CmdSetColorBlendEnableEXT)(batch->state->cmdbuf, 0, ctx->fb_state.nr_cbufs, ctx->gfx_pipeline_state.blend_state->ds3.enables); - VKCTX(CmdSetColorWriteMaskEXT)(batch->state->cmdbuf, 0, ctx->fb_state.nr_cbufs, ctx->gfx_pipeline_state.blend_state->ds3.wrmask); - VKCTX(CmdSetColorBlendEquationEXT)(batch->state->cmdbuf, 0, ctx->fb_state.nr_cbufs, ctx->gfx_pipeline_state.blend_state->ds3.eq); + if (ctx->fb_state.nr_cbufs) { + VKCTX(CmdSetColorBlendEnableEXT)(batch->state->cmdbuf, 0, ctx->fb_state.nr_cbufs, ctx->gfx_pipeline_state.blend_state->ds3.enables); + VKCTX(CmdSetColorWriteMaskEXT)(batch->state->cmdbuf, 0, ctx->fb_state.nr_cbufs, ctx->gfx_pipeline_state.blend_state->ds3.wrmask); + VKCTX(CmdSetColorBlendEquationEXT)(batch->state->cmdbuf, 0, ctx->fb_state.nr_cbufs, ctx->gfx_pipeline_state.blend_state->ds3.eq); + } VKCTX(CmdSetLogicOpEnableEXT)(batch->state->cmdbuf, ctx->gfx_pipeline_state.blend_state->logicop_enable); VKCTX(CmdSetLogicOpEXT)(batch->state->cmdbuf, ctx->gfx_pipeline_state.blend_state->logicop_func); } -- 2.7.4