Mesa (7.9): tgsi: fix incorrect usage_mask for shadow tex instructions

Brian Paul brianp at kemper.freedesktop.org
Wed Sep 15 20:00:43 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 71b4054a6c0c069f0086932054558594875ec532
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=71b4054a6c0c069f0086932054558594875ec532

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Sep 15 13:57:50 2010 -0600

tgsi: fix incorrect usage_mask for shadow tex instructions

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.

(cherry picked from commit 95254bbd2ddf0c6207a642604cc218ac9d711501)

---

 src/gallium/auxiliary/tgsi/tgsi_util.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index 3ec5496..08e7e89 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -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;




More information about the mesa-commit mailing list