vulkan: Fix pipeline libraries with dynamic-only VI or FSR state

When we initialize the graphics pipeline state, we skip VI and FSR state
if they're 100% dynamic.  We need to do this if the current set of
dynamic things contains VI/FSR or if the set of dynamic state already in
the vk_graphics_pipeline_state has them dynamic.  Look state->dynamic
after we've merged instead of just looking at the dynamic set from the
VkGraphicsPipelineCreateInfo we were passed.

Also, when we validate, we need to assume that VI and FSR exist or else
we'll assert if dynamic VI or FSR are set.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696>
This commit is contained in:
Jason Ekstrand 2022-07-20 13:58:44 -05:00 committed by Marge Bot
parent e5e828e91d
commit ceccbc01f5

View file

@ -979,21 +979,30 @@ vk_dynamic_graphics_state_init_rp(struct vk_dynamic_graphics_state *dst,
f(MESA_VK_GRAPHICS_STATE_RENDER_PASS_BIT, \
vk_render_pass_state, rp);
static void
vk_graphics_pipeline_state_validate(const struct vk_graphics_pipeline_state *state)
static enum mesa_vk_graphics_state_groups
vk_graphics_pipeline_state_groups(const struct vk_graphics_pipeline_state *state)
{
#ifndef NDEBUG
/* For now, we just validate dynamic state */
enum mesa_vk_graphics_state_groups has = 0;
enum mesa_vk_graphics_state_groups groups = 0;
#define FILL_HAS(STATE, type, s) \
if (state->s != NULL) has |= STATE
if (state->s != NULL) groups |= STATE
FOREACH_STATE_GROUP(FILL_HAS)
#undef FILL_HAS
validate_dynamic_state_groups(state->dynamic, has);
return groups | fully_dynamic_state_groups(state->dynamic);
}
static void
vk_graphics_pipeline_state_validate(const struct vk_graphics_pipeline_state *state)
{
#ifndef NDEBUG
/* For now, we just validate dynamic state */
enum mesa_vk_graphics_state_groups groups =
vk_graphics_pipeline_state_groups(state);
validate_dynamic_state_groups(state->dynamic, groups);
#endif
}
@ -1224,7 +1233,7 @@ vk_graphics_pipeline_state_fill(const struct vk_device *device,
* this after we've filtered dynamic state because we still want them to
* show up in the dynamic state but don't want the actual state.
*/
needs &= ~fully_dynamic_state_groups(dynamic);
needs &= ~fully_dynamic_state_groups(state->dynamic);
/* If we don't need to set up any new states, bail early */
if (needs == 0)