v3dv: add support for primitive restarts on indexed draw calls
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 18 Feb 2020 10:08:44 +0000 (11:08 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:27 +0000 (21:21 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_pipeline.c
src/broadcom/vulkan/v3dv_private.h

index 1d57ec0..8426bb3 100644 (file)
@@ -2100,14 +2100,14 @@ v3dv_CmdDrawIndexed(VkCommandBuffer commandBuffer,
          prim.length = indexCount;
          prim.index_offset = index_offset;
          prim.mode = hw_prim_type;
-         prim.enable_primitive_restarts = false; /* FIXME */
+         prim.enable_primitive_restarts = pipeline->primitive_restart;
       }
    } else if (instanceCount > 1) {
       cl_emit(&job->bcl, INDEXED_INSTANCED_PRIM_LIST, prim) {
          prim.index_type = index_type;
          prim.index_offset = index_offset;
          prim.mode = hw_prim_type;
-         prim.enable_primitive_restarts = false; /* FIXME */
+         prim.enable_primitive_restarts = pipeline->primitive_restart;
          prim.number_of_instances = instanceCount;
          prim.instance_length = indexCount;
       }
@@ -2170,7 +2170,7 @@ v3dv_CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer,
    cl_emit(&job->bcl, INDIRECT_INDEXED_INSTANCED_PRIM_LIST, prim) {
       prim.index_type = index_type;
       prim.mode = hw_prim_type;
-      prim.enable_primitive_restarts = false; /* FIXME */
+      prim.enable_primitive_restarts = pipeline->primitive_restart;
       prim.number_of_draw_indirect_indexed_records = drawCount;
       prim.stride_in_multiples_of_4_bytes = stride >> 2;
       prim.address = v3dv_cl_address(buffer->mem->bo, offset);
index c0df726..69d6155 100644 (file)
@@ -1633,6 +1633,9 @@ pipeline_init(struct v3dv_pipeline *pipeline,
    pack_stencil_cfg(pipeline, ds_info);
    pipeline_set_ez_state(pipeline, ds_info);
 
+   pipeline->primitive_restart =
+      pCreateInfo->pInputAssemblyState->primitiveRestartEnable;
+
    result = pipeline_compile_graphics(pipeline, pCreateInfo, alloc);
 
    if (result != VK_SUCCESS) {
index 83bb55a..4ea6cd8 100644 (file)
@@ -809,6 +809,8 @@ struct v3dv_pipeline {
 
    enum v3dv_ez_state ez_state;
 
+   bool primitive_restart;
+
    /* Accessed by binding. So vb[binding]->stride is the stride of the vertex
     * array with such binding
     */