Module: Mesa Branch: main Commit: a6e6ffb70392cd346a515c1f2ded6116025fbee5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6e6ffb70392cd346a515c1f2ded6116025fbee5
Author: Juston Li <[email protected]> Date: Tue Aug 23 13:22:10 2022 -0700 venus: add support for VK_EXT_multi_draw Test: ./deqp-vk -n dEQP-VK.draw.*multi_draw* Test run totals: Passed: 11520/11520 (100.0%) Failed: 0/11520 (0.0%) Not supported: 0/11520 (0.0%) Warnings: 0/11520 (0.0%) Waived: 0/11520 (0.0%) Signed-off-by: Juston Li <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18304> --- src/virtio/vulkan/vn_command_buffer.c | 32 ++++++++++++++++++++++++++++++++ src/virtio/vulkan/vn_physical_device.c | 7 +++++++ src/virtio/vulkan/vn_physical_device.h | 2 ++ 3 files changed, 41 insertions(+) diff --git a/src/virtio/vulkan/vn_command_buffer.c b/src/virtio/vulkan/vn_command_buffer.c index a4a76dece9e..0276aff4dad 100644 --- a/src/virtio/vulkan/vn_command_buffer.c +++ b/src/virtio/vulkan/vn_command_buffer.c @@ -1775,3 +1775,35 @@ vn_CmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer) { VN_CMD_ENQUEUE(vkCmdEndConditionalRenderingEXT, commandBuffer); } + +void +vn_CmdDrawMultiEXT(VkCommandBuffer commandBuffer, + uint32_t drawCount, + const VkMultiDrawInfoEXT *pVertexInfo, + uint32_t instanceCount, + uint32_t firstInstance, + uint32_t stride) +{ + VN_CMD_ENQUEUE(vkCmdDrawMultiEXT, commandBuffer, drawCount, pVertexInfo, + instanceCount, firstInstance, stride); + + vn_cmd_count_draw_and_submit_on_batch_limit( + vn_command_buffer_from_handle(commandBuffer)); +} + +void +vn_CmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, + uint32_t drawCount, + const VkMultiDrawIndexedInfoEXT *pIndexInfo, + uint32_t instanceCount, + uint32_t firstInstance, + uint32_t stride, + const int32_t *pVertexOffset) +{ + VN_CMD_ENQUEUE(vkCmdDrawMultiIndexedEXT, commandBuffer, drawCount, + pIndexInfo, instanceCount, firstInstance, stride, + pVertexOffset); + + vn_cmd_count_draw_and_submit_on_batch_limit( + vn_command_buffer_from_handle(commandBuffer)); +} diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index f9969e60f0a..c6d0b1cb060 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -179,6 +179,8 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) VN_ADD_EXT_TO_PNEXT(exts->EXT_line_rasterization, feats->line_rasterization, LINE_RASTERIZATION_FEATURES_EXT, features2); + VN_ADD_EXT_TO_PNEXT(exts->EXT_multi_draw, feats->multi_draw, + MULTI_DRAW_FEATURES_EXT, features2); VN_ADD_EXT_TO_PNEXT(exts->EXT_primitive_topology_list_restart, feats->primitive_topology_list_restart, PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT, @@ -536,6 +538,8 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev) VN_ADD_EXT_TO_PNEXT(exts->EXT_line_rasterization, props->line_rasterization, LINE_RASTERIZATION_PROPERTIES_EXT, properties2); + VN_ADD_EXT_TO_PNEXT(exts->EXT_multi_draw, props->multi_draw, + MULTI_DRAW_PROPERTIES_EXT, properties2); VN_ADD_EXT_TO_PNEXT(exts->EXT_provoking_vertex, props->provoking_vertex, PROVOKING_VERTEX_PROPERTIES_EXT, properties2); VN_ADD_EXT_TO_PNEXT(exts->EXT_robustness2, props->robustness_2, @@ -1122,6 +1126,7 @@ vn_physical_device_get_passthrough_extensions( .EXT_image_view_min_lod = true, .EXT_index_type_uint8 = true, .EXT_line_rasterization = true, + .EXT_multi_draw = true, .EXT_primitive_topology_list_restart = true, /* TODO(VK_EXT_private_data): Support natively. * @@ -1758,6 +1763,7 @@ vn_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, CASE(DEPTH_CLIP_ENABLE_FEATURES_EXT, depth_clip_enable); CASE(INDEX_TYPE_UINT8_FEATURES_EXT, index_type_uint8); CASE(LINE_RASTERIZATION_FEATURES_EXT, line_rasterization); + CASE(MULTI_DRAW_FEATURES_EXT, multi_draw); CASE(PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT, primitive_topology_list_restart); CASE(PROVOKING_VERTEX_FEATURES_EXT, provoking_vertex); CASE(ROBUSTNESS_2_FEATURES_EXT, robustness_2); @@ -1815,6 +1821,7 @@ vn_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, CASE(CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT, conservative_rasterization); CASE(CUSTOM_BORDER_COLOR_PROPERTIES_EXT, custom_border_color); CASE(LINE_RASTERIZATION_PROPERTIES_EXT, line_rasterization); + CASE(MULTI_DRAW_PROPERTIES_EXT, multi_draw); CASE(MAINTENANCE_4_PROPERTIES, maintenance4); CASE(PROVOKING_VERTEX_PROPERTIES_EXT, provoking_vertex); CASE(ROBUSTNESS_2_PROPERTIES_EXT, robustness_2); diff --git a/src/virtio/vulkan/vn_physical_device.h b/src/virtio/vulkan/vn_physical_device.h index 9dd08f86ae3..8cc9830f8d5 100644 --- a/src/virtio/vulkan/vn_physical_device.h +++ b/src/virtio/vulkan/vn_physical_device.h @@ -51,6 +51,7 @@ struct vn_physical_device_features { VkPhysicalDeviceImageViewMinLodFeaturesEXT image_view_min_lod; VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8; VkPhysicalDeviceLineRasterizationFeaturesEXT line_rasterization; + VkPhysicalDeviceMultiDrawFeaturesEXT multi_draw; VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT primitive_topology_list_restart; VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex; @@ -82,6 +83,7 @@ struct vn_physical_device_properties { conservative_rasterization; VkPhysicalDeviceCustomBorderColorPropertiesEXT custom_border_color; VkPhysicalDeviceLineRasterizationPropertiesEXT line_rasterization; + VkPhysicalDeviceMultiDrawPropertiesEXT multi_draw; VkPhysicalDeviceProvokingVertexPropertiesEXT provoking_vertex; VkPhysicalDeviceRobustness2PropertiesEXT robustness_2; VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback;
