i965: use the new prog_instruction::TexShadow field
authorBrian Paul <brianp@vmware.com>
Fri, 20 Feb 2009 20:50:27 +0000 (13:50 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 20 Feb 2009 20:50:27 +0000 (13:50 -0700)
GLSL shadow() sampler calls are properly propogated down to the driver now.
The glean glsl1 shadow() tests work (except for the alpha channel).

src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/drivers/dri/i965/brw_wm_emit.c
src/mesa/drivers/dri/i965/brw_wm_fp.c
src/mesa/drivers/dri/i965/brw_wm_pass0.c
src/mesa/drivers/dri/i965/brw_wm_pass1.c

index 582031f5f6c9c5a1856c1ef147ea8cbc38083199..6b945913b960c807b043bae7630560017a68f0b0 100644 (file)
@@ -143,6 +143,7 @@ struct brw_wm_instruction {
    GLuint writemask:4;
    GLuint tex_unit:4;   /* texture unit for TEX, TXD, TXP instructions */
    GLuint tex_idx:3;    /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */
+   GLuint tex_shadow:1; /* do shadow comparison? */
    GLuint eot:1;       /* End of thread indicator for FB_WRITE*/
    GLuint target:10;    /* target binding table index for FB_WRITE*/
 };
index b5050a3e40b26bd7a7daab8750d9d92ecf229aa7..281ffe06caa2731f1f83c22f0a222f1edec14747 100644 (file)
@@ -671,7 +671,6 @@ static void emit_tex( struct brw_wm_compile *c,
 {
    struct brw_compile *p = &c->func;
    GLuint msgLength, responseLength;
-   GLboolean shadow = (c->key.shadowtex_mask & (1<<inst->tex_unit)) ? 1 : 0;
    GLuint i, nr;
    GLuint emit;
 
@@ -693,7 +692,7 @@ static void emit_tex( struct brw_wm_compile *c,
       break;
    }
 
-   if (shadow) {
+   if (inst->tex_shadow) {
       nr = 4;
       emit |= WRITEMASK_W;
    }
@@ -718,7 +717,7 @@ static void emit_tex( struct brw_wm_compile *c,
              inst->tex_unit + MAX_DRAW_BUFFERS, /* surface */
              inst->tex_unit,     /* sampler */
              inst->writemask,
-             (shadow ? 
+             (inst->tex_shadow ? 
               BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE : 
               BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE),
              responseLength,
index 38cb964c09a1427c375159b9162e46ff5852c857..37766b7c3a05be1847cb351d81762645b634dfcd 100644 (file)
@@ -192,6 +192,7 @@ static struct prog_instruction * emit_tex_op(struct brw_wm_compile *c,
                                       GLuint saturate,
                                       GLuint tex_src_unit,
                                       GLuint tex_src_target,
+                                      GLuint tex_shadow,
                                       struct prog_src_register src0,
                                       struct prog_src_register src1,
                                       struct prog_src_register src2 )
@@ -205,6 +206,7 @@ static struct prog_instruction * emit_tex_op(struct brw_wm_compile *c,
    inst->SaturateMode = saturate;   
    inst->TexSrcUnit = tex_src_unit;
    inst->TexSrcTarget = tex_src_target;
+   inst->TexShadow = tex_shadow;
    inst->SrcReg[0] = src0;
    inst->SrcReg[1] = src1;
    inst->SrcReg[2] = src2;
@@ -221,7 +223,7 @@ static struct prog_instruction * emit_op(struct brw_wm_compile *c,
                                       struct prog_src_register src2 )
 {
    return emit_tex_op(c, op, dest, saturate,
-                      0, 0,  /* tex unit, target */
+                      0, 0, 0,  /* tex unit, target, shadow */
                       src0, src1, src2);
 }
    
@@ -705,6 +707,7 @@ static void precalc_tex( struct brw_wm_compile *c,
                   inst->SaturateMode,
                   unit,
                   inst->TexSrcTarget,
+                  inst->TexShadow,
                   coord,
                   src_undef(),
                   src_undef());
@@ -765,6 +768,7 @@ static void precalc_tex( struct brw_wm_compile *c,
                   inst->SaturateMode,
                   unit,
                   inst->TexSrcTarget,
+                  inst->TexShadow,
                   coord,
                   src_undef(),
                   src_undef());
index 3ade6aa6c36968aa3020e571c0cfb1633ff11caa..783545de56b968230538124a1e5ae2b12e0b244b 100644 (file)
@@ -349,6 +349,7 @@ translate_insn(struct brw_wm_compile *c,
    out->saturate = (inst->SaturateMode != SATURATE_OFF);
    out->tex_unit = inst->TexSrcUnit;
    out->tex_idx = inst->TexSrcTarget;
+   out->tex_shadow = inst->TexShadow;
    out->eot = inst->Sampler & 1;
    out->target = inst->Sampler>>1;
 
index 6eaed8a665b30233505094f8be93031682fe76e3..cf031899dd23c6d6aaa6b6e7d9d225e9501e25fd 100644 (file)
@@ -210,9 +210,10 @@ void brw_wm_pass1( struct brw_wm_compile *c )
         break;
 
       case OPCODE_TEX:
+      case OPCODE_TXP:
         read0 = get_texcoord_mask(inst->tex_idx);
 
-        if (c->key.shadowtex_mask & (1<<inst->tex_unit))
+         if (inst->tex_shadow)
            read0 |= WRITEMASK_Z;
         break;
 
@@ -267,7 +268,6 @@ void brw_wm_pass1( struct brw_wm_compile *c )
         break;
 
       case OPCODE_DST:
-      case OPCODE_TXP:
       default:
         break;
       }