Module: Mesa
Branch: main
Commit: e27b4855f7cb936921728eb7edfd14e0cb176467
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e27b4855f7cb936921728eb7edfd14e0cb176467

Author: George Ouzounoudis <[email protected]>
Date:   Mon Aug 21 18:11:03 2023 +0300

nvk: Support extendedDynamicState3ColorBlendEnable

This is needed for EXT_shader_object. Move state to dynamic.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24872>

---

 src/nouveau/vulkan/nvk_cmd_draw.c          | 10 +++++++++-
 src/nouveau/vulkan/nvk_graphics_pipeline.c |  1 -
 src/nouveau/vulkan/nvk_physical_device.c   |  2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/nouveau/vulkan/nvk_cmd_draw.c 
b/src/nouveau/vulkan/nvk_cmd_draw.c
index 269b431c858..8bbf87e7db4 100644
--- a/src/nouveau/vulkan/nvk_cmd_draw.c
+++ b/src/nouveau/vulkan/nvk_cmd_draw.c
@@ -446,6 +446,7 @@ nvk_cmd_buffer_dirty_render_pass(struct nvk_cmd_buffer *cmd)
 
    /* These depend on color attachment count */
    BITSET_SET(dyn->dirty, MESA_VK_DYNAMIC_CB_COLOR_WRITE_ENABLES);
+   BITSET_SET(dyn->dirty, MESA_VK_DYNAMIC_CB_BLEND_ENABLES);
 
    /* These depend on the depth/stencil format */
    BITSET_SET(dyn->dirty, MESA_VK_DYNAMIC_DS_DEPTH_TEST_ENABLE);
@@ -1596,7 +1597,8 @@ nvk_flush_cb_state(struct nvk_cmd_buffer *cmd)
    const struct vk_dynamic_graphics_state *dyn =
       &cmd->vk.dynamic_graphics_state;
 
-   struct nv_push *p = nvk_cmd_buffer_push(cmd, 9 + 4 * NVK_MAX_RTS);
+   struct nv_push *p =
+      nvk_cmd_buffer_push(cmd, 13 + 2 * render->color_att_count);
 
    if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_CB_LOGIC_OP_ENABLE))
       P_IMMD(p, NV9097, SET_LOGIC_OP, dyn->cb.logic_op_enable);
@@ -1606,6 +1608,12 @@ nvk_flush_cb_state(struct nvk_cmd_buffer *cmd)
       P_IMMD(p, NV9097, SET_LOGIC_OP_FUNC, func);
    }
 
+   if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_CB_BLEND_ENABLES)) {
+      for (uint8_t a = 0; a < render->color_att_count; a++) {
+         P_IMMD(p, NV9097, SET_BLEND(a), dyn->cb.attachments[a].blend_enable);
+      }
+   }
+
    if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_CB_COLOR_WRITE_ENABLES)) {
       uint32_t color_write_enables = 0x0;
       for (uint8_t a = 0; a < render->color_att_count; a++) {
diff --git a/src/nouveau/vulkan/nvk_graphics_pipeline.c 
b/src/nouveau/vulkan/nvk_graphics_pipeline.c
index 31c0dd7aa4b..d634bcefba8 100644
--- a/src/nouveau/vulkan/nvk_graphics_pipeline.c
+++ b/src/nouveau/vulkan/nvk_graphics_pipeline.c
@@ -147,7 +147,6 @@ emit_pipeline_cb_state(struct nv_push *p,
 {
    for (uint32_t a = 0; a < cb->attachment_count; a++) {
       const struct vk_color_blend_attachment_state *att = &cb->attachments[a];
-      P_IMMD(p, NV9097, SET_BLEND(a), att->blend_enable);
 
       P_MTHD(p, NV9097, SET_BLEND_PER_TARGET_SEPARATE_FOR_ALPHA(a));
       P_NV9097_SET_BLEND_PER_TARGET_SEPARATE_FOR_ALPHA(p, a, ENABLE_TRUE);
diff --git a/src/nouveau/vulkan/nvk_physical_device.c 
b/src/nouveau/vulkan/nvk_physical_device.c
index bbe56c766f5..7b6b870b111 100644
--- a/src/nouveau/vulkan/nvk_physical_device.c
+++ b/src/nouveau/vulkan/nvk_physical_device.c
@@ -397,7 +397,7 @@ nvk_get_device_features(const struct nv_device_info *info,
       .extendedDynamicState3AlphaToCoverageEnable = false,
       .extendedDynamicState3AlphaToOneEnable = false,
       .extendedDynamicState3LogicOpEnable = true,
-      .extendedDynamicState3ColorBlendEnable = false,
+      .extendedDynamicState3ColorBlendEnable = true,
       .extendedDynamicState3ColorBlendEquation = false,
       .extendedDynamicState3ColorWriteMask = false,
       .extendedDynamicState3RasterizationStream = false,

Reply via email to