Module: Mesa
Branch: master
Commit: ebb2297a91027f55460e79498525bfd385444569
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebb2297a91027f55460e79498525bfd385444569

Author: Alejandro PiƱeiro <[email protected]>
Date:   Wed Mar 10 14:23:33 2021 +0100

v3dv/pipeline: move topology to pipeline

So now we only store it once per pipeline, instead of once per
pipeline stage.

Reviewed-by: Iago Toral Quiroga <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9403>

---

 src/broadcom/vulkan/v3dv_cmd_buffer.c |  8 ++++----
 src/broadcom/vulkan/v3dv_pipeline.c   | 13 +++++--------
 src/broadcom/vulkan/v3dv_private.h    |  7 ++-----
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c 
b/src/broadcom/vulkan/v3dv_cmd_buffer.c
index e71566fc0e4..bbb54a45d76 100644
--- a/src/broadcom/vulkan/v3dv_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c
@@ -4134,7 +4134,7 @@ cmd_buffer_emit_draw(struct v3dv_cmd_buffer *cmd_buffer,
 
    assert(pipeline);
 
-   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
+   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
 
    if (info->first_instance > 0) {
       v3dv_cl_ensure_space_with_branch(
@@ -4404,7 +4404,7 @@ v3dv_CmdDrawIndexed(VkCommandBuffer commandBuffer,
    assert(job);
 
    const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
-   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
+   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
    uint8_t index_type = ffs(cmd_buffer->state.index_buffer.index_size) - 1;
    uint32_t index_offset = firstIndex * 
cmd_buffer->state.index_buffer.index_size;
 
@@ -4467,7 +4467,7 @@ v3dv_CmdDrawIndirect(VkCommandBuffer commandBuffer,
    assert(job);
 
    const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
-   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
+   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
 
    v3dv_cl_ensure_space_with_branch(
       &job->bcl, cl_packet_length(INDIRECT_VERTEX_ARRAY_INSTANCED_PRIMS));
@@ -4502,7 +4502,7 @@ v3dv_CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer,
    assert(job);
 
    const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
-   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
+   uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
    uint8_t index_type = ffs(cmd_buffer->state.index_buffer.index_size) - 1;
 
    v3dv_cl_ensure_space_with_branch(
diff --git a/src/broadcom/vulkan/v3dv_pipeline.c 
b/src/broadcom/vulkan/v3dv_pipeline.c
index ab86ec88381..0283a51614c 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -1740,13 +1740,6 @@ pipeline_compile_vertex_shader(struct v3dv_pipeline 
*pipeline,
    if (pipeline->vs_bin == NULL)
       return VK_ERROR_OUT_OF_HOST_MEMORY;
 
-   /* FIXME: likely this to be moved to a gather info method to a full
-    * struct inside pipeline_stage
-    */
-   const VkPipelineInputAssemblyStateCreateInfo *ia_info =
-      pCreateInfo->pInputAssemblyState;
-   pipeline->vs->topology = vk_to_pipe_prim_type[ia_info->topology];
-
    struct v3d_vs_key *key = &pipeline->vs->key.vs;
    pipeline_populate_v3d_vs_key(key, pCreateInfo, pipeline->vs);
    VkResult vk_result;
@@ -2449,7 +2442,7 @@ pack_shader_state_record(struct v3dv_pipeline *pipeline)
       shader.enable_clipping = true;
 
       shader.point_size_in_shaded_vertex_data =
-         pipeline->vs->topology == PIPE_PRIM_POINTS;
+         pipeline->topology == PIPE_PRIM_POINTS;
 
       /* Must be set if the shader modifies Z, discards, or modifies
        * the sample mask.  For any of these cases, the fragment
@@ -2749,6 +2742,10 @@ pipeline_init(struct v3dv_pipeline *pipeline,
    pipeline->pass = render_pass;
    pipeline->subpass = &render_pass->subpasses[pCreateInfo->subpass];
 
+   const VkPipelineInputAssemblyStateCreateInfo *ia_info =
+      pCreateInfo->pInputAssemblyState;
+   pipeline->topology = vk_to_pipe_prim_type[ia_info->topology];
+
    /* If rasterization is not enabled, various CreateInfo structs must be
     * ignored.
     */
diff --git a/src/broadcom/vulkan/v3dv_private.h 
b/src/broadcom/vulkan/v3dv_private.h
index 78ab25643df..179dcbb4d4f 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -1378,11 +1378,6 @@ struct v3dv_pipeline_stage {
    } key;
 
    struct v3dv_shader_variant*current_variant;
-
-   /* FIXME: only make sense on vs, so perhaps a v3dv key like radv? or a kind
-    * of pipe_draw_info
-    */
-   enum pipe_prim_type topology;
 };
 
 /* FIXME: although the full vpm_config is not required at this point, as we
@@ -1654,6 +1649,8 @@ struct v3dv_pipeline {
    } va[MAX_VERTEX_ATTRIBS];
    uint32_t va_count;
 
+   enum pipe_prim_type topology;
+
    struct v3dv_descriptor_map ubo_map;
    struct v3dv_descriptor_map ssbo_map;
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to