From cc84d4ca662df4019180319e682c8c7f0fed0741 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 20 Jul 2022 15:38:28 -0500 Subject: [PATCH] vulkan: Multisample state isn't always included in fragment shader state Reviewed-by: Lionel Landwerlin Part-of: --- 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: *