summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-11-07 07:51:56 +1000
committerMarek Olšák <maraeo@gmail.com>2012-11-23 01:59:57 +0100
commitd0a9ab29b2c8abf2900b1095883cba71b05b5cd9 (patch)
treedb9efd3b9af6fa98cc1eea0c568f2b77702863bc /src/gallium
parent8b2922ff5aa68b5dca90d5b83d1e31da48b069b3 (diff)
r600g: fix lod bias/explicit lod with cube maps.
While developing cube map array support I found that we didn't support this properly, also piglit didn't test for it at all. I've submitted a test to piglit to check for this, and this fixes explicit lod and lod bias with cube maps. NOTE: This is a candidate for the 9.0 branch. Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 037b4f80384c72c12e31192d1a30411d4660972d)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/r600_shader.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 21019b77dbd..1f8ab2b02a5 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -4012,6 +4012,23 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
if (r)
return r;
}
+
+ /* for cube forms of lod and bias we need to route the lod
+ value into Z */
+ if (inst->Instruction.Opcode == TGSI_OPCODE_TXB ||
+ inst->Instruction.Opcode == TGSI_OPCODE_TXL) {
+ memset(&alu, 0, sizeof(struct r600_bytecode_alu));
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
+ r600_bytecode_src(&alu.src[0], &ctx->src[0], 3);
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 2;
+ alu.last = 1;
+ alu.dst.write = 1;
+ r = r600_bytecode_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+ }
+
src_loaded = TRUE;
src_gpr = ctx->temp_reg;
}
@@ -4087,17 +4104,12 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
tex.src_rel = ctx->src[0].rel;
}
- if (inst->Texture.Texture == TGSI_TEXTURE_CUBE) {
- tex.src_sel_x = 1;
- tex.src_sel_y = 0;
- tex.src_sel_z = 3;
- tex.src_sel_w = 1;
- }
- if (inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE) {
+ if (inst->Texture.Texture == TGSI_TEXTURE_CUBE ||
+ inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE) {
tex.src_sel_x = 1;
tex.src_sel_y = 0;
tex.src_sel_z = 3;
- tex.src_sel_w = 2; /* route Z compare value into W */
+ tex.src_sel_w = 2; /* route Z compare or Lod value into W */
}
if (inst->Texture.Texture != TGSI_TEXTURE_RECT &&