Mesa (master): gallivm/swr: add stream_id to geom epilogue emit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 7 01:34:48 UTC 2020


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jan 23 16:13:24 2020 +1000

gallivm/swr: add stream_id to geom epilogue emit

We want to pass a stream in here so we can write out separate
prim/vertex counts for each stream at the end.

This also adds an ignore any stream option so we can stage more code

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

---

 src/gallium/auxiliary/draw/draw_llvm.c          | 7 +++++--
 src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c  | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h     | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 2 +-
 src/gallium/drivers/swr/swr_shader.cpp          | 8 ++++----
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index ca5cd6a3726..f1ca2dbd5a0 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1597,7 +1597,7 @@ draw_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
 static void
 draw_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
                       LLVMValueRef total_emitted_vertices_vec,
-                      LLVMValueRef emitted_prims_vec)
+                      LLVMValueRef emitted_prims_vec, unsigned stream)
 {
    const struct draw_gs_llvm_iface *gs_iface = draw_gs_llvm_iface(gs_base);
    struct draw_gs_llvm_variant *variant = gs_iface->variant;
@@ -1608,7 +1608,10 @@ draw_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
    LLVMValueRef emitted_prims_ptr =
       draw_gs_jit_emitted_prims(gallivm, variant->context_ptr);
    LLVMValueRef zero = lp_build_const_int32(gallivm, 0);
-   
+
+   if (stream > 0)
+      return;
+
    emitted_verts_ptr = LLVMBuildGEP(builder, emitted_verts_ptr, &zero, 0, "");
    emitted_prims_ptr = LLVMBuildGEP(builder, emitted_prims_ptr, &zero, 0, "");
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index 1457cb15f28..828cf5e7028 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -1607,7 +1607,7 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
 
       bld.gs_iface->gs_epilogue(bld.gs_iface,
                                  total_emitted_vertices_vec,
-                                 emitted_prims_vec);
+                                 emitted_prims_vec, 0);
    }
    lp_exec_mask_fini(&bld.exec_mask);
 }
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index e8cbceb27fa..380579c3f70 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -424,7 +424,7 @@ struct lp_build_gs_iface
                          LLVMValueRef mask_vec);
    void (*gs_epilogue)(const struct lp_build_gs_iface *gs_iface,
                        LLVMValueRef total_emitted_vertices_vec,
-                       LLVMValueRef emitted_prims_vec);
+                       LLVMValueRef emitted_prims_vec, unsigned stream);
 };
 
 struct lp_build_tcs_iface
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index b1a2e96e804..913fcb2a914 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -4371,7 +4371,7 @@ static void emit_epilogue(struct lp_build_tgsi_context * bld_base)
 
       bld->gs_iface->gs_epilogue(bld->gs_iface,
                                  total_emitted_vertices_vec,
-                                 emitted_prims_vec);
+                                 emitted_prims_vec, 0);
    } else {
       gather_outputs(bld);
    }
diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
index fcbdcd54369..c4d0bb2fc52 100644
--- a/src/gallium/drivers/swr/swr_shader.cpp
+++ b/src/gallium/drivers/swr/swr_shader.cpp
@@ -363,7 +363,7 @@ struct BuilderSWR : public Builder {
    void
    swr_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
                         LLVMValueRef total_emitted_vertices_vec,
-                        LLVMValueRef emitted_prims_vec);
+                        LLVMValueRef emitted_prims_vec, unsigned stream);
 
    // TCS-specific emit functions
    void swr_tcs_llvm_emit_prologue(struct lp_build_tgsi_soa_context* bld);
@@ -524,13 +524,13 @@ swr_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
 static void
 swr_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
                         LLVMValueRef total_emitted_vertices_vec,
-                        LLVMValueRef emitted_prims_vec)
+                        LLVMValueRef emitted_prims_vec, unsigned stream)
 {
     swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_base;
 
     iface->pBuilder->swr_gs_llvm_epilogue(gs_base,
                                          total_emitted_vertices_vec,
-                                         emitted_prims_vec);
+                                         emitted_prims_vec, stream);
 }
 
 static LLVMValueRef
@@ -909,7 +909,7 @@ BuilderSWR::swr_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
 void
 BuilderSWR::swr_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
                         LLVMValueRef total_emitted_vertices_vec,
-                        LLVMValueRef emitted_prims_vec)
+                        LLVMValueRef emitted_prims_vec, unsigned stream)
 {
    swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_base;
 



More information about the mesa-commit mailing list