summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-10-27 09:32:50 -0600
committerBrian <[email protected]>2007-10-27 09:32:50 -0600
commit6ada4e3a69476ed086955fe4060b894559e1eb95 (patch)
tree90f876131c359de27766c21bcf38fb0106d54519
parentf6a73c3f2815c4c84563c186bba6c8e67bb42ae9 (diff)
Comments about texture instructions and the src regs
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c20
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c13
2 files changed, 22 insertions, 11 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index f577f004d71..d98f46cc0db 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -1996,15 +1996,15 @@ exec_instruction(
case TGSI_OPCODE_TEX:
/* simple texture lookup */
- /* src[0] is the texcoord */
- /* src[1] is the sampler unit */
+ /* src[0] = texcoord */
+ /* src[1] = sampler unit */
exec_tex(mach, inst, FALSE);
break;
case TGSI_OPCODE_TXB:
/* Texture lookup with lod bias */
- /* src[0] is the texcoord (src[0].w = load bias) */
- /* src[1] is the sampler unit */
+ /* src[0] = texcoord (src[0].w = load bias) */
+ /* src[1] = sampler unit */
exec_tex(mach, inst, TRUE);
break;
@@ -2013,9 +2013,17 @@ exec_instruction(
/* src[0] = texcoord */
/* src[1] = d[strq]/dx */
/* src[2] = d[strq]/dy */
+ /* src[3] = sampler unit */
assert (0);
break;
+ case TGSI_OPCODE_TXL:
+ /* Texture lookup with explit LOD */
+ /* src[0] = texcoord (src[0].w = load bias) */
+ /* src[1] = sampler unit */
+ exec_tex(mach, inst, TRUE);
+ break;
+
case TGSI_OPCODE_UP2H:
assert (0);
break;
@@ -2157,10 +2165,6 @@ exec_instruction(
}
break;
- case TGSI_OPCODE_TXL:
- assert (0);
- break;
-
case TGSI_OPCODE_IF:
/* push CondMask */
assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 131e50becea..621159eb858 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -459,6 +459,7 @@ compile_instruction(
fullinst->Instruction.Opcode = TGSI_OPCODE_SWZ;
break;
case OPCODE_TEX:
+ /* ordinary texture lookup */
fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;
fullinst->Instruction.NumSrcRegs = 2;
fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
@@ -466,6 +467,7 @@ compile_instruction(
fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
break;
case OPCODE_TXB:
+ /* texture lookup with LOD bias */
fullinst->Instruction.Opcode = TGSI_OPCODE_TXB;
fullinst->Instruction.NumSrcRegs = 2;
fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
@@ -473,13 +475,16 @@ compile_instruction(
fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
break;
case OPCODE_TXD:
+ /* texture lookup with explicit partial derivatives */
fullinst->Instruction.Opcode = TGSI_OPCODE_TXD;
- fullinst->Instruction.NumSrcRegs = 2;
+ fullinst->Instruction.NumSrcRegs = 4;
fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
- fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
- fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
+ /* src[0] = coord, src[1] = d[strq]/dx, src[2] = d[strq]/dy */
+ fullinst->FullSrcRegisters[3].SrcRegister.File = TGSI_FILE_SAMPLER;
+ fullinst->FullSrcRegisters[3].SrcRegister.Index = inst->TexSrcUnit;
break;
case OPCODE_TXL:
+ /* texture lookup with explicit LOD */
fullinst->Instruction.Opcode = TGSI_OPCODE_TXL;
fullinst->Instruction.NumSrcRegs = 2;
fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
@@ -487,6 +492,8 @@ compile_instruction(
fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
break;
case OPCODE_TXP:
+ /* texture lookup with divide by Q component */
+ /* convert to TEX w/ special flag for division */
fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;
fullinst->Instruction.NumSrcRegs = 2;
fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );