On 11/22/2012 04:35 AM, Chris Forbes wrote:
Signed-off-by: Chris Forbes <chr...@ijw.co.nz>
---
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 0050252..1fff000 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1072,10 +1072,24 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg
dst, fs_reg coordinate,
}
break;
}
- case ir_txs:
+ case ir_txs: {
emit(MOV(fs_reg(MRF, base_mrf + mlen, BRW_REGISTER_TYPE_UD), lod));
mlen += reg_width;
This won't work :) You haven't reached the emit(SHADER_OPCODE_TXS, dst)
yet, so...you're emitting the fixup for the destination before filling it.
You might want to move this code to the caller (visit(ir_texture *)),
which would take care of it in one place for both Gen 6 and Gen 7.
+
+ /* fixup #layers for cube arrays */
+ glsl_type const * type = ir->sampler->variable_referenced()->type;
+ if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE &&
+ type->sampler_array) {
+ /* emit_math can't cope with immediates. */
+ fs_reg * imm = new (mem_ctx) fs_reg(this, glsl_type::ivec4_type);
+ emit(MOV(*imm, fs_reg(6)));
I can never keep the math workarounds straight. If MATH can't handle
immediates, I'd rather see emit_math() emit the MOV rather than
everybody that wants to emit math having to deal with it.
+ fs_reg depth = dst;
+ depth.reg_offset = 2;
+ emit_math(SHADER_OPCODE_INT_QUOTIENT, depth, depth, *imm);
+ }
break;
+ }
case ir_txf:
/* It appears that the ld instruction used for txf does its
* address bounds check before adding in the offset. To work
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev