summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i915/i915_program.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2006-08-18 09:04:48 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2006-08-18 09:04:48 +0000
commitbd87c303e94659941a7c623d0b836e3ff317cfb4 (patch)
tree4ec6a572608fcca670b225a8088296f39eeac38e /src/mesa/drivers/dri/i915/i915_program.c
parentc1c282f36ad31f99b9d5b38a2d39118740bca928 (diff)
Fix writemasks on texture arb fp instructions.
Cleanup invarient state emission.
Diffstat (limited to 'src/mesa/drivers/dri/i915/i915_program.c')
-rw-r--r--src/mesa/drivers/dri/i915/i915_program.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c
index 45276fb690..0faadb4f1a 100644
--- a/src/mesa/drivers/dri/i915/i915_program.c
+++ b/src/mesa/drivers/dri/i915/i915_program.c
@@ -195,29 +195,47 @@ GLuint i915_emit_arith( struct i915_fragment_program *p,
}
GLuint i915_emit_texld( struct i915_fragment_program *p,
- GLuint dest,
- GLuint destmask,
- GLuint sampler,
- GLuint coord,
- GLuint op )
+ GLuint dest,
+ GLuint destmask,
+ GLuint sampler,
+ GLuint coord,
+ GLuint op )
{
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(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)));
- *(p->csr++) = (op |
- T0_DEST( dest ) |
- destmask |
- T0_SAMPLER( sampler ));
+ if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
+ p->nr_tex_indirect++;
+ }
- *(p->csr++) = T1_ADDRESS_REG( coord );
- *(p->csr++) = T2_MBZ;
+ *(p->csr++) = (op |
+ T0_DEST( dest ) |
+ T0_SAMPLER( sampler ));
- p->nr_tex_insn++;
- return dest;
+ *(p->csr++) = T1_ADDRESS_REG( coord );
+ *(p->csr++) = T2_MBZ;
+
+ p->nr_tex_insn++;
+ return dest;
+ }
}