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

Author: Jason Ekstrand <[email protected]>
Date:   Wed Jul 20 15:38:28 2022 -0500

vulkan: Multisample state isn't always included in fragment shader state

Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696>

---

 src/vulkan/runtime/vk_graphics_state.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/runtime/vk_graphics_state.c 
b/src/vulkan/runtime/vk_graphics_state.c
index 14f1c0f4ead..053d2e3e833 100644
--- a/src/vulkan/runtime/vk_graphics_state.c
+++ b/src/vulkan/runtime/vk_graphics_state.c
@@ -1119,7 +1119,27 @@ vk_graphics_pipeline_state_fill(const struct vk_device 
*device,
 
    if (lib & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT) {
       needs |= MESA_VK_GRAPHICS_STATE_FRAGMENT_SHADING_RATE_BIT;
-      needs |= MESA_VK_GRAPHICS_STATE_MULTISAMPLE_BIT;
+
+      /* From the Vulkan 1.3.218 spec:
+       *
+       *    "Fragment shader state is defined by:
+       *    ...
+       *     - VkPipelineMultisampleStateCreateInfo if sample shading is
+       *       enabled or renderpass is not VK_NULL_HANDLE"
+       *
+       * and
+       *
+       *    VUID-VkGraphicsPipelineCreateInfo-pMultisampleState-06629
+       *
+       *    "If the pipeline is being created with fragment shader state
+       *    pMultisampleState must be NULL or a valid pointer to a valid
+       *    VkPipelineMultisampleStateCreateInfo structure"
+       *
+       * so we can reliably detect when to include it based on the
+       * pMultisampleState pointer.
+       */
+      if (info->pMultisampleState != NULL)
+         needs |= MESA_VK_GRAPHICS_STATE_MULTISAMPLE_BIT;
 
       /* From the Vulkan 1.3.218 spec:
        *

Reply via email to