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

Author: Roland Scheidegger <srol...@vmware.com>
Date:   Fri Dec 11 22:49:01 2015 +0100

draw: use position not clipVertex output for xyz view volume clipping

I'm pretty sure this should use position (i.e. pre_clip_pos) and not
the output from clipVertex. Albeit piglit doesn't care. It is what we
use in the clip test, and it is what every other driver does (as they
don't even have clipVertex output and lower the additional planes to
clip distances).

Reviewed-by: Brian Paul <bri...@vmware.com
Reviewed-by: Jose Fonseca <jfons...@vmware.com>

---

 src/gallium/auxiliary/draw/draw_pipe_clip.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c 
b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 47765cd..ae21be0 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -345,13 +345,22 @@ static inline float getclipdist(const struct clip_stage 
*clipper,
 {
    const float *plane;
    float dp;
-   if (vert->have_clipdist && plane_idx >= 6) {
+   if (plane_idx < 6) {
+      /* ordinary xyz view volume clipping uses pos output */
+      plane = clipper->plane[plane_idx];
+      dp = dot4(vert->pre_clip_pos, plane);
+   }
+   else if (vert->have_clipdist) {
       /* pick the correct clipdistance element from the output vectors */
       int _idx = plane_idx - 6;
       int cdi = _idx >= 4;
       int vidx = cdi ? _idx - 4 : _idx;
       dp = 
vert->data[draw_current_shader_clipdistance_output(clipper->stage.draw, 
cdi)][vidx];
    } else {
+      /*
+       * legacy user clip planes or gl_ClipVertex
+       * (clip will contain clipVertex output if available, pos otherwise).
+       */
       plane = clipper->plane[plane_idx];
       dp = dot4(vert->clip, plane);
    }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to