venus: add support for VK_EXT_multi_draw
authorJuston Li <justonli@chromium.org>
Tue, 23 Aug 2022 20:22:10 +0000 (13:22 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 13 Sep 2022 19:20:55 +0000 (19:20 +0000)
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 <justonli@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18304>

src/virtio/vulkan/vn_command_buffer.c
src/virtio/vulkan/vn_physical_device.c
src/virtio/vulkan/vn_physical_device.h

index a4a76de..0276aff 100644 (file)
@@ -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));
+}
index f9969e6..c6d0b1c 100644 (file)
@@ -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);
index 9dd08f8..8cc9830 100644 (file)
@@ -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;