From f19d81ee420d84c36acecc272a1387af02443c73 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 9 Aug 2022 17:05:09 +0200 Subject: [PATCH] vulkan: add attachment sample count info AMD support Signed-off-by: Samuel Pitoiset Reviewed-by: Jason Ekstrand Part-of: --- src/vulkan/runtime/vk_graphics_state.c | 11 +++++++++++ src/vulkan/runtime/vk_graphics_state.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index 140910a7c38..9b4ae9c9795 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -963,6 +963,17 @@ vk_render_pass_state_init(struct vk_render_pass_state *rp, rp->depth_self_dependency = rsd_info->depthSelfDependency; rp->stencil_self_dependency = rsd_info->stencilSelfDependency; } + + const VkAttachmentSampleCountInfoAMD *asc_info = + vk_get_pipeline_sample_count_info_amd(info); + if (asc_info != NULL) { + assert(asc_info->colorAttachmentCount == rp->color_attachment_count); + for (uint32_t i = 0; i < asc_info->colorAttachmentCount; i++) { + rp->color_attachment_samples[i] = asc_info->pColorAttachmentSamples[i]; + } + + rp->depth_stencil_attachment_samples = asc_info->depthStencilAttachmentSamples; + } } static void diff --git a/src/vulkan/runtime/vk_graphics_state.h b/src/vulkan/runtime/vk_graphics_state.h index 560ec245723..05e32e53ce7 100644 --- a/src/vulkan/runtime/vk_graphics_state.h +++ b/src/vulkan/runtime/vk_graphics_state.h @@ -504,6 +504,12 @@ struct vk_render_pass_state { /** VkPipelineRenderingCreateInfo::stencilAttachmentFormat */ VkFormat stencil_attachment_format; + + /** VkAttachmentSampleCountInfoAMD::pColorAttachmentSamples */ + uint8_t color_attachment_samples[MESA_VK_MAX_COLOR_ATTACHMENTS]; + + /** VkAttachmentSampleCountInfoAMD::depthStencilAttachmentSamples */ + uint8_t depth_stencil_attachment_samples; }; /** Struct representing all dynamic graphics state