summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_clip_tri.c
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2013-08-04 18:31:56 +1200
committerChris Forbes <chrisf@ijw.co.nz>2013-08-16 07:24:55 +1200
commit45540921eceed47688493e93a003f86ccbe9038c (patch)
treefce1a50e19af3d3de8a788db60a688c0fa877950 /src/mesa/drivers/dri/i965/brw_clip_tri.c
parentbf9ede92c2711d1e8d7fee8b759d8f4c3c2c4df6 (diff)
downloadexternal_mesa3d-45540921eceed47688493e93a003f86ccbe9038c.zip
external_mesa3d-45540921eceed47688493e93a003f86ccbe9038c.tar.gz
external_mesa3d-45540921eceed47688493e93a003f86ccbe9038c.tar.bz2
i965/clip: Use clip distances for all user clipping
V2: Adjust explanation of load_clip_distance() Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_clip_tri.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_tri.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c
index bf221ca..090d203 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_tri.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c
@@ -228,9 +228,7 @@ void brw_clip_tri_flat_shade( struct brw_clip_compile *c )
* a comparison of it to zero with the condition `cond`.
*
* - If using a fixed plane, the distance is dot(hpos, plane).
- * - If using a user clip plane, the distance is dot(clipvertex, plane).
- * Elsewhere we arrange for clipvertex to be mapped to hpos if no
- * explicit clipvertex value was provided by the previous shader.
+ * - If using a user clip plane, the distance is directly available in the vertex.
*/
static inline void
load_clip_distance(struct brw_clip_compile *c, struct brw_indirect vtx,
@@ -244,16 +242,19 @@ load_clip_distance(struct brw_clip_compile *c, struct brw_indirect vtx,
brw_AND(p, vec1(brw_null_reg()), c->reg.vertex_src_mask, brw_imm_ud(1));
brw_IF(p, BRW_EXECUTE_1);
{
- brw_MOV(p, dst, deref_4f(vtx, clip_offset));
+ struct brw_indirect temp_ptr = brw_indirect(7, 0);
+ brw_ADD(p, get_addr_reg(temp_ptr), get_addr_reg(vtx), c->reg.clipdistance_offset);
+ brw_MOV(p, vec1(dst), deref_1f(temp_ptr, 0));
}
brw_ELSE(p);
{
brw_MOV(p, dst, deref_4f(vtx, hpos_offset));
+ brw_DP4(p, dst, dst, c->reg.plane_equation);
}
brw_ENDIF(p);
brw_set_conditionalmod(p, cond);
- brw_DP4(p, dst, dst, c->reg.plane_equation);
+ brw_CMP(p, brw_null_reg(), cond, vec1(dst), brw_imm_f(0.0f));
}