[Mesa-dev] [PATCH] tgsi: add buffer texture to tgsi_util_get_texture_coord_dim()

Chia-I Wu olvaffe at gmail.com
Wed May 22 23:41:55 PDT 2013


TGSI_TEXTURE_BUFFER is one-dimensional.  Assert that exec_tex() is never
called with TGSI_TEXTURE_BUFFER.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
---
 src/gallium/auxiliary/tgsi/tgsi_exec.c |    1 +
 src/gallium/auxiliary/tgsi/tgsi_util.c |    2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index cb66a40..4482c6b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1791,6 +1791,7 @@ exec_tex(struct tgsi_exec_machine *mach,
    fetch_texel_offsets(mach, inst, offsets);
 
    assert(modifier != TEX_MODIFIER_LEVEL_ZERO);
+   assert(inst->Texture.Texture != TGSI_TEXTURE_BUFFER);
 
    dim = tgsi_util_get_texture_coord_dim(inst->Texture.Texture, &shadow_ref);
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index 862b79f..98c1e6e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -353,6 +353,7 @@ tgsi_util_get_texture_coord_dim(int tgsi_tex, int *shadow_or_sample)
     * Depending on the texture target, (src0.xyzw, src1.x) is interpreted
     * differently:
     *
+    *   (s, X, X, X, X),               for BUFFER
     *   (s, X, X, X, X),               for 1D
     *   (s, t, X, X, X),               for 2D, RECT
     *   (s, t, r, X, X),               for 3D, CUBE
@@ -373,6 +374,7 @@ tgsi_util_get_texture_coord_dim(int tgsi_tex, int *shadow_or_sample)
     *   (s, t, layer, sample, X),      for 2D_ARRAY_MSAA
     */
    switch (tgsi_tex) {
+   case TGSI_TEXTURE_BUFFER:
    case TGSI_TEXTURE_1D:
    case TGSI_TEXTURE_SHADOW1D:
       dim = 1;
-- 
1.7.10.4



More information about the mesa-dev mailing list