summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2006-09-04 23:34:36 +0000
committerKeith Whitwell <[email protected]>2006-09-04 23:34:36 +0000
commit74b2166ff8e285ab2f9e49b48531619863ac78b2 (patch)
treea9a8f88457a566f14b7dc6c13e860da47d6d97ef /src/mesa/drivers
parentf65ad97469c023f03f30ec27f4cf92ee3edb267f (diff)
Fixes for calculating point attenuation
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_tnl.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
index b296883d3bf..bfa0ddf80c4 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
@@ -1375,21 +1375,26 @@ static void build_pointsize( struct tnl_program *p )
struct ureg out = register_output(p, VERT_RESULT_PSIZ);
struct ureg ut = get_temp(p);
- /* 1, -Z, Z * Z, 1 */
- emit_op1(p, OPCODE_MOV, ut, 0, swizzle1(get_identity_param(p), W));
- emit_op2(p, OPCODE_MUL, ut, WRITEMASK_YZ, ut, ureg_negate(swizzle1(eye, Z)));
- emit_op2(p, OPCODE_MUL, ut, WRITEMASK_Z, ut, ureg_negate(swizzle1(eye, Z)));
+ /* 1, Z, Z * Z, 1 */
+ emit_op1(p, OPCODE_MOV, ut, WRITEMASK_XW, swizzle1(get_identity_param(p), W));
+ emit_op1(p, OPCODE_ABS, ut, WRITEMASK_YZ, swizzle1(eye, Z));
+ emit_op2(p, OPCODE_MUL, ut, WRITEMASK_Z, ut, ut);
/* p1 + p2 * dist + p3 * dist * dist, 0 */
- emit_op2(p, OPCODE_DP3, ut, 0, ut, state_attenuation);
+ emit_op2(p, OPCODE_DP3, ut, WRITEMASK_X, ut, state_attenuation);
- /* 1 / factor */
- emit_op1(p, OPCODE_RCP, ut, 0, ut );
+ /* 1 / sqrt(factor) */
+ emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut );
- /* out = pointSize / factor */
- emit_op2(p, OPCODE_MUL, out, WRITEMASK_X, ut, state_size);
+ /* ut = pointSize / factor */
+ emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size);
+ /* Clamp to min/max - state_size.[yz]
+ */
+ emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y));
+ emit_op2(p, OPCODE_MIN, out, 0, swizzle1(ut, X), swizzle1(state_size, Z));
+
release_temp(p, ut);
}