From 924075cd56c820fbdfd24c741b5429cc54d79f12 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 6 Apr 2025 14:40:31 -0400 Subject: [PATCH] asahi,hk: disentangle logicop_enable logicop_func=COPY is different from logicop_enable due to overriding blending. maintain the info we need to implement properly. fixes dEQP-VK.pipeline.shader_object_unlinked_binary.logic_op_na_formats.r32g32b32a32_sfloat.copy_blend Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_linker.h | 2 +- src/asahi/lib/agx_nir_prolog_epilog.c | 2 +- src/asahi/vulkan/hk_cmd_draw.c | 5 ++--- src/gallium/drivers/asahi/agx_state.c | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/asahi/lib/agx_linker.h b/src/asahi/lib/agx_linker.h index 39ad6d26fa4..4fcce70a29f 100644 --- a/src/asahi/lib/agx_linker.h +++ b/src/asahi/lib/agx_linker.h @@ -107,7 +107,7 @@ struct agx_blend_key { struct agx_blend_rt_key rt[8]; uint8_t logicop_func; bool alpha_to_coverage, alpha_to_one; - bool padding; + bool logicop_enable; }; static_assert(sizeof(struct agx_blend_key) == 36, "packed"); diff --git a/src/asahi/lib/agx_nir_prolog_epilog.c b/src/asahi/lib/agx_nir_prolog_epilog.c index a3b70fc0e42..c95ce81baa9 100644 --- a/src/asahi/lib/agx_nir_prolog_epilog.c +++ b/src/asahi/lib/agx_nir_prolog_epilog.c @@ -392,7 +392,7 @@ agx_nir_fs_epilog(nir_builder *b, const void *key_) bool force_translucent = false; nir_lower_blend_options opts = { .scalar_blend_const = true, - .logicop_enable = key->blend.logicop_func != PIPE_LOGICOP_COPY, + .logicop_enable = key->blend.logicop_enable, .logicop_func = key->blend.logicop_func, }; diff --git a/src/asahi/vulkan/hk_cmd_draw.c b/src/asahi/vulkan/hk_cmd_draw.c index 4365dd05a7b..bdb813091b3 100644 --- a/src/asahi/vulkan/hk_cmd_draw.c +++ b/src/asahi/vulkan/hk_cmd_draw.c @@ -2738,9 +2738,8 @@ hk_flush_dynamic_state(struct hk_cmd_buffer *cmd, struct hk_cs *cs, .nr_samples = MAX2(dyn->ms.rasterization_samples, 1), .blend.alpha_to_coverage = dyn->ms.alpha_to_coverage_enable, .blend.alpha_to_one = dyn->ms.alpha_to_one_enable, - .blend.logicop_func = dyn->cb.logic_op_enable - ? vk_logic_op_to_pipe(dyn->cb.logic_op) - : PIPE_LOGICOP_COPY, + .blend.logicop_enable = dyn->cb.logic_op_enable, + .blend.logicop_func = vk_logic_op_to_pipe(dyn->cb.logic_op), }; for (unsigned rt = 0; rt < ARRAY_SIZE(dyn->cal.color_map); ++rt) { diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index d2820f03b38..9a4940f2765 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -209,8 +209,8 @@ agx_create_blend_state(struct pipe_context *ctx, key->alpha_to_coverage = state->alpha_to_coverage; key->alpha_to_one = state->alpha_to_one; - key->logicop_func = - state->logicop_enable ? state->logicop_func : PIPE_LOGICOP_COPY; + key->logicop_enable = state->logicop_enable; + key->logicop_func = state->logicop_func; for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) { unsigned rti = state->independent_blend_enable ? i : 0;