Mesa (master): gallivm/draw/gs: pass vertex stream count into shader build

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 7 20:37:17 UTC 2020


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jun 19 14:54:16 2020 +1000

gallivm/draw/gs: pass vertex stream count into shader build

The shader builder can avoid iterations using this info.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

---

 src/gallium/auxiliary/draw/draw_llvm.c         | 1 +
 src/gallium/auxiliary/gallivm/lp_bld_nir.h     | 1 +
 src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 5 +++--
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h    | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 41018e82dcf..529b1b7f0c3 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -2855,6 +2855,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
    params.ssbo_ptr = ssbos_ptr;
    params.ssbo_sizes_ptr = num_ssbos_ptr;
    params.image = image;
+   params.gs_vertex_streams = variant->shader->base.num_vertex_streams;
 
    if (llvm->draw->gs.geometry_shader->state.type == PIPE_SHADER_IR_TGSI)
       lp_build_tgsi_soa(variant->gallivm,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.h b/src/gallium/auxiliary/gallivm/lp_bld_nir.h
index c124cd59ba8..7f29575bad5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.h
@@ -235,6 +235,7 @@ struct lp_build_nir_soa_context
    LLVMValueRef inputs_array;
 
    LLVMValueRef kernel_args_ptr;
+   unsigned gs_vertex_streams;
 };
 
 bool
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index 1a28e21f457..c6119c509f8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -1879,9 +1879,10 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
    if (bld.gs_iface) {
       struct lp_build_context *uint_bld = &bld.bld_base.uint_bld;
 
+      bld.gs_vertex_streams = params->gs_vertex_streams;
       bld.max_output_vertices_vec = lp_build_const_int_vec(gallivm, bld.bld_base.int_bld.type,
                                                            shader->info.gs.vertices_out);
-      for (int i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++) {
+      for (int i = 0; i < params->gs_vertex_streams; i++) {
          bld.emitted_prims_vec_ptr[i] =
             lp_build_alloca(gallivm, uint_bld->vec_type, "emitted_prims_ptr");
          bld.emitted_vertices_vec_ptr[i] =
@@ -1904,7 +1905,7 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
       LLVMValueRef total_emitted_vertices_vec;
       LLVMValueRef emitted_prims_vec;
 
-      for (int i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++) {
+      for (int i = 0; i < params->gs_vertex_streams; i++) {
          end_primitive_masked(&bld.bld_base, lp_build_mask_value(bld.mask), i);
 
          total_emitted_vertices_vec =
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index de5cd4187dd..4333e6d8e94 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -279,6 +279,7 @@ struct lp_build_tgsi_params {
    const struct lp_build_coro_suspend_info *coro;
    LLVMValueRef kernel_args;
    const struct lp_build_fs_iface *fs_iface;
+   unsigned gs_vertex_streams;
 };
 
 void



More information about the mesa-commit mailing list