tgsi: fix incorrect usage_mask for shadow tex instructions
authorBrian Paul <brianp@vmware.com>
Wed, 15 Sep 2010 19:56:00 +0000 (13:56 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 15 Sep 2010 19:56:02 +0000 (13:56 -0600)
The shadow versions of the texture targets use an extra component
(Z) to express distance from light source to the fragment.
Fixes the shadowtex demo with llvmpipe.

src/gallium/auxiliary/tgsi/tgsi_util.c

index 3ec54964169bd528bed0407e0ef233fd74a300b3..08e7e89bd670e42fcb0a7aadd9ef50c15956316c 100644 (file)
@@ -262,19 +262,20 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
    case TGSI_OPCODE_TXL:
    case TGSI_OPCODE_TXP:
       if (src_idx == 0) {
+         /* Note that the SHADOW variants use the Z component too */
          switch (inst->Texture.Texture) {
          case TGSI_TEXTURE_1D:
-         case TGSI_TEXTURE_SHADOW1D:
             read_mask = TGSI_WRITEMASK_X;
             break;
-
+         case TGSI_TEXTURE_SHADOW1D:
+            read_mask = TGSI_WRITEMASK_XZ;
+            break;
          case TGSI_TEXTURE_2D:
          case TGSI_TEXTURE_RECT:
-         case TGSI_TEXTURE_SHADOW2D:
-         case TGSI_TEXTURE_SHADOWRECT:
             read_mask = TGSI_WRITEMASK_XY;
             break;
-
+         case TGSI_TEXTURE_SHADOW2D:
+         case TGSI_TEXTURE_SHADOWRECT:
          case TGSI_TEXTURE_3D:
          case TGSI_TEXTURE_CUBE:
             read_mask = TGSI_WRITEMASK_XYZ;