summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-23 20:05:36 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-23 20:05:36 +0100
commite841b92d9c8bf48085b4996df828ae745977f931 (patch)
tree6ca64f21b37bb5bd70f904ba110610385a4a94a1
parent333d377bbda4f598292108f91cd8ec4f0f647c20 (diff)
mesa: further degenerate the special case lit substitute
-rw-r--r--src/mesa/main/ffvertex_prog.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 623c2a64b5..90b156f812 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -953,19 +953,19 @@ static void emit_degenerate_lit( struct tnl_program *p,
{
struct ureg id = get_identity_param(p);
- /* 1, 0, 0, 1
+ /* Note that result.x & result.w will not be examined. Note also that
+ * dots.xyzw == dots.xxxx.
*/
- emit_op1(p, OPCODE_MOV, lit, 0, swizzle(id, Z, X, X, Z));
- /* 1, MAX2(in[0], 0), 0, 1
+ /* result[1] = MAX2(in, 0)
*/
- emit_op2(p, OPCODE_MAX, lit, WRITEMASK_Y, lit, swizzle1(dots, X));
+ emit_op2(p, OPCODE_MAX, lit, 0, id, dots);
- /* 1, MAX2(in[0], 0), (in[0] > 0 ? 1 : 0), 1
+ /* result[2] = (in > 0 ? 1 : 0)
*/
emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z,
lit, /* 0 */
- swizzle1(dots, X)); /* in[0] */
+ dots); /* in[0] */
}
@@ -1122,10 +1122,13 @@ static void build_lighting( struct tnl_program *p )
/* Calculate dot products:
*/
- emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli);
-
- if (!p->state->material_shininess_is_zero)
+ if (p->state->material_shininess_is_zero) {
+ emit_op2(p, OPCODE_DP3, dots, 0, normal, VPpli);
+ }
+ else {
+ emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli);
emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half);
+ }
/* Front face lighting:
*/