Comments about texture instructions and the src regs
authorBrian <brian.paul@tungstengraphics.com>
Sat, 27 Oct 2007 15:32:50 +0000 (09:32 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 27 Oct 2007 15:32:50 +0000 (09:32 -0600)
src/mesa/pipe/tgsi/exec/tgsi_exec.c
src/mesa/state_tracker/st_mesa_to_tgsi.c

index f577f004d71708c72faaffb0b2c01ed98027e546..d98f46cc0dbcdbace96dd6caa0787e398ace8e4b 100644 (file)
@@ -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);
index 131e50becea23227ba727eea880be81cd8481f7f..621159eb8583b9744bb5ce12647bb6c110a49117 100644 (file)
@@ -459,6 +459,7 @@ compile_instruction(
       fullinst->Instruction.Opcode = TGSI_OPCODE_SWZ;\r
       break;\r
    case OPCODE_TEX:\r
+      /* ordinary texture lookup */\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
       fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
@@ -466,6 +467,7 @@ compile_instruction(
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
       break;\r
    case OPCODE_TXB:\r
+      /* texture lookup with LOD bias */\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXB;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
       fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
@@ -473,13 +475,16 @@ compile_instruction(
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
       break;\r
    case OPCODE_TXD:\r
+      /* texture lookup with explicit partial derivatives */\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXD;\r
-      fullinst->Instruction.NumSrcRegs = 2;\r
+      fullinst->Instruction.NumSrcRegs = 4;\r
       fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
-      fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;\r
-      fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
+      /* src[0] = coord, src[1] = d[strq]/dx, src[2] = d[strq]/dy */\r
+      fullinst->FullSrcRegisters[3].SrcRegister.File = TGSI_FILE_SAMPLER;\r
+      fullinst->FullSrcRegisters[3].SrcRegister.Index = inst->TexSrcUnit;\r
       break;\r
    case OPCODE_TXL:\r
+      /* texture lookup with explicit LOD */\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXL;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
       fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
@@ -487,6 +492,8 @@ compile_instruction(
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
       break;\r
    case OPCODE_TXP:\r
+      /* texture lookup with divide by Q component */\r
+      /* convert to TEX w/ special flag for division */\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
       fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r