diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index 526c6764b0d..24b9689eef3 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -1070,6 +1070,7 @@ vk_input_attachment_location_state_init(struct vk_input_attachment_location_stat { *ial = (struct vk_input_attachment_location_state) { .color_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + .color_attachment_count = MESA_VK_COLOR_ATTACHMENT_COUNT_UNKNOWN, .depth_att = MESA_VK_ATTACHMENT_UNUSED, .stencil_att = MESA_VK_ATTACHMENT_UNUSED, }; @@ -1087,6 +1088,8 @@ vk_input_attachment_location_state_init(struct vk_input_attachment_location_stat } } + ial->color_attachment_count = ial_info->colorAttachmentCount; + ial->depth_att = map_ds_input_attachment_index(ial_info->pDepthInputAttachmentIndex); ial->stencil_att = diff --git a/src/vulkan/runtime/vk_graphics_state.h b/src/vulkan/runtime/vk_graphics_state.h index 7d9ed73ce06..91684a76229 100644 --- a/src/vulkan/runtime/vk_graphics_state.h +++ b/src/vulkan/runtime/vk_graphics_state.h @@ -721,6 +721,8 @@ static_assert(MESA_VK_MAX_COLOR_ATTACHMENTS == 8, #define MESA_VK_RP_ATTACHMENT_COLOR_BIT(n) \ ((enum vk_rp_attachment_flags)(MESA_VK_RP_ATTACHMENT_COLOR_0_BIT << (n))) +#define MESA_VK_COLOR_ATTACHMENT_COUNT_UNKNOWN 0xff + /***/ struct vk_input_attachment_location_state { /** VkRenderingInputAttachmentIndexInfoKHR::pColorAttachmentLocations @@ -729,6 +731,18 @@ struct vk_input_attachment_location_state { */ uint8_t color_map[MESA_VK_MAX_COLOR_ATTACHMENTS]; + /** VkRenderingInputAttachmentIndexInfoKHR::colorAttachmentCount + * + * This must match vk_render_pass_state::color_attachment_count or be equal + * to MESA_VK_COLOR_ATTACHMENT_COUNT_UNKNOWN, in which case it can be + * assumed that there is an identity mapping and every input attachment + * with an index is a color attachment. Unlike vk_render_pass_state this + * state is available when compiling the fragment shader. + * + * MESA_VK_DYNAMIC_INPUT_ATTACHMENT_MAP + */ + uint8_t color_attachment_count; + /** VkRenderingInputAttachmentIndexInfoKHR::pDepthInputAttachmentIndex * * MESA_VK_DYNAMIC_INPUT_ATTACHMENT_MAP