diff options
author | Zack Rusin <[email protected]> | 2013-08-15 13:10:22 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-08-15 16:26:32 -0400 |
commit | 7115bc3940c4c1952d503d9d56ebe6fd1fb11645 (patch) | |
tree | 53e95c9973f39b3baaf476b968725617c11ce02d /src/gallium/auxiliary/draw/draw_llvm.c | |
parent | 035bf2198368d3fa69387788a63039d71319f0bf (diff) |
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 <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 3 |
1 files changed, 3 insertions, 0 deletions
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, ""); |