Mesa (master): draw: don't emit vertex to streams with no outputs

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


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jan 23 17:17:21 2020 +1000

draw: don't emit vertex to streams with no outputs

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 0960124bafe..0701082850f 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1557,12 +1557,17 @@ draw_gs_llvm_emit_vertex(const struct lp_build_gs_iface *gs_base,
       indices[i] = LLVMBuildAdd(builder, indices[i], currently_emitted, "");
    }
 
+   LLVMValueRef stream_idx = LLVMBuildExtractElement(builder, stream_id, lp_build_const_int32(gallivm, 0), "");
+   LLVMValueRef cnd = LLVMBuildICmp(builder, LLVMIntULT, stream_idx, lp_build_const_int32(gallivm, variant->shader->base.num_vertex_streams), "");
+   struct lp_build_if_state if_ctx;
+   lp_build_if(&if_ctx, gallivm, cnd);
    io = lp_build_pointer_get(builder, io, LLVMBuildExtractElement(builder, stream_id, lp_build_const_int32(gallivm, 0), ""));
 
    convert_to_aos(gallivm, io, indices,
                   outputs, clipmask,
                   gs_info->num_outputs, gs_type,
                   FALSE);
+   lp_build_endif(&if_ctx);
 }
 
 static void



More information about the mesa-commit mailing list