mesa: add dlist support for indexed colormask and indexed enables/disables
[mesa.git] / src / mesa / main / ffvertex_prog.c
index 80dde4b5aa2338a93a79d3db5ddd4625f3266d7e..2d1db29cbfe556398c737b6c9c6fa23af8ce44e9 100644 (file)
@@ -46,6 +46,9 @@
 #include "shader/prog_statevars.h"
 
 
+/** Max of number of lights and texture coord units */
+#define NUM_UNITS MAX2(MAX_TEXTURE_COORD_UNITS, MAX_LIGHTS)
+
 struct state_key {
    unsigned light_color_material_mask:12;
    unsigned light_global_enabled:1;
@@ -77,7 +80,7 @@ struct state_key {
       unsigned texgen_mode1:4;
       unsigned texgen_mode2:4;
       unsigned texgen_mode3:4;
-   } unit[8];
+   } unit[NUM_UNITS];
 };
 
 
@@ -354,7 +357,7 @@ static struct ureg get_temp( struct tnl_program *p )
    int bit = _mesa_ffs( ~p->temp_in_use );
    if (!bit) {
       _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
-      _mesa_exit(1);
+      exit(1);
    }
 
    if ((GLuint) bit > p->program->Base.NumTemporaries)
@@ -435,7 +438,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
  */
 static struct ureg register_output( struct tnl_program *p, GLuint output )
 {
-   p->program->Base.OutputsWritten |= (1<<output);
+   p->program->Base.OutputsWritten |= BITFIELD64_BIT(output);
    return make_ureg(PROGRAM_OUTPUT, output);
 }
 
@@ -520,7 +523,6 @@ static void emit_dst( struct prog_dst_register *dst,
    dst->CondMask = COND_TR;  /* always pass cond test */
    dst->CondSwizzle = SWIZZLE_NOOP;
    dst->CondSrc = 0;
-   dst->pad = 0;
    /* Check that bitfield sizes aren't exceeded */
    ASSERT(dst->Index == reg.idx);
 }
@@ -1306,7 +1308,9 @@ static void build_fog( struct tnl_program *p )
       input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
    }
 
+   /* result.fog = {abs(f),0,0,1}; */
    emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
+   emit_op1(p, OPCODE_MOV, fog, WRITEMASK_YZW, get_identity_param(p));
 }