venus: implement VK_EXT_vertex_input_dynamic_state
requires a fixup to ignore static pVertexInputState if dynamic state is used. Signed-off-by: Juston Li <justonli@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25193>
This commit is contained in:
@@ -608,7 +608,7 @@ Khronos extensions that are not part of any Vulkan version:
|
|||||||
VK_EXT_shader_module_identifier DONE (anv, hasvk, radv, tu, v3dv)
|
VK_EXT_shader_module_identifier DONE (anv, hasvk, radv, tu, v3dv)
|
||||||
VK_EXT_transform_feedback DONE (anv, hasvk, lvp, nvk, radv, tu, vn)
|
VK_EXT_transform_feedback DONE (anv, hasvk, lvp, nvk, radv, tu, vn)
|
||||||
VK_EXT_vertex_attribute_divisor DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn)
|
VK_EXT_vertex_attribute_divisor DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn)
|
||||||
VK_EXT_vertex_input_dynamic_state DONE (anv, lvp, nvk, radv, tu)
|
VK_EXT_vertex_input_dynamic_state DONE (anv, lvp, nvk, radv, tu, vn)
|
||||||
VK_EXT_ycbcr_image_arrays DONE (anv, hasvk, nvk, radv)
|
VK_EXT_ycbcr_image_arrays DONE (anv, hasvk, nvk, radv)
|
||||||
VK_ANDROID_external_memory_android_hardware_buffer DONE (anv, radv, vn)
|
VK_ANDROID_external_memory_android_hardware_buffer DONE (anv, radv, vn)
|
||||||
VK_ANDROID_native_buffer DONE (anv, radv, tu, v3dv, vn)
|
VK_ANDROID_native_buffer DONE (anv, radv, tu, v3dv, vn)
|
||||||
|
@@ -2340,3 +2340,17 @@ vn_CmdPushDescriptorSetWithTemplateKHR(
|
|||||||
|
|
||||||
mtx_unlock(&templ->mutex);
|
mtx_unlock(&templ->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vn_CmdSetVertexInputEXT(
|
||||||
|
VkCommandBuffer commandBuffer,
|
||||||
|
uint32_t vertexBindingDescriptionCount,
|
||||||
|
const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions,
|
||||||
|
uint32_t vertexAttributeDescriptionCount,
|
||||||
|
const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions)
|
||||||
|
{
|
||||||
|
VN_CMD_ENQUEUE(vkCmdSetVertexInputEXT, commandBuffer,
|
||||||
|
vertexBindingDescriptionCount, pVertexBindingDescriptions,
|
||||||
|
vertexAttributeDescriptionCount,
|
||||||
|
pVertexAttributeDescriptions);
|
||||||
|
}
|
||||||
|
@@ -171,6 +171,8 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
|
|||||||
VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback;
|
VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback;
|
||||||
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT
|
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT
|
||||||
vertex_attribute_divisor;
|
vertex_attribute_divisor;
|
||||||
|
VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT
|
||||||
|
vertex_input_dynamic_state;
|
||||||
} local_feats;
|
} local_feats;
|
||||||
|
|
||||||
/* Clear the struct so that all unqueried features will be VK_FALSE. */
|
/* Clear the struct so that all unqueried features will be VK_FALSE. */
|
||||||
@@ -261,6 +263,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
|
|||||||
VN_ADD_PNEXT_EXT(feats2, ROBUSTNESS_2_FEATURES_EXT, local_feats.robustness_2, exts->EXT_robustness2);
|
VN_ADD_PNEXT_EXT(feats2, ROBUSTNESS_2_FEATURES_EXT, local_feats.robustness_2, exts->EXT_robustness2);
|
||||||
VN_ADD_PNEXT_EXT(feats2, TRANSFORM_FEEDBACK_FEATURES_EXT, local_feats.transform_feedback, exts->EXT_transform_feedback);
|
VN_ADD_PNEXT_EXT(feats2, TRANSFORM_FEEDBACK_FEATURES_EXT, local_feats.transform_feedback, exts->EXT_transform_feedback);
|
||||||
VN_ADD_PNEXT_EXT(feats2, VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT, local_feats.vertex_attribute_divisor, exts->EXT_vertex_attribute_divisor);
|
VN_ADD_PNEXT_EXT(feats2, VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT, local_feats.vertex_attribute_divisor, exts->EXT_vertex_attribute_divisor);
|
||||||
|
VN_ADD_PNEXT_EXT(feats2, VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT, local_feats.vertex_input_dynamic_state, exts->EXT_vertex_input_dynamic_state);
|
||||||
|
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
@@ -1127,6 +1130,7 @@ vn_physical_device_get_passthrough_extensions(
|
|||||||
.EXT_shader_subgroup_ballot = true,
|
.EXT_shader_subgroup_ballot = true,
|
||||||
.EXT_transform_feedback = true,
|
.EXT_transform_feedback = true,
|
||||||
.EXT_vertex_attribute_divisor = true,
|
.EXT_vertex_attribute_divisor = true,
|
||||||
|
.EXT_vertex_input_dynamic_state = true,
|
||||||
|
|
||||||
/* vendor */
|
/* vendor */
|
||||||
.VALVE_mutable_descriptor_type = true,
|
.VALVE_mutable_descriptor_type = true,
|
||||||
|
@@ -363,6 +363,7 @@ struct vn_graphics_pipeline_create_info_fix {
|
|||||||
bool ignore_multisample_state;
|
bool ignore_multisample_state;
|
||||||
bool ignore_depth_stencil_state;
|
bool ignore_depth_stencil_state;
|
||||||
bool ignore_color_blend_state;
|
bool ignore_color_blend_state;
|
||||||
|
bool ignore_vertex_input_state;
|
||||||
bool ignore_base_pipeline_handle;
|
bool ignore_base_pipeline_handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -429,6 +430,7 @@ vn_fix_graphics_pipeline_create_info(
|
|||||||
bool viewport_with_count;
|
bool viewport_with_count;
|
||||||
bool scissor;
|
bool scissor;
|
||||||
bool scissor_with_count;
|
bool scissor_with_count;
|
||||||
|
bool vertex_input;
|
||||||
} has_dynamic_state = { 0 };
|
} has_dynamic_state = { 0 };
|
||||||
|
|
||||||
if (info->pDynamicState) {
|
if (info->pDynamicState) {
|
||||||
@@ -450,6 +452,9 @@ vn_fix_graphics_pipeline_create_info(
|
|||||||
case VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT:
|
case VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT:
|
||||||
has_dynamic_state.scissor_with_count = true;
|
has_dynamic_state.scissor_with_count = true;
|
||||||
break;
|
break;
|
||||||
|
case VK_DYNAMIC_STATE_VERTEX_INPUT_EXT:
|
||||||
|
has_dynamic_state.vertex_input = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -498,8 +503,10 @@ vn_fix_graphics_pipeline_create_info(
|
|||||||
* then vertex input state is included in a complete graphics pipeline.
|
* then vertex input state is included in a complete graphics pipeline.
|
||||||
*
|
*
|
||||||
* We support no extension yet that allows the vertex stage to be
|
* We support no extension yet that allows the vertex stage to be
|
||||||
* omitted, such as VK_EXT_vertex_input_dynamic_state or
|
* omitted such as VK_EXT_graphics_pipeline_library.
|
||||||
* VK_EXT_graphics_pipeline_library.
|
*
|
||||||
|
* VK_EXT_vertex_input_dynamic_state allows for the state to be set
|
||||||
|
* dynamically but vertex stage must be included regardless.
|
||||||
*/
|
*/
|
||||||
const bool UNUSED has_vertex_input_state = true;
|
const bool UNUSED has_vertex_input_state = true;
|
||||||
|
|
||||||
@@ -639,6 +646,17 @@ vn_fix_graphics_pipeline_create_info(
|
|||||||
any_fix |= fix.ignore_color_blend_state;
|
any_fix |= fix.ignore_color_blend_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ignore pVertexInputState?
|
||||||
|
* The Vulkan spec (1.3.264) says:
|
||||||
|
* VK_DYNAMIC_STATE_VERTEX_INPUT_EXT specifies that the
|
||||||
|
* pVertexInputState state will be ignored and must be set dynamically
|
||||||
|
* with vkCmdSetVertexInputEXT before any drawing commands
|
||||||
|
*/
|
||||||
|
if (info->pVertexInputState && has_dynamic_state.vertex_input) {
|
||||||
|
fix.ignore_vertex_input_state = true;
|
||||||
|
any_fix = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ignore basePipelineHandle?
|
/* Ignore basePipelineHandle?
|
||||||
* VUID-VkGraphicsPipelineCreateInfo-flags-00722
|
* VUID-VkGraphicsPipelineCreateInfo-flags-00722
|
||||||
* VUID-VkGraphicsPipelineCreateInfo-flags-00724
|
* VUID-VkGraphicsPipelineCreateInfo-flags-00724
|
||||||
@@ -692,6 +710,9 @@ vn_fix_graphics_pipeline_create_info(
|
|||||||
if (fix.ignore_color_blend_state)
|
if (fix.ignore_color_blend_state)
|
||||||
fixes->create_infos[i].pColorBlendState = NULL;
|
fixes->create_infos[i].pColorBlendState = NULL;
|
||||||
|
|
||||||
|
if (fix.ignore_vertex_input_state)
|
||||||
|
fixes->create_infos[i].pVertexInputState = NULL;
|
||||||
|
|
||||||
if (fix.ignore_base_pipeline_handle)
|
if (fix.ignore_base_pipeline_handle)
|
||||||
fixes->create_infos[i].basePipelineHandle = VK_NULL_HANDLE;
|
fixes->create_infos[i].basePipelineHandle = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user