mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
vulkan: add tracking for VK_EXT_primitive_restart_index
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40776>
This commit is contained in:
parent
98c298cf4d
commit
a4737d0430
2 changed files with 45 additions and 0 deletions
|
|
@ -52,6 +52,7 @@ get_dynamic_state_groups(BITSET_WORD *dynamic,
|
|||
if (groups & MESA_VK_GRAPHICS_STATE_INPUT_ASSEMBLY_BIT) {
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_TOPOLOGY);
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_RESTART_ENABLE);
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_RESTART_INDEX);
|
||||
}
|
||||
|
||||
if (groups & MESA_VK_GRAPHICS_STATE_TESSELLATION_BIT) {
|
||||
|
|
@ -2480,6 +2481,20 @@ vk_cmd_set_vertex_binding_strides2(struct vk_command_buffer *cmd,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
vk_cmd_set_index_buffer_type(struct vk_command_buffer *cmd,
|
||||
VkIndexType index_type)
|
||||
{
|
||||
struct vk_dynamic_graphics_state *dyn = &cmd->dynamic_graphics_state;
|
||||
|
||||
/* From the Vulkan 1.4.348 spec, vkCmdSetPrimitiveRestartIndexEXT():
|
||||
*
|
||||
* "Binding an index buffer invalidates the custom index value."
|
||||
*/
|
||||
SET_DYN_VALUE(dyn, IA_PRIMITIVE_RESTART_INDEX,
|
||||
ia.primitive_restart_index, vk_index_to_restart(index_type));
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_CmdSetPrimitiveTopology(VkCommandBuffer commandBuffer,
|
||||
VkPrimitiveTopology primitiveTopology)
|
||||
|
|
@ -2502,6 +2517,17 @@ vk_common_CmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer,
|
|||
ia.primitive_restart_enable, primitiveRestartEnable);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_CmdSetPrimitiveRestartIndexEXT(VkCommandBuffer commandBuffer,
|
||||
uint32_t primitiveRestartIndex)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_command_buffer, cmd, commandBuffer);
|
||||
struct vk_dynamic_graphics_state *dyn = &cmd->dynamic_graphics_state;
|
||||
|
||||
SET_DYN_VALUE(dyn, IA_PRIMITIVE_RESTART_INDEX,
|
||||
ia.primitive_restart_index, primitiveRestartIndex);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_CmdSetPatchControlPointsEXT(VkCommandBuffer commandBuffer,
|
||||
uint32_t patchControlPoints)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ enum mesa_vk_dynamic_graphics_state {
|
|||
MESA_VK_DYNAMIC_VI_BINDING_STRIDES,
|
||||
MESA_VK_DYNAMIC_IA_PRIMITIVE_TOPOLOGY,
|
||||
MESA_VK_DYNAMIC_IA_PRIMITIVE_RESTART_ENABLE,
|
||||
MESA_VK_DYNAMIC_IA_PRIMITIVE_RESTART_INDEX,
|
||||
MESA_VK_DYNAMIC_TS_PATCH_CONTROL_POINTS,
|
||||
MESA_VK_DYNAMIC_TS_DOMAIN_ORIGIN,
|
||||
MESA_VK_DYNAMIC_VP_VIEWPORT_COUNT,
|
||||
|
|
@ -184,6 +185,12 @@ struct vk_input_assembly_state {
|
|||
* MESA_VK_DYNAMIC_GRAPHICS_STATE_IA_PRIMITIVE_RESTART_ENABLE
|
||||
*/
|
||||
bool primitive_restart_enable;
|
||||
|
||||
/** vkCmdBindIndexBuffer(indexType) or vkCmdSetPrimitiveRestartIndexEXT()
|
||||
*
|
||||
* MESA_VK_DYNAMIC_GRAPHICS_STATE_IA_PRIMITIVE_RESTART_INDEX
|
||||
*/
|
||||
uint32_t primitive_restart_index;
|
||||
};
|
||||
|
||||
/***/
|
||||
|
|
@ -1311,6 +1318,18 @@ vk_cmd_set_vertex_binding_strides2(struct vk_command_buffer *cmd,
|
|||
uint32_t binding_count,
|
||||
const VkBindVertexBuffer3InfoKHR *bindings);
|
||||
|
||||
/** Set index buffer type on a command buffer
|
||||
*
|
||||
* This is the dynamic state part of vkCmdBindIndexBuffers2() &
|
||||
* vkCmdSetPrimitiveRestartIndexEXT().
|
||||
*
|
||||
* :param cmd: |inout| Command buffer to update
|
||||
* :param index_type: |in|
|
||||
*/
|
||||
void
|
||||
vk_cmd_set_index_buffer_type(struct vk_command_buffer *cmd,
|
||||
VkIndexType index_type);
|
||||
|
||||
/* Set color attachment count for blending on a command buffer.
|
||||
*
|
||||
* This is an implicit part of starting a subpass or a secondary command
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue