gallivm/swr: add stream_id to geom epilogue emit
authorDave Airlie <airlied@redhat.com>
Thu, 23 Jan 2020 06:13:24 +0000 (16:13 +1000)
committerMarge Bot <eric+marge@anholt.net>
Fri, 7 Feb 2020 00:54:42 +0000 (00:54 +0000)
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@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3530>

src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/drivers/swr/swr_shader.cpp

index ca5cd6a3726498b6977f1e0ef1cabf0c83f4f5bc..f1ca2dbd5a09d6e16bd5b4f9b35240ea7eafc045 100644 (file)
@@ -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, "");
 
index 1457cb15f28c089b7be6186debaf24f238e71b57..828cf5e7028ae169a0022515c7ab1d0b0cd3605e 100644 (file)
@@ -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);
 }
index e8cbceb27fa3dae564e7975097ef0a844bf99817..380579c3f70f44be02c2fe63a894e990b0ec4dca 100644 (file)
@@ -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
index b1a2e96e804a13807dac1757fb578f6847094b7f..913fcb2a914b12a1512026a42c060ad52ace9657 100644 (file)
@@ -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);
    }
index fcbdcd54369aaf5fc3fd9a4d30c1b5aed2e6b368..c4d0bb2fc52c12043aee34772f92b0efd777ce5c 100644 (file)
@@ -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;