From 83554840a5afb371dc6560dbca16f9219c723ad2 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 18 Feb 2020 11:08:44 +0100 Subject: [PATCH] v3dv: add support for primitive restarts on indexed draw calls Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 6 +++--- src/broadcom/vulkan/v3dv_pipeline.c | 3 +++ src/broadcom/vulkan/v3dv_private.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index 1d57ec0..8426bb3 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -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); diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index c0df726..69d6155 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -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) { diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index 83bb55a..4ea6cd8 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -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 */ -- 2.7.4