From 7115bc3940c4c1952d503d9d56ebe6fd1fb11645 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 15 Aug 2013 13:10:22 -0400 Subject: draw: handle nan clipdistance If clipdistance for one of the vertices is nan (or inf) then the entire primitive should be discarded. Signed-off-by: Zack Rusin Reviewed-by: Roland Scheidegger --- src/gallium/auxiliary/draw/draw_llvm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium/auxiliary/draw/draw_llvm.c') diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 84e33926a2b..820d6b0013e 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1261,6 +1261,7 @@ generate_clipmask(struct draw_llvm *llvm, if (clip_user) { LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_ptr); LLVMValueRef indices[3]; + LLVMValueRef is_nan_or_inf; /* userclip planes */ while (ucp_enable) { @@ -1280,6 +1281,8 @@ generate_clipmask(struct draw_llvm *llvm, clipdist = LLVMBuildLoad(builder, outputs[cd[1]][i-4], ""); } test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, clipdist); + is_nan_or_inf = lp_build_is_inf_or_nan(gallivm, vs_type, clipdist); + test = LLVMBuildOr(builder, test, is_nan_or_inf, ""); temp = lp_build_const_int_vec(gallivm, i32_type, 1 << plane_idx); test = LLVMBuildAnd(builder, test, temp, ""); mask = LLVMBuildOr(builder, mask, test, ""); -- cgit v1.2.3