vulkan/state: Track the input attachment count

Tilers need to know, at the very least, which input attachments are
"real" input attachments which map to a color or depth/stencil
attachment in tile memory and which are "fake" input attachments that
should be treated as regular textures. To do this we need to know
VkRenderingInputAttachmentIndexInfoKHR::colorAttachmentCount, which
wasn't provided by the state tracking infrastructure. When the
VkRenderingInputAttachmentIndexInfoKHR isn't provided, we don't know it,
though, so we have to record a special UKNOWN value. In that case, the
driver will know thanks to
VUID-VkGraphicsPipelineCreateInfo-renderPass-09652 that all input
attachments are "real" input attachments that map directly to color
attachments if they have an InputAttachmentIndex.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31261>
This commit is contained in:
Connor Abbott 2024-09-04 06:29:37 -04:00 committed by Marge Bot
parent 82169ec551
commit 8e153bbd8f
2 changed files with 17 additions and 0 deletions

View file

@ -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 =

View file

@ -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