summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-09-13 12:45:21 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-09-13 12:45:21 +0000
commit308d377ca893c53a21ad55922a85e2103f5b7e5f (patch)
tree4249cf9c6cf853490aea2d24531e54bffc6cb611 /src
parent4f39d22c298d9b7b7dc620cda1079b41c0e2edab (diff)
Bring in writemask + TEX fix from trunk
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/i915_program.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c
index 55f60880e3..4fb56222c6 100644
--- a/src/mesa/drivers/dri/i915/i915_program.c
+++ b/src/mesa/drivers/dri/i915/i915_program.c
@@ -194,26 +194,48 @@ i915_emit_arith(struct i915_fragment_program * p,
return dest;
}
-GLuint
-i915_emit_texld(struct i915_fragment_program * p,
- GLuint dest,
- GLuint destmask, GLuint sampler, GLuint coord, GLuint op)
+GLuint i915_emit_texld( struct i915_fragment_program *p,
+ GLuint dest,
+ GLuint destmask,
+ GLuint sampler,
+ GLuint coord,
+ GLuint op )
{
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest));
- assert(dest);
+ if (coord != UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord))) {
+ /* No real way to work around this in the general case - need to
+ * allocate and declare a new temporary register (a utemp won't
+ * do). Will fallback for now.
+ */
+ i915_program_error(p, "Can't (yet) swizzle TEX arguments");
+ return 0;
+ }
- if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
- p->nr_tex_indirect++;
+ /* Don't worry about saturate as we only support
+ */
+ if (destmask != A0_DEST_CHANNEL_ALL) {
+ GLuint tmp = i915_get_utemp(p);
+ i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op );
+ i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 );
+ return dest;
}
+ else {
+ assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
+ assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
+
+ if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
+ p->nr_tex_indirect++;
+ }
- *(p->csr++) = (op | T0_DEST(dest) | destmask | T0_SAMPLER(sampler));
+ *(p->csr++) = (op |
+ T0_DEST( dest ) |
+ T0_SAMPLER( sampler ));
- *(p->csr++) = T1_ADDRESS_REG(coord);
- *(p->csr++) = T2_MBZ;
+ *(p->csr++) = T1_ADDRESS_REG( coord );
+ *(p->csr++) = T2_MBZ;
- p->nr_tex_insn++;
- return dest;
+ p->nr_tex_insn++;
+ return dest;
+ }
}