[Mesa-dev] [PATCH 4/6] gallium: Prefix #defines in tgsi_exec.h with TGSI_

Tom Stellard tstellar at gmail.com
Sun Jan 15 18:38:50 PST 2012


---
 src/gallium/auxiliary/draw/draw_llvm.c            |   46 ++--
 src/gallium/auxiliary/draw/draw_vs_exec.c         |    2 +-
 src/gallium/auxiliary/tgsi/tgsi_exec.c            |  100 +++---
 src/gallium/auxiliary/tgsi/tgsi_exec.h            |   36 +-
 src/gallium/drivers/llvmpipe/lp_bld_interp.c      |   12 +-
 src/gallium/drivers/llvmpipe/lp_bld_interp.h      |   10 +-
 src/gallium/drivers/llvmpipe/lp_state_fs.c        |   16 +-
 src/gallium/drivers/llvmpipe/lp_state_setup.c     |    4 +-
 src/gallium/drivers/llvmpipe/lp_tile_soa.h        |    6 +-
 src/gallium/drivers/softpipe/sp_quad.h            |    8 +-
 src/gallium/drivers/softpipe/sp_quad_blend.c      |   38 +-
 src/gallium/drivers/softpipe/sp_quad_depth_test.c |  104 +++---
 src/gallium/drivers/softpipe/sp_quad_fs.c         |    2 +-
 src/gallium/drivers/softpipe/sp_setup.c           |   16 +-
 src/gallium/drivers/softpipe/sp_tex_sample.c      |  362 ++++++++++----------
 src/gallium/drivers/softpipe/sp_tex_sample.h      |   24 +-
 16 files changed, 393 insertions(+), 393 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index e71c802..7844300 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -464,8 +464,8 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
 static void
 generate_vs(struct draw_llvm *llvm,
             LLVMBuilderRef builder,
-            LLVMValueRef (*outputs)[NUM_CHANNELS],
-            const LLVMValueRef (*inputs)[NUM_CHANNELS],
+            LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
+            const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS],
             LLVMValueRef system_values_array,
             LLVMValueRef context_ptr,
             struct lp_build_sampler_soa *draw_sampler,
@@ -513,7 +513,7 @@ generate_vs(struct draw_llvm *llvm,
       lp_build_context_init(&bld, llvm->gallivm, vs_type);
 
       for (attrib = 0; attrib < info->num_outputs; ++attrib) {
-         for (chan = 0; chan < NUM_CHANNELS; ++chan) {
+         for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
             if (outputs[attrib][chan]) {
                switch (info->output_semantic_name[attrib]) {
                case TGSI_SEMANTIC_COLOR:
@@ -639,19 +639,19 @@ aos_to_soa(struct gallivm_state *gallivm,
 
 static void
 soa_to_aos(struct gallivm_state *gallivm,
-           LLVMValueRef soa[NUM_CHANNELS],
-           LLVMValueRef aos[NUM_CHANNELS])
+           LLVMValueRef soa[TGSI_NUM_CHANNELS],
+           LLVMValueRef aos[TGSI_NUM_CHANNELS])
 {
    LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef comp;
    int i = 0;
 
-   debug_assert(NUM_CHANNELS == 4);
+   debug_assert(TGSI_NUM_CHANNELS == 4);
 
    aos[0] = LLVMConstNull(LLVMTypeOf(soa[0]));
    aos[1] = aos[2] = aos[3] = aos[0];
 
-   for (i = 0; i < NUM_CHANNELS; ++i) {
+   for (i = 0; i < TGSI_NUM_CHANNELS; ++i) {
       LLVMValueRef channel = lp_build_const_int32(gallivm, i);
 
       comp = LLVMBuildExtractElement(builder, soa[i],
@@ -676,13 +676,13 @@ soa_to_aos(struct gallivm_state *gallivm,
 
 static void
 convert_to_soa(struct gallivm_state *gallivm,
-               LLVMValueRef (*aos)[NUM_CHANNELS],
-               LLVMValueRef (*soa)[NUM_CHANNELS],
+               LLVMValueRef (*aos)[TGSI_NUM_CHANNELS],
+               LLVMValueRef (*soa)[TGSI_NUM_CHANNELS],
                int num_attribs)
 {
    int i;
 
-   debug_assert(NUM_CHANNELS == 4);
+   debug_assert(TGSI_NUM_CHANNELS == 4);
 
    for (i = 0; i < num_attribs; ++i) {
       LLVMValueRef val0 = aos[i][0];
@@ -786,7 +786,7 @@ store_aos(struct gallivm_state *gallivm,
 static void
 store_aos_array(struct gallivm_state *gallivm,
                 LLVMValueRef io_ptr,
-                LLVMValueRef aos[NUM_CHANNELS],
+                LLVMValueRef aos[TGSI_NUM_CHANNELS],
                 int attrib,
                 int num_outputs,
                 LLVMValueRef clipmask)
@@ -800,7 +800,7 @@ store_aos_array(struct gallivm_state *gallivm,
    LLVMValueRef io0_ptr, io1_ptr, io2_ptr, io3_ptr;
    LLVMValueRef clipmask0, clipmask1, clipmask2, clipmask3;
    
-   debug_assert(NUM_CHANNELS == 4);
+   debug_assert(TGSI_NUM_CHANNELS == 4);
 
    io0_ptr = LLVMBuildGEP(builder, io_ptr,
                           &ind0, 1, "");
@@ -835,7 +835,7 @@ store_aos_array(struct gallivm_state *gallivm,
 static void
 convert_to_aos(struct gallivm_state *gallivm,
                LLVMValueRef io,
-               LLVMValueRef (*outputs)[NUM_CHANNELS],
+               LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
                LLVMValueRef clipmask,
                int num_outputs,
                int max_vertices)
@@ -849,7 +849,7 @@ convert_to_aos(struct gallivm_state *gallivm,
    for (attrib = 0; attrib < num_outputs; ++attrib) {
       LLVMValueRef soa[4];
       LLVMValueRef aos[4];
-      for (chan = 0; chan < NUM_CHANNELS; ++chan) {
+      for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
          if (outputs[attrib][chan]) {
             LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
             lp_build_name(out, "output%u.%c", attrib, "xyzw"[chan]);
@@ -885,7 +885,7 @@ convert_to_aos(struct gallivm_state *gallivm,
 static void
 store_clip(struct gallivm_state *gallivm,
            LLVMValueRef io_ptr,           
-           LLVMValueRef (*outputs)[NUM_CHANNELS],
+           LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
            boolean pre_clip_pos)
 {
    LLVMBuilderRef builder = gallivm->builder;
@@ -978,7 +978,7 @@ vec4f_from_scalar(struct gallivm_state *gallivm,
 static void
 generate_viewport(struct draw_llvm *llvm,
                   LLVMBuilderRef builder,
-                  LLVMValueRef (*outputs)[NUM_CHANNELS],
+                  LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
                   LLVMValueRef context_ptr)
 {
    int i;
@@ -1029,7 +1029,7 @@ generate_viewport(struct draw_llvm *llvm,
  */
 static LLVMValueRef 
 generate_clipmask(struct gallivm_state *gallivm,
-                  LLVMValueRef (*outputs)[NUM_CHANNELS],
+                  LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
                   boolean clip_xy,
                   boolean clip_z,
                   boolean clip_user,
@@ -1207,7 +1207,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
    struct lp_build_context bld;
    struct lp_build_loop_state lp_loop;
    const int max_vertices = 4;
-   LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
+   LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][TGSI_NUM_CHANNELS];
    LLVMValueRef fetch_max;
    void *code;
    struct lp_build_sampler_soa *sampler = 0;
@@ -1312,11 +1312,11 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
 
    lp_build_loop_begin(&lp_loop, gallivm, start);
    {
-      LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
-      LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS] = { { 0 } };
+      LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS];
+      LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS] = { { 0 } };
       LLVMValueRef io;
       LLVMValueRef clipmask;   /* holds the clipmask value */
-      const LLVMValueRef (*ptr_aos)[NUM_CHANNELS];
+      const LLVMValueRef (*ptr_aos)[TGSI_NUM_CHANNELS];
 
       if (elts)
          io_itr = lp_loop.counter;
@@ -1328,7 +1328,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
       lp_build_printf(builder, " --- io %d = %p, loop counter %d\n",
                       io_itr, io, lp_loop.counter);
 #endif
-      for (i = 0; i < NUM_CHANNELS; ++i) {
+      for (i = 0; i < TGSI_NUM_CHANNELS; ++i) {
          LLVMValueRef true_index =
             LLVMBuildAdd(builder,
                          lp_loop.counter,
@@ -1359,7 +1359,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
       convert_to_soa(gallivm, aos_attribs, inputs,
                      draw->pt.nr_vertex_elements);
 
-      ptr_aos = (const LLVMValueRef (*)[NUM_CHANNELS]) inputs;
+      ptr_aos = (const LLVMValueRef (*)[TGSI_NUM_CHANNELS]) inputs;
       generate_vs(llvm,
                   builder,
                   outputs,
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index bfe7aea..eaba475 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -103,7 +103,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
    if (shader->info.uses_instanceid) {
       unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INSTANCEID];
       assert(i < Elements(machine->SystemValue));
-      for (j = 0; j < QUAD_SIZE; j++)
+      for (j = 0; j < TGSI_QUAD_SIZE; j++)
          machine->SystemValue[i].i[j] = shader->draw->instance_id;
    }
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 3774b61..c4ad34b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -602,7 +602,7 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
            inst->Dst[0].Register.Indirect)) {
          /* loop over dest channels */
          uint channelsWritten = 0x0;
-         for (chan = 0; chan < NUM_CHANNELS; chan++) {
+         for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
             if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
                /* check if we're reading a channel that's been written */
                uint swizzle = tgsi_util_get_full_src_register_swizzle(&inst->Src[i], chan);
@@ -1055,7 +1055,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
 
    switch (file) {
    case TGSI_FILE_CONSTANT:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index2D->i[i] >= 0 && index2D->i[i] < PIPE_MAX_CONSTANT_BUFFERS);
          assert(mach->Consts[index2D->i[i]]);
 
@@ -1084,7 +1084,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_FILE_INPUT:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          /*
          if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
             debug_printf("Fetching Input[%d] (2d=%d, 1d=%d)\n",
@@ -1102,13 +1102,13 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       /* XXX no swizzling at this point.  Will be needed if we put
        * gl_FragCoord, for example, in a sys value register.
        */
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          chan->u[i] = mach->SystemValue[index->i[i]].u[i];
       }
       break;
 
    case TGSI_FILE_TEMPORARY:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] < TGSI_EXEC_NUM_TEMPS);
          assert(index2D->i[i] == 0);
 
@@ -1117,7 +1117,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_FILE_TEMPORARY_ARRAY:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] < TGSI_EXEC_NUM_TEMPS);
          assert(index2D->i[i] < TGSI_EXEC_NUM_TEMP_ARRAYS);
 
@@ -1127,7 +1127,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_FILE_IMMEDIATE:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] >= 0 && index->i[i] < (int)mach->ImmLimit);
          assert(index2D->i[i] == 0);
 
@@ -1136,7 +1136,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_FILE_IMMEDIATE_ARRAY:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index2D->i[i] == 0);
 
          chan->f[i] = mach->ImmArray[index->i[i]][swizzle];
@@ -1144,7 +1144,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_FILE_ADDRESS:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] >= 0);
          assert(index2D->i[i] == 0);
 
@@ -1153,7 +1153,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_FILE_PREDICATE:
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] >= 0 && index->i[i] < TGSI_EXEC_NUM_PREDS);
          assert(index2D->i[i] == 0);
 
@@ -1163,7 +1163,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
 
    case TGSI_FILE_OUTPUT:
       /* vertex/fragment output vars can be read too */
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] >= 0);
          assert(index2D->i[i] == 0);
 
@@ -1173,7 +1173,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
 
    default:
       assert(0);
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          chan->u[i] = 0;
       }
    }
@@ -1243,7 +1243,7 @@ fetch_source(const struct tgsi_exec_machine *mach,
       /* for disabled execution channels, zero-out the index to
        * avoid using a potential garbage value.
        */
-      for (i = 0; i < QUAD_SIZE; i++) {
+      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          if ((execmask & (1 << i)) == 0)
             index.i[i] = 0;
       }
@@ -1302,7 +1302,7 @@ fetch_source(const struct tgsi_exec_machine *mach,
          /* for disabled execution channels, zero-out the index to
           * avoid using a potential garbage value.
           */
-         for (i = 0; i < QUAD_SIZE; i++) {
+         for (i = 0; i < TGSI_QUAD_SIZE; i++) {
             if ((execmask & (1 << i)) == 0) {
                index2D.i[i] = 0;
             }
@@ -1458,7 +1458,7 @@ store_dest(struct tgsi_exec_machine *mach,
          /* for disabled execution channels, zero-out the index to
           * avoid using a potential garbage value.
           */
-         for (i = 0; i < QUAD_SIZE; i++) {
+         for (i = 0; i < TGSI_QUAD_SIZE; i++) {
             if ((execmask & (1 << i)) == 0) {
                index2D.i[i] = 0;
             }
@@ -1488,7 +1488,7 @@ store_dest(struct tgsi_exec_machine *mach,
 #if 0
       if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
          fprintf(stderr, "STORING OUT[%d] mask(%d), = (", offset + index, execmask);
-         for (i = 0; i < QUAD_SIZE; i++)
+         for (i = 0; i < TGSI_QUAD_SIZE; i++)
             if (execmask & (1 << i))
                fprintf(stderr, "%f, ", chan->f[i]);
          fprintf(stderr, ")\n");
@@ -1555,13 +1555,13 @@ store_dest(struct tgsi_exec_machine *mach,
       pred = &mach->Predicates[inst->Predicate.Index].xyzw[swizzle];
 
       if (inst->Predicate.Negate) {
-         for (i = 0; i < QUAD_SIZE; i++) {
+         for (i = 0; i < TGSI_QUAD_SIZE; i++) {
             if (pred->u[i]) {
                execmask &= ~(1 << i);
             }
          }
       } else {
-         for (i = 0; i < QUAD_SIZE; i++) {
+         for (i = 0; i < TGSI_QUAD_SIZE; i++) {
             if (!pred->u[i]) {
                execmask &= ~(1 << i);
             }
@@ -1571,13 +1571,13 @@ store_dest(struct tgsi_exec_machine *mach,
 
    switch (inst->Instruction.Saturate) {
    case TGSI_SAT_NONE:
-      for (i = 0; i < QUAD_SIZE; i++)
+      for (i = 0; i < TGSI_QUAD_SIZE; i++)
          if (execmask & (1 << i))
             dst->i[i] = chan->i[i];
       break;
 
    case TGSI_SAT_ZERO_ONE:
-      for (i = 0; i < QUAD_SIZE; i++)
+      for (i = 0; i < TGSI_QUAD_SIZE; i++)
          if (execmask & (1 << i)) {
             if (chan->f[i] < 0.0f)
                dst->f[i] = 0.0f;
@@ -1589,7 +1589,7 @@ store_dest(struct tgsi_exec_machine *mach,
       break;
 
    case TGSI_SAT_MINUS_PLUS_ONE:
-      for (i = 0; i < QUAD_SIZE; i++)
+      for (i = 0; i < TGSI_QUAD_SIZE; i++)
          if (execmask & (1 << i)) {
             if (chan->f[i] < -1.0f)
                dst->f[i] = -1.0f;
@@ -1672,7 +1672,7 @@ emit_vertex(struct tgsi_exec_machine *mach)
 {
    /* FIXME: check for exec mask correctly
    unsigned i;
-   for (i = 0; i < QUAD_SIZE; ++i) {
+   for (i = 0; i < TGSI_QUAD_SIZE; ++i) {
          if ((mach->ExecMask & (1 << i)))
    */
    if (mach->ExecMask) {
@@ -1687,7 +1687,7 @@ emit_primitive(struct tgsi_exec_machine *mach)
    unsigned *prim_count = &mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0];
    /* FIXME: check for exec mask correctly
    unsigned i;
-   for (i = 0; i < QUAD_SIZE; ++i) {
+   for (i = 0; i < TGSI_QUAD_SIZE; ++i) {
          if ((mach->ExecMask & (1 << i)))
    */
    if (mach->ExecMask) {
@@ -1726,7 +1726,7 @@ fetch_texel( struct tgsi_sampler *sampler,
              union tgsi_exec_channel *a )
 {
    uint j;
-   float rgba[NUM_CHANNELS][QUAD_SIZE];
+   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
 
    sampler->get_samples(sampler, s->f, t->f, p->f, c0->f, control, rgba);
 
@@ -1904,7 +1904,7 @@ exec_tex(struct tgsi_exec_machine *mach,
          r[3].f[0], r[3].f[1], r[3].f[2], r[3].f[3]);
 #endif
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -1983,7 +1983,7 @@ exec_txd(struct tgsi_exec_machine *mach,
       assert(0);
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2000,7 +2000,7 @@ exec_txf(struct tgsi_exec_machine *mach,
    union tgsi_exec_channel r[4];
    union tgsi_exec_channel offset[3];
    uint chan;
-   float rgba[NUM_CHANNELS][QUAD_SIZE];
+   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
    int j;
    int8_t offsets[3];
 
@@ -2048,14 +2048,14 @@ exec_txf(struct tgsi_exec_machine *mach,
    sampler->get_texel(sampler, r[0].i, r[1].i, r[2].i, r[3].i,
 		      offsets, rgba);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       r[0].f[j] = rgba[0][j];
       r[1].f[j] = rgba[1][j];
       r[2].f[j] = rgba[2][j];
       r[3].f[j] = rgba[3][j];
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2078,13 +2078,13 @@ exec_txq(struct tgsi_exec_machine *mach,
 
    sampler->get_dims(sampler, src.i[0], result);
 
-   for (i = 0; i < QUAD_SIZE; i++) {
+   for (i = 0; i < TGSI_QUAD_SIZE; i++) {
       for (j = 0; j < 4; j++) {
 	 r[j].i[i] = result[j];
       }
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
 	 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan,
 		    TGSI_EXEC_DATA_INT);
@@ -2196,7 +2196,7 @@ exec_sample(struct tgsi_exec_machine *mach,
       assert(0);
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2259,7 +2259,7 @@ exec_sample_d(struct tgsi_exec_machine *mach,
       assert(0);
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2279,7 +2279,7 @@ eval_constant_coef(
 {
    unsigned i;
 
-   for( i = 0; i < QUAD_SIZE; i++ ) {
+   for( i = 0; i < TGSI_QUAD_SIZE; i++ ) {
       mach->Inputs[attrib].xyzw[chan].f[i] = mach->InterpCoefs[attrib].a0[chan];
    }
 }
@@ -2364,7 +2364,7 @@ exec_declaration(struct tgsi_exec_machine *mach,
             assert(decl->Semantic.Index == 0);
             assert(first == last);
 
-            for (i = 0; i < QUAD_SIZE; i++) {
+            for (i = 0; i < TGSI_QUAD_SIZE; i++) {
                mach->Inputs[first].xyzw[0].f[i] = mach->Face;
             }
          } else {
@@ -2393,7 +2393,7 @@ exec_declaration(struct tgsi_exec_machine *mach,
                return;
             }
 
-            for (j = 0; j < NUM_CHANNELS; j++) {
+            for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
                if (mask & (1 << j)) {
                   for (i = first; i <= last; i++) {
                      eval(mach, i, j);
@@ -2420,7 +2420,7 @@ exec_vector(struct tgsi_exec_machine *mach,
 {
    unsigned int chan;
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          union tgsi_exec_channel dst;
 
@@ -2446,7 +2446,7 @@ exec_scalar_unary(struct tgsi_exec_machine *mach,
 
    fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, src_datatype);
    op(&dst, &src);
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &dst, &inst->Dst[0], inst, chan, dst_datatype);
       }
@@ -2463,7 +2463,7 @@ exec_vector_unary(struct tgsi_exec_machine *mach,
    unsigned int chan;
    struct tgsi_exec_vector dst;
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          union tgsi_exec_channel src;
 
@@ -2471,7 +2471,7 @@ exec_vector_unary(struct tgsi_exec_machine *mach,
          op(&dst.xyzw[chan], &src);
       }
    }
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan, dst_datatype);
       }
@@ -2496,7 +2496,7 @@ exec_scalar_binary(struct tgsi_exec_machine *mach,
    fetch_source(mach, &src[0], &inst->Src[0], TGSI_CHAN_X, src_datatype);
    fetch_source(mach, &src[1], &inst->Src[1], TGSI_CHAN_Y, src_datatype);
    op(&dst, &src[0], &src[1]);
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &dst, &inst->Dst[0], inst, chan, dst_datatype);
       }
@@ -2513,7 +2513,7 @@ exec_vector_binary(struct tgsi_exec_machine *mach,
    unsigned int chan;
    struct tgsi_exec_vector dst;
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          union tgsi_exec_channel src[2];
 
@@ -2522,7 +2522,7 @@ exec_vector_binary(struct tgsi_exec_machine *mach,
          op(&dst.xyzw[chan], &src[0], &src[1]);
       }
    }
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan, dst_datatype);
       }
@@ -2544,7 +2544,7 @@ exec_vector_trinary(struct tgsi_exec_machine *mach,
    unsigned int chan;
    struct tgsi_exec_vector dst;
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          union tgsi_exec_channel src[3];
 
@@ -2554,7 +2554,7 @@ exec_vector_trinary(struct tgsi_exec_machine *mach,
          op(&dst.xyzw[chan], &src[0], &src[1], &src[2]);
       }
    }
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan, dst_datatype);
       }
@@ -2578,7 +2578,7 @@ exec_dp3(struct tgsi_exec_machine *mach,
       micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &arg[2], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2602,7 +2602,7 @@ exec_dp4(struct tgsi_exec_machine *mach,
       micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
    }
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &arg[2], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2627,7 +2627,7 @@ exec_dp2a(struct tgsi_exec_machine *mach,
    fetch_source(mach, &arg[1], &inst->Src[2], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
    micro_add(&arg[0], &arg[0], &arg[1]);
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &arg[0], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2656,7 +2656,7 @@ exec_dph(struct tgsi_exec_machine *mach,
    fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
    micro_add(&arg[0], &arg[0], &arg[1]);
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &arg[0], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
@@ -2678,7 +2678,7 @@ exec_dp2(struct tgsi_exec_machine *mach,
    fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
    micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
 
-   for (chan = 0; chan < NUM_CHANNELS; chan++) {
+   for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
       if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
          store_dest(mach, &arg[2], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
       }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 63c7087..613b383 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -42,8 +42,8 @@ extern "C" {
 #define TGSI_CHAN_Z 2
 #define TGSI_CHAN_W 3
 
-#define NUM_CHANNELS 4  /* R,G,B,A */
-#define QUAD_SIZE    4  /* 4 pixel/quad */
+#define TGSI_NUM_CHANNELS 4  /* R,G,B,A */
+#define TGSI_QUAD_SIZE    4  /* 4 pixel/quad */
 
 
 /**
@@ -51,9 +51,9 @@ extern "C" {
   */
 union tgsi_exec_channel
 {
-   float    f[QUAD_SIZE];
-   int      i[QUAD_SIZE];
-   unsigned u[QUAD_SIZE];
+   float    f[TGSI_QUAD_SIZE];
+   int      i[TGSI_QUAD_SIZE];
+   unsigned u[TGSI_QUAD_SIZE];
 };
 
 /**
@@ -61,7 +61,7 @@ union tgsi_exec_channel
   */
 struct tgsi_exec_vector
 {
-   union tgsi_exec_channel xyzw[NUM_CHANNELS];
+   union tgsi_exec_channel xyzw[TGSI_NUM_CHANNELS];
 };
 
 /**
@@ -70,9 +70,9 @@ struct tgsi_exec_vector
  */
 struct tgsi_interp_coef
 {
-   float a0[NUM_CHANNELS];	/* in an xyzw layout */
-   float dadx[NUM_CHANNELS];
-   float dady[NUM_CHANNELS];
+   float a0[TGSI_NUM_CHANNELS];	/* in an xyzw layout */
+   float dadx[TGSI_NUM_CHANNELS];
+   float dady[TGSI_NUM_CHANNELS];
 };
 
 enum tgsi_sampler_control {
@@ -88,18 +88,18 @@ struct tgsi_sampler
 {
    /** Get samples for four fragments in a quad */
    void (*get_samples)(struct tgsi_sampler *sampler,
-                       const float s[QUAD_SIZE],
-                       const float t[QUAD_SIZE],
-                       const float p[QUAD_SIZE],
-                       const float c0[QUAD_SIZE],
+                       const float s[TGSI_QUAD_SIZE],
+                       const float t[TGSI_QUAD_SIZE],
+                       const float p[TGSI_QUAD_SIZE],
+                       const float c0[TGSI_QUAD_SIZE],
                        enum tgsi_sampler_control control,
-                       float rgba[NUM_CHANNELS][QUAD_SIZE]);
+                       float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]);
    void (*get_dims)(struct tgsi_sampler *sampler, int level,
 		    int dims[4]);
-   void (*get_texel)(struct tgsi_sampler *sampler, const int i[QUAD_SIZE],
-		     const int j[QUAD_SIZE], const int k[QUAD_SIZE],
-		     const int lod[QUAD_SIZE], const int8_t offset[3],
-		     float rgba[NUM_CHANNELS][QUAD_SIZE]);
+   void (*get_texel)(struct tgsi_sampler *sampler, const int i[TGSI_QUAD_SIZE],
+		     const int j[TGSI_QUAD_SIZE], const int k[TGSI_QUAD_SIZE],
+		     const int lod[TGSI_QUAD_SIZE], const int8_t offset[3],
+		     float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]);
 };
 
 #define TGSI_EXEC_NUM_TEMPS       128
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
index 45ddf54..0608ab0 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
@@ -143,10 +143,10 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
    for (attrib = 0; attrib < bld->num_attribs; ++attrib) {
       const unsigned mask = bld->mask[attrib];
       const unsigned interp = bld->interp[attrib];
-      for (chan = 0; chan < NUM_CHANNELS; ++chan) {
+      for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
          if (mask & (1 << chan)) {
             LLVMValueRef index = lp_build_const_int32(gallivm,
-                                      attrib * NUM_CHANNELS + chan);
+                                      attrib * TGSI_NUM_CHANNELS + chan);
             LLVMValueRef a0 = zero;
             LLVMValueRef dadx = zero;
             LLVMValueRef dady = zero;
@@ -292,7 +292,7 @@ attribs_update(struct lp_build_interp_soa_context *bld,
    for(attrib = start; attrib < end; ++attrib) {
       const unsigned mask = bld->mask[attrib];
       const unsigned interp = bld->interp[attrib];
-      for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+      for(chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
          if(mask & (1 << chan)) {
             LLVMValueRef a;
             if (interp == LP_INTERP_CONSTANT ||
@@ -418,7 +418,7 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
    coeff_type.floating = TRUE;
    coeff_type.sign = TRUE;
    coeff_type.width = 32;
-   coeff_type.length = QUAD_SIZE;
+   coeff_type.length = TGSI_QUAD_SIZE;
 
    /* XXX: we don't support interpolating into any other types */
    assert(memcmp(&coeff_type, &type, sizeof coeff_type) == 0);
@@ -427,7 +427,7 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
 
    /* For convenience */
    bld->pos = bld->attribs[0];
-   bld->inputs = (const LLVMValueRef (*)[NUM_CHANNELS]) bld->attribs[1];
+   bld->inputs = (const LLVMValueRef (*)[TGSI_NUM_CHANNELS]) bld->attribs[1];
 
    /* Position */
    bld->num_attribs = 1;
@@ -443,7 +443,7 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
 
    /* Ensure all masked out input channels have a valid value */
    for (attrib = 0; attrib < bld->num_attribs; ++attrib) {
-      for (chan = 0; chan < NUM_CHANNELS; ++chan) {
+      for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
          bld->attribs[attrib][chan] = bld->coeff_bld.undef;
       }
    }
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.h b/src/gallium/drivers/llvmpipe/lp_bld_interp.h
index b58b2dc..5f72b0b 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_interp.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.h
@@ -75,7 +75,7 @@ struct lp_shader_input {
 
 struct lp_build_interp_soa_context
 {
-   /* QUAD_SIZE x float */
+   /* TGSI_QUAD_SIZE x float */
    struct lp_build_context coeff_bld;
 
    unsigned num_attribs;
@@ -85,18 +85,18 @@ struct lp_build_interp_soa_context
    LLVMValueRef x;
    LLVMValueRef y;
 
-   LLVMValueRef a   [1 + PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
-   LLVMValueRef dadq[1 + PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
+   LLVMValueRef a   [1 + PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS];
+   LLVMValueRef dadq[1 + PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS];
 
    LLVMValueRef oow;
 
-   LLVMValueRef attribs[1 + PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
+   LLVMValueRef attribs[1 + PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS];
 
    /*
     * Convenience pointers. Callers may access this one.
     */
    const LLVMValueRef *pos;
-   const LLVMValueRef (*inputs)[NUM_CHANNELS];
+   const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS];
 };
 
 
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index c7bab82..482f4e3 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -233,7 +233,7 @@ generate_fs(struct gallivm_state *gallivm,
    const struct tgsi_token *tokens = shader->base.tokens;
    LLVMTypeRef vec_type;
    LLVMValueRef consts_ptr;
-   LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
+   LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][TGSI_NUM_CHANNELS];
    LLVMValueRef z;
    LLVMValueRef zs_value = NULL;
    LLVMValueRef stencil_refs[2];
@@ -289,7 +289,7 @@ generate_fs(struct gallivm_state *gallivm,
 
    /* Declare the color and z variables */
    for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {
-      for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+      for(chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
 	 color[cbuf][chan] = lp_build_alloca(gallivm, vec_type, "color");
       }
    }
@@ -406,7 +406,7 @@ generate_fs(struct gallivm_state *gallivm,
           shader->info.base.output_semantic_index[attrib] < key->nr_cbufs)
       {
          unsigned cbuf = shader->info.base.output_semantic_index[attrib];
-         for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+         for(chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
             if(outputs[attrib][chan]) {
                /* XXX: just initialize outputs to point at colors[] and
                 * skip this.
@@ -536,7 +536,7 @@ generate_fragment(struct llvmpipe_context *lp,
    struct lp_build_sampler_soa *sampler;
    struct lp_build_interp_soa_context interp;
    LLVMValueRef fs_mask[LP_MAX_VECTOR_LENGTH];
-   LLVMValueRef fs_out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS][LP_MAX_VECTOR_LENGTH];
+   LLVMValueRef fs_out_color[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS][LP_MAX_VECTOR_LENGTH];
    LLVMValueRef blend_mask;
    LLVMValueRef function;
    LLVMValueRef facing;
@@ -684,7 +684,7 @@ generate_fragment(struct llvmpipe_context *lp,
       LLVMValueRef depth_offset = LLVMConstInt(int32_type,
                                                i*fs_type.length*zs_format_desc->block.bits/8,
                                                0);
-      LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS];
+      LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS];
       LLVMValueRef depth_ptr_i;
 
       depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &depth_offset, 1, "");
@@ -706,7 +706,7 @@ generate_fragment(struct llvmpipe_context *lp,
                   counter);
 
       for (cbuf = 0; cbuf < key->nr_cbufs; cbuf++)
-         for (chan = 0; chan < NUM_CHANNELS; ++chan)
+         for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan)
             fs_out_color[cbuf][chan][i] =
                out_color[cbuf * !cbuf0_write_all][chan];
    }
@@ -718,13 +718,13 @@ generate_fragment(struct llvmpipe_context *lp,
    for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {
       LLVMValueRef color_ptr;
       LLVMValueRef index = lp_build_const_int32(gallivm, cbuf);
-      LLVMValueRef blend_in_color[NUM_CHANNELS];
+      LLVMValueRef blend_in_color[TGSI_NUM_CHANNELS];
       unsigned rt;
 
       /* 
        * Convert the fs's output color and mask to fit to the blending type. 
        */
-      for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+      for(chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
          LLVMValueRef fs_color_vals[LP_MAX_VECTOR_LENGTH];
          
          for (i = 0; i < num_fs; i++) {
diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index 3243abf..ab38357 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
@@ -911,7 +911,7 @@ lp_dump_setup_coef( const struct lp_setup_variant_key *key,
 {
    int i, slot;
 
-   for (i = 0; i < NUM_CHANNELS; i++) {
+   for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
       float a0   = sa0  [0][i];
       float dadx = sdadx[0][i];
       float dady = sdady[0][i];
@@ -923,7 +923,7 @@ lp_dump_setup_coef( const struct lp_setup_variant_key *key,
 
    for (slot = 0; slot < key->num_inputs; slot++) {
       unsigned usage_mask = key->inputs[slot].usage_mask;
-      for (i = 0; i < NUM_CHANNELS; i++) {
+      for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
 	 if (usage_mask & (1 << i)) {
 	    float a0   = sa0  [1 + slot][i];
 	    float dadx = sdadx[1 + slot][i];
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.h b/src/gallium/drivers/llvmpipe/lp_tile_soa.h
index 12dac1d..6a5fc8d 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.h
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.h
@@ -29,7 +29,7 @@
 #define LP_TILE_SOA_H
 
 #include "pipe/p_compiler.h"
-#include "tgsi/tgsi_exec.h" /* for NUM_CHANNELS */
+#include "tgsi/tgsi_exec.h" /* for TGSI_NUM_CHANNELS */
 #include "lp_limits.h"
 
 #ifdef __cplusplus
@@ -47,8 +47,8 @@ extern const unsigned char
 tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH];
 
 #define TILE_C_STRIDE (TILE_VECTOR_HEIGHT * TILE_VECTOR_WIDTH) //16
-#define TILE_X_STRIDE (NUM_CHANNELS * TILE_C_STRIDE) //64
-#define TILE_Y_STRIDE (TILE_VECTOR_HEIGHT * TILE_SIZE * NUM_CHANNELS) //1024
+#define TILE_X_STRIDE (TGSI_NUM_CHANNELS * TILE_C_STRIDE) //64
+#define TILE_Y_STRIDE (TILE_VECTOR_HEIGHT * TILE_SIZE * TGSI_NUM_CHANNELS) //1024
 
 
 #ifdef DEBUG
diff --git a/src/gallium/drivers/softpipe/sp_quad.h b/src/gallium/drivers/softpipe/sp_quad.h
index e745aa8..9d456b5 100644
--- a/src/gallium/drivers/softpipe/sp_quad.h
+++ b/src/gallium/drivers/softpipe/sp_quad.h
@@ -62,7 +62,7 @@
 struct quad_header_input
 {
    int x0, y0;                /**< quad window pos, always even */
-   float coverage[QUAD_SIZE]; /**< fragment coverage for antialiasing */
+   float coverage[TGSI_QUAD_SIZE]; /**< fragment coverage for antialiasing */
    unsigned facing:1;         /**< Front (0) or back (1) facing? */
    unsigned prim:2;           /**< QUAD_PRIM_POINT, LINE, TRI */
 };
@@ -83,9 +83,9 @@ struct quad_header_inout
 struct quad_header_output
 {
    /** colors in SOA format (rrrr, gggg, bbbb, aaaa) */
-   float color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS][QUAD_SIZE];
-   float depth[QUAD_SIZE];
-   uint8_t stencil[QUAD_SIZE];
+   float color[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
+   float depth[TGSI_QUAD_SIZE];
+   uint8_t stencil[TGSI_QUAD_SIZE];
 };
 
 
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index d546b14..3fa672f 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -267,8 +267,8 @@ blend_quad(struct quad_stage *qs,
    static const float zero[4] = { 0, 0, 0, 0 };
    static const float one[4] = { 1, 1, 1, 1 };
    struct softpipe_context *softpipe = qs->softpipe;
-   float source[4][QUAD_SIZE] = { { 0 } };
-   float blend_dest[4][QUAD_SIZE];
+   float source[4][TGSI_QUAD_SIZE] = { { 0 } };
+   float blend_dest[4][TGSI_QUAD_SIZE];
 
    /*
     * Compute src/first term RGB
@@ -576,7 +576,7 @@ blend_quad(struct quad_stage *qs,
       break;
    case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
       {
-         float one_minus_alpha[QUAD_SIZE];
+         float one_minus_alpha[TGSI_QUAD_SIZE];
          VEC4_SUB(one_minus_alpha, one, quadColor[3]);
          VEC4_MUL(blend_dest[0], blend_dest[0], one_minus_alpha); /* R */
          VEC4_MUL(blend_dest[1], blend_dest[1], one_minus_alpha); /* G */
@@ -671,7 +671,7 @@ blend_quad(struct quad_stage *qs,
       /* fall-through */
    case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
       {
-         float one_minus_alpha[QUAD_SIZE];
+         float one_minus_alpha[TGSI_QUAD_SIZE];
          VEC4_SUB(one_minus_alpha, one, quadColor[3]);
          VEC4_MUL(blend_dest[3], blend_dest[3], one_minus_alpha); /* A */
       }
@@ -786,7 +786,7 @@ clamp_colors(float (*quadColor)[4])
 {
    unsigned i, j;
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       for (i = 0; i < 4; i++) {
          quadColor[i][j] = CLAMP(quadColor[i][j], 0.0F, 1.0F);
       }
@@ -859,7 +859,7 @@ blend_fallback(struct quad_stage *qs,
    {
       /* which blend/mask state index to use: */
       const uint blend_buf = blend->independent_blend_enable ? cbuf : 0;
-      float dest[4][QUAD_SIZE];
+      float dest[4][TGSI_QUAD_SIZE];
       struct softpipe_cached_tile *tile
          = sp_get_cached_tile(softpipe->cbuf_cache[cbuf],
                               quads[0]->input.x0, 
@@ -876,12 +876,12 @@ blend_fallback(struct quad_stage *qs,
       for (q = 0; q < nr; q++) {
          struct quad_header *quad = quads[q];
          float (*quadColor)[4];
-         float temp_quad_color[QUAD_SIZE][4];
+         float temp_quad_color[TGSI_QUAD_SIZE][4];
          const int itx = (quad->input.x0 & (TILE_SIZE-1));
          const int ity = (quad->input.y0 & (TILE_SIZE-1));
 
          if (write_all) {
-            for (j = 0; j < QUAD_SIZE; j++) {
+            for (j = 0; j < TGSI_QUAD_SIZE; j++) {
                for (i = 0; i < 4; i++) {
                   temp_quad_color[i][j] = quad->output.color[0][i][j];
                }
@@ -900,7 +900,7 @@ blend_fallback(struct quad_stage *qs,
 
          /* get/swizzle dest colors
           */
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             int x = itx + (j & 1);
             int y = ity + (j >> 1);
             for (i = 0; i < 4; i++) {
@@ -932,7 +932,7 @@ blend_fallback(struct quad_stage *qs,
    
          /* Output color values
           */
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             if (quad->inout.mask & (1 << j)) {
                int x = itx + (j & 1);
                int y = ity + (j >> 1);
@@ -953,9 +953,9 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs,
 {
    const struct blend_quad_stage *bqs = blend_quad_stage(qs);
    static const float one[4] = { 1, 1, 1, 1 };
-   float one_minus_alpha[QUAD_SIZE];
-   float dest[4][QUAD_SIZE];
-   float source[4][QUAD_SIZE];
+   float one_minus_alpha[TGSI_QUAD_SIZE];
+   float dest[4][TGSI_QUAD_SIZE];
+   float source[4][TGSI_QUAD_SIZE];
    uint i, j, q;
 
    struct softpipe_cached_tile *tile
@@ -971,7 +971,7 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs,
       const int ity = (quad->input.y0 & (TILE_SIZE-1));
       
       /* get/swizzle dest colors */
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = itx + (j & 1);
          int y = ity + (j >> 1);
          for (i = 0; i < 4; i++) {
@@ -1011,7 +1011,7 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs,
 
       rebase_colors(bqs->base_format[0], quadColor);
 
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (quad->inout.mask & (1 << j)) {
             int x = itx + (j & 1);
             int y = ity + (j >> 1);
@@ -1029,7 +1029,7 @@ blend_single_add_one_one(struct quad_stage *qs,
                          unsigned nr)
 {
    const struct blend_quad_stage *bqs = blend_quad_stage(qs);
-   float dest[4][QUAD_SIZE];
+   float dest[4][TGSI_QUAD_SIZE];
    uint i, j, q;
 
    struct softpipe_cached_tile *tile
@@ -1044,7 +1044,7 @@ blend_single_add_one_one(struct quad_stage *qs,
       const int ity = (quad->input.y0 & (TILE_SIZE-1));
       
       /* get/swizzle dest colors */
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = itx + (j & 1);
          int y = ity + (j >> 1);
          for (i = 0; i < 4; i++) {
@@ -1073,7 +1073,7 @@ blend_single_add_one_one(struct quad_stage *qs,
 
       rebase_colors(bqs->base_format[0], quadColor);
 
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (quad->inout.mask & (1 << j)) {
             int x = itx + (j & 1);
             int y = ity + (j >> 1);
@@ -1116,7 +1116,7 @@ single_output_color(struct quad_stage *qs,
 
       rebase_colors(bqs->base_format[0], quadColor);
 
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (quad->inout.mask & (1 << j)) {
             int x = itx + (j & 1);
             int y = ity + (j >> 1);
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 529a5ad..0f5c770 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -45,11 +45,11 @@
 struct depth_data {
    struct pipe_surface *ps;
    enum pipe_format format;
-   unsigned bzzzz[QUAD_SIZE];  /**< Z values fetched from depth buffer */
-   unsigned qzzzz[QUAD_SIZE];  /**< Z values from the quad */
-   ubyte stencilVals[QUAD_SIZE];
+   unsigned bzzzz[TGSI_QUAD_SIZE];  /**< Z values fetched from depth buffer */
+   unsigned qzzzz[TGSI_QUAD_SIZE];  /**< Z values from the quad */
+   ubyte stencilVals[TGSI_QUAD_SIZE];
    boolean use_shader_stencil_refs;
-   ubyte shader_stencil_refs[QUAD_SIZE];
+   ubyte shader_stencil_refs[TGSI_QUAD_SIZE];
    struct softpipe_cached_tile *tile;
 };
 
@@ -64,14 +64,14 @@ get_depth_stencil_values( struct depth_data *data,
 
    switch (data->format) {
    case PIPE_FORMAT_Z16_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = tile->data.depth16[y][x];
       }
       break;
    case PIPE_FORMAT_Z32_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = tile->data.depth32[y][x];
@@ -79,7 +79,7 @@ get_depth_stencil_values( struct depth_data *data,
       break;
    case PIPE_FORMAT_Z24X8_UNORM:
    case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = tile->data.depth32[y][x] & 0xffffff;
@@ -88,7 +88,7 @@ get_depth_stencil_values( struct depth_data *data,
       break;
    case PIPE_FORMAT_X8Z24_UNORM:
    case PIPE_FORMAT_S8_UINT_Z24_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = tile->data.depth32[y][x] >> 8;
@@ -96,7 +96,7 @@ get_depth_stencil_values( struct depth_data *data,
       }
       break;
    case PIPE_FORMAT_S8_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = 0;
@@ -104,14 +104,14 @@ get_depth_stencil_values( struct depth_data *data,
       }
       break;
    case PIPE_FORMAT_Z32_FLOAT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = tile->data.depth32[y][x];
       }
       break;
    case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          data->bzzzz[j] = tile->data.depth64[y][x] & 0xffffffff;
@@ -164,7 +164,7 @@ convert_quad_depth( struct depth_data *data,
       {
          float scale = 65535.0;
 
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale);
          }
       }
@@ -173,7 +173,7 @@ convert_quad_depth( struct depth_data *data,
       {
          double scale = (double) (uint) ~0UL;
 
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale);
          }
       }
@@ -183,7 +183,7 @@ convert_quad_depth( struct depth_data *data,
       {
          float scale = (float) ((1 << 24) - 1);
 
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale);
          }
       }
@@ -193,7 +193,7 @@ convert_quad_depth( struct depth_data *data,
       {
          float scale = (float) ((1 << 24) - 1);
 
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale);
          }
       }
@@ -203,7 +203,7 @@ convert_quad_depth( struct depth_data *data,
       {
          union fi fui;
 
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             fui.f = quad->output.depth[j];
             data->qzzzz[j] = fui.ui;
          }
@@ -236,7 +236,7 @@ convert_quad_stencil( struct depth_data *data,
    case PIPE_FORMAT_S8_UINT:
    case PIPE_FORMAT_Z32_FLOAT:
    case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          data->shader_stencil_refs[j] = ((unsigned)(quad->output.stencil[j]));
       }
       break;
@@ -259,7 +259,7 @@ write_depth_stencil_values( struct depth_data *data,
    /* put updated Z values back into cached tile */
    switch (data->format) {
    case PIPE_FORMAT_Z16_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth16[y][x] = (ushort) data->bzzzz[j];
@@ -267,49 +267,49 @@ write_depth_stencil_values( struct depth_data *data,
       break;
    case PIPE_FORMAT_Z24X8_UNORM:
    case PIPE_FORMAT_Z32_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth32[y][x] = data->bzzzz[j];
       }
       break;
    case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth32[y][x] = (data->stencilVals[j] << 24) | data->bzzzz[j];
       }
       break;
    case PIPE_FORMAT_S8_UINT_Z24_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth32[y][x] = (data->bzzzz[j] << 8) | data->stencilVals[j];
       }
       break;
    case PIPE_FORMAT_X8Z24_UNORM:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth32[y][x] = data->bzzzz[j] << 8;
       }
       break;
    case PIPE_FORMAT_S8_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.stencil8[y][x] = data->stencilVals[j];
       }
       break;
    case PIPE_FORMAT_Z32_FLOAT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth32[y][x] = data->bzzzz[j];
       }
       break;
    case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = quad->input.x0 % TILE_SIZE + (j & 1);
          int y = quad->input.y0 % TILE_SIZE + (j >> 1);
          tile->data.depth64[y][x] = (uint64_t)data->bzzzz[j] | ((uint64_t)data->stencilVals[j] << 32);
@@ -344,9 +344,9 @@ do_stencil_test(struct depth_data *data,
 {
    unsigned passMask = 0x0;
    unsigned j;
-   ubyte refs[QUAD_SIZE];
+   ubyte refs[TGSI_QUAD_SIZE];
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       if (data->use_shader_stencil_refs)
          refs[j] = data->shader_stencil_refs[j] & valMask;
       else 
@@ -358,42 +358,42 @@ do_stencil_test(struct depth_data *data,
       /* passMask = 0x0 */
       break;
    case PIPE_FUNC_LESS:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (refs[j] < (data->stencilVals[j] & valMask)) {
             passMask |= (1 << j);
          }
       }
       break;
    case PIPE_FUNC_EQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (refs[j] == (data->stencilVals[j] & valMask)) {
             passMask |= (1 << j);
          }
       }
       break;
    case PIPE_FUNC_LEQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (refs[j] <= (data->stencilVals[j] & valMask)) {
             passMask |= (1 << j);
          }
       }
       break;
    case PIPE_FUNC_GREATER:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (refs[j] > (data->stencilVals[j] & valMask)) {
             passMask |= (1 << j);
          }
       }
       break;
    case PIPE_FUNC_NOTEQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (refs[j] != (data->stencilVals[j] & valMask)) {
             passMask |= (1 << j);
          }
       }
       break;
    case PIPE_FUNC_GEQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (refs[j] >= (data->stencilVals[j] & valMask)) {
             passMask |= (1 << j);
          }
@@ -425,10 +425,10 @@ apply_stencil_op(struct depth_data *data,
                  unsigned mask, unsigned op, ubyte ref, ubyte wrtMask)
 {
    unsigned j;
-   ubyte newstencil[QUAD_SIZE];
-   ubyte refs[QUAD_SIZE];
+   ubyte newstencil[TGSI_QUAD_SIZE];
+   ubyte refs[TGSI_QUAD_SIZE];
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       newstencil[j] = data->stencilVals[j];
       if (data->use_shader_stencil_refs)
          refs[j] = data->shader_stencil_refs[j];
@@ -441,21 +441,21 @@ apply_stencil_op(struct depth_data *data,
       /* no-op */
       break;
    case PIPE_STENCIL_OP_ZERO:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             newstencil[j] = 0;
          }
       }
       break;
    case PIPE_STENCIL_OP_REPLACE:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             newstencil[j] = refs[j];
          }
       }
       break;
    case PIPE_STENCIL_OP_INCR:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             if (data->stencilVals[j] < STENCIL_MAX) {
                newstencil[j] = data->stencilVals[j] + 1;
@@ -464,7 +464,7 @@ apply_stencil_op(struct depth_data *data,
       }
       break;
    case PIPE_STENCIL_OP_DECR:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             if (data->stencilVals[j] > 0) {
                newstencil[j] = data->stencilVals[j] - 1;
@@ -473,21 +473,21 @@ apply_stencil_op(struct depth_data *data,
       }
       break;
    case PIPE_STENCIL_OP_INCR_WRAP:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             newstencil[j] = data->stencilVals[j] + 1;
          }
       }
       break;
    case PIPE_STENCIL_OP_DECR_WRAP:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             newstencil[j] = data->stencilVals[j] - 1;
          }
       }
       break;
    case PIPE_STENCIL_OP_INVERT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (mask & (1 << j)) {
             newstencil[j] = ~data->stencilVals[j];
          }
@@ -502,12 +502,12 @@ apply_stencil_op(struct depth_data *data,
     */
    if (wrtMask != STENCIL_MAX) {
       /* apply bit-wise stencil buffer writemask */
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          data->stencilVals[j] = (wrtMask & newstencil[j]) | (~wrtMask & data->stencilVals[j]);
       }
    }
    else {
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          data->stencilVals[j] = newstencil[j];
       }
    }
@@ -537,37 +537,37 @@ depth_test_quad(struct quad_stage *qs,
       /* Note this is pretty much a single sse or cell instruction.  
        * Like this:  quad->mask &= (quad->outputs.depth < zzzz);
        */
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 if (data->qzzzz[j] < data->bzzzz[j]) 
 	    zmask |= 1 << j;
       }
       break;
    case PIPE_FUNC_EQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 if (data->qzzzz[j] == data->bzzzz[j]) 
 	    zmask |= 1 << j;
       }
       break;
    case PIPE_FUNC_LEQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 if (data->qzzzz[j] <= data->bzzzz[j]) 
 	    zmask |= (1 << j);
       }
       break;
    case PIPE_FUNC_GREATER:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 if (data->qzzzz[j] > data->bzzzz[j]) 
 	    zmask |= (1 << j);
       }
       break;
    case PIPE_FUNC_NOTEQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 if (data->qzzzz[j] != data->bzzzz[j]) 
 	    zmask |= (1 << j);
       }
       break;
    case PIPE_FUNC_GEQUAL:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 if (data->qzzzz[j] >= data->bzzzz[j]) 
 	    zmask |= (1 << j);
       }
@@ -588,7 +588,7 @@ depth_test_quad(struct quad_stage *qs,
     * data due to stencil changes.
     */
    if (softpipe->depth_stencil->depth.writemask) {
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          if (quad->inout.mask & (1 << j)) {
             data->bzzzz[j] = data->qzzzz[j];
          }
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 7800ba8..8ec1aa2 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -90,7 +90,7 @@ coverage_quad(struct quad_stage *qs, struct quad_header *quad)
    for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
       float (*quadColor)[4] = quad->output.color[cbuf];
       unsigned j;
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          assert(quad->input.coverage[j] >= 0.0);
          assert(quad->input.coverage[j] <= 1.0);
          quadColor[3][j] *= quad->input.coverage[j];
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 0d67af3..6b15c87 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -625,11 +625,11 @@ setup_tri_coefficients(struct setup_context *setup)
 
       switch (vinfo->attrib[fragSlot].interp_mode) {
       case INTERP_CONSTANT:
-         for (j = 0; j < NUM_CHANNELS; j++)
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++)
             const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
          break;
       case INTERP_LINEAR:
-         for (j = 0; j < NUM_CHANNELS; j++) {
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
             tri_apply_cylindrical_wrap(setup->vmin[vertSlot][j],
                                        setup->vmid[vertSlot][j],
                                        setup->vmax[vertSlot][j],
@@ -639,7 +639,7 @@ setup_tri_coefficients(struct setup_context *setup)
          }
          break;
       case INTERP_PERSPECTIVE:
-         for (j = 0; j < NUM_CHANNELS; j++) {
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
             tri_apply_cylindrical_wrap(setup->vmin[vertSlot][j],
                                        setup->vmid[vertSlot][j],
                                        setup->vmax[vertSlot][j],
@@ -981,11 +981,11 @@ setup_line_coefficients(struct setup_context *setup,
 
       switch (vinfo->attrib[fragSlot].interp_mode) {
       case INTERP_CONSTANT:
-         for (j = 0; j < NUM_CHANNELS; j++)
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++)
             const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
          break;
       case INTERP_LINEAR:
-         for (j = 0; j < NUM_CHANNELS; j++) {
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
             line_apply_cylindrical_wrap(setup->vmin[vertSlot][j],
                                         setup->vmax[vertSlot][j],
                                         fsInfo->input_cylindrical_wrap[fragSlot] & (1 << j),
@@ -994,7 +994,7 @@ setup_line_coefficients(struct setup_context *setup,
          }
          break;
       case INTERP_PERSPECTIVE:
-         for (j = 0; j < NUM_CHANNELS; j++) {
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
             line_apply_cylindrical_wrap(setup->vmin[vertSlot][j],
                                         setup->vmax[vertSlot][j],
                                         fsInfo->input_cylindrical_wrap[fragSlot] & (1 << j),
@@ -1241,11 +1241,11 @@ sp_setup_point(struct setup_context *setup,
       case INTERP_CONSTANT:
          /* fall-through */
       case INTERP_LINEAR:
-         for (j = 0; j < NUM_CHANNELS; j++)
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++)
             const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
          break;
       case INTERP_PERSPECTIVE:
-         for (j = 0; j < NUM_CHANNELS; j++)
+         for (j = 0; j < TGSI_NUM_CHANNELS; j++)
             point_persp_coeff(setup, setup->vprovoke,
                               &setup->coef[fragSlot], vertSlot, j);
          break;
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index bd0546e..d54e02e 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -559,9 +559,9 @@ wrap_array_layer(const float coord[4], unsigned size, int layer[4])
  */
 static float
 compute_lambda_1d(const struct sp_sampler_variant *samp,
-                  const float s[QUAD_SIZE],
-                  const float t[QUAD_SIZE],
-                  const float p[QUAD_SIZE])
+                  const float s[TGSI_QUAD_SIZE],
+                  const float t[TGSI_QUAD_SIZE],
+                  const float p[TGSI_QUAD_SIZE])
 {
    const struct pipe_resource *texture = samp->view->texture;
    float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
@@ -574,9 +574,9 @@ compute_lambda_1d(const struct sp_sampler_variant *samp,
 
 static float
 compute_lambda_2d(const struct sp_sampler_variant *samp,
-                  const float s[QUAD_SIZE],
-                  const float t[QUAD_SIZE],
-                  const float p[QUAD_SIZE])
+                  const float s[TGSI_QUAD_SIZE],
+                  const float t[TGSI_QUAD_SIZE],
+                  const float p[TGSI_QUAD_SIZE])
 {
    const struct pipe_resource *texture = samp->view->texture;
    float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
@@ -593,9 +593,9 @@ compute_lambda_2d(const struct sp_sampler_variant *samp,
 
 static float
 compute_lambda_3d(const struct sp_sampler_variant *samp,
-                  const float s[QUAD_SIZE],
-                  const float t[QUAD_SIZE],
-                  const float p[QUAD_SIZE])
+                  const float s[TGSI_QUAD_SIZE],
+                  const float t[TGSI_QUAD_SIZE],
+                  const float p[TGSI_QUAD_SIZE])
 {
    const struct pipe_resource *texture = samp->view->texture;
    float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
@@ -622,9 +622,9 @@ compute_lambda_3d(const struct sp_sampler_variant *samp,
  */
 static float
 compute_lambda_vert(const struct sp_sampler_variant *samp,
-                    const float s[QUAD_SIZE],
-                    const float t[QUAD_SIZE],
-                    const float p[QUAD_SIZE])
+                    const float s[TGSI_QUAD_SIZE],
+                    const float t[TGSI_QUAD_SIZE],
+                    const float p[TGSI_QUAD_SIZE])
 {
    return 0.0f;
 }
@@ -826,7 +826,7 @@ pot_level_size(unsigned base_pot, unsigned level)
 
 
 static void
-print_sample(const char *function, float rgba[NUM_CHANNELS][QUAD_SIZE])
+print_sample(const char *function, float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    debug_printf("%s %g %g %g %g, %g %g %g %g, %g %g %g %g, %g %g %g %g\n",
                 function,
@@ -841,12 +841,12 @@ print_sample(const char *function, float rgba[NUM_CHANNELS][QUAD_SIZE])
  */
 static INLINE void
 img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
-                                const float s[QUAD_SIZE],
-                                const float t[QUAD_SIZE],
-                                const float p[QUAD_SIZE],
-                                const float c0[QUAD_SIZE],
+                                const float s[TGSI_QUAD_SIZE],
+                                const float t[TGSI_QUAD_SIZE],
+                                const float p[TGSI_QUAD_SIZE],
+                                const float c0[TGSI_QUAD_SIZE],
                                 enum tgsi_sampler_control control,
-                                float rgba[NUM_CHANNELS][QUAD_SIZE])
+                                float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned  j;
@@ -860,7 +860,7 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
    addr.value = 0;
    addr.bits.level = samp->level;
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       int c;
 
       float u = s[j] * xpot - 0.5F;
@@ -904,12 +904,12 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
 
 static INLINE void
 img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler,
-                                 const float s[QUAD_SIZE],
-                                 const float t[QUAD_SIZE],
-                                 const float p[QUAD_SIZE],
-                                 const float c0[QUAD_SIZE],
+                                 const float s[TGSI_QUAD_SIZE],
+                                 const float t[TGSI_QUAD_SIZE],
+                                 const float p[TGSI_QUAD_SIZE],
+                                 const float c0[TGSI_QUAD_SIZE],
                                  enum tgsi_sampler_control control,
-                                 float rgba[NUM_CHANNELS][QUAD_SIZE])
+                                 float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned  j;
@@ -921,7 +921,7 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler,
    addr.value = 0;
    addr.bits.level = samp->level;
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       int c;
 
       float u = s[j] * xpot;
@@ -948,12 +948,12 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler,
 
 static INLINE void
 img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler,
-                                const float s[QUAD_SIZE],
-                                const float t[QUAD_SIZE],
-                                const float p[QUAD_SIZE],
-                                const float c0[QUAD_SIZE],
+                                const float s[TGSI_QUAD_SIZE],
+                                const float t[TGSI_QUAD_SIZE],
+                                const float p[TGSI_QUAD_SIZE],
+                                const float c0[TGSI_QUAD_SIZE],
                                 enum tgsi_sampler_control control,
-                                float rgba[NUM_CHANNELS][QUAD_SIZE])
+                                float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned  j;
@@ -965,7 +965,7 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler,
    addr.value = 0;
    addr.bits.level = samp->level;
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       int c;
 
       float u = s[j] * xpot;
@@ -1001,12 +1001,12 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
-                        const float s[QUAD_SIZE],
-                        const float t[QUAD_SIZE],
-                        const float p[QUAD_SIZE],
-                        const float c0[QUAD_SIZE],
+                        const float s[TGSI_QUAD_SIZE],
+                        const float t[TGSI_QUAD_SIZE],
+                        const float p[TGSI_QUAD_SIZE],
+                        const float c0[TGSI_QUAD_SIZE],
                         enum tgsi_sampler_control control,
-                        float rgba[NUM_CHANNELS][QUAD_SIZE])
+                        float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1025,7 +1025,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
 
    samp->nearest_texcoord_s(s, width, x);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *out = get_texel_2d(samp, addr, x[j], 0);
       int c;
       for (c = 0; c < 4; c++) {
@@ -1041,12 +1041,12 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_1d_array_nearest(struct tgsi_sampler *tgsi_sampler,
-                            const float s[QUAD_SIZE],
-                            const float t[QUAD_SIZE],
-                            const float p[QUAD_SIZE],
-                            const float c0[QUAD_SIZE],
+                            const float s[TGSI_QUAD_SIZE],
+                            const float t[TGSI_QUAD_SIZE],
+                            const float p[TGSI_QUAD_SIZE],
+                            const float c0[TGSI_QUAD_SIZE],
                             enum tgsi_sampler_control control,
-                            float rgba[NUM_CHANNELS][QUAD_SIZE])
+                            float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1066,7 +1066,7 @@ img_filter_1d_array_nearest(struct tgsi_sampler *tgsi_sampler,
    samp->nearest_texcoord_s(s, width, x);
    wrap_array_layer(t, texture->array_size, layer);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *out = get_texel_1d_array(samp, addr, x[j], layer[j]);
       int c;
       for (c = 0; c < 4; c++) {
@@ -1082,12 +1082,12 @@ img_filter_1d_array_nearest(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
-                      const float s[QUAD_SIZE],
-                      const float t[QUAD_SIZE],
-                      const float p[QUAD_SIZE],
-                      const float c0[QUAD_SIZE],
+                      const float s[TGSI_QUAD_SIZE],
+                      const float t[TGSI_QUAD_SIZE],
+                      const float p[TGSI_QUAD_SIZE],
+                      const float c0[TGSI_QUAD_SIZE],
                       enum tgsi_sampler_control control,
-                      float rgba[NUM_CHANNELS][QUAD_SIZE])
+                      float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1110,7 +1110,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
    samp->nearest_texcoord_s(s, width, x);
    samp->nearest_texcoord_t(t, height, y);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *out = get_texel_2d(samp, addr, x[j], y[j]);
       int c;
       for (c = 0; c < 4; c++) {
@@ -1126,12 +1126,12 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_2d_array_nearest(struct tgsi_sampler *tgsi_sampler,
-                            const float s[QUAD_SIZE],
-                            const float t[QUAD_SIZE],
-                            const float p[QUAD_SIZE],
-                            const float c0[QUAD_SIZE],
+                            const float s[TGSI_QUAD_SIZE],
+                            const float t[TGSI_QUAD_SIZE],
+                            const float p[TGSI_QUAD_SIZE],
+                            const float c0[TGSI_QUAD_SIZE],
                             enum tgsi_sampler_control control,
-                            float rgba[NUM_CHANNELS][QUAD_SIZE])
+                            float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1154,7 +1154,7 @@ img_filter_2d_array_nearest(struct tgsi_sampler *tgsi_sampler,
    samp->nearest_texcoord_t(t, height, y);
    wrap_array_layer(p, texture->array_size, layer);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *out = get_texel_2d_array(samp, addr, x[j], y[j], layer[j]);
       int c;
       for (c = 0; c < 4; c++) {
@@ -1178,12 +1178,12 @@ face(union tex_tile_address addr, unsigned face )
 
 static void
 img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
-                        const float s[QUAD_SIZE],
-                        const float t[QUAD_SIZE],
-                        const float p[QUAD_SIZE],
-                        const float c0[QUAD_SIZE],
+                        const float s[TGSI_QUAD_SIZE],
+                        const float t[TGSI_QUAD_SIZE],
+                        const float p[TGSI_QUAD_SIZE],
+                        const float c0[TGSI_QUAD_SIZE],
                         enum tgsi_sampler_control control,
-                        float rgba[NUM_CHANNELS][QUAD_SIZE])
+                        float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1206,7 +1206,7 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
    samp->nearest_texcoord_s(s, width, x);
    samp->nearest_texcoord_t(t, height, y);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *out = get_texel_2d(samp, face(addr, faces[j]), x[j], y[j]);
       int c;
       for (c = 0; c < 4; c++) {
@@ -1222,12 +1222,12 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
-                      const float s[QUAD_SIZE],
-                      const float t[QUAD_SIZE],
-                      const float p[QUAD_SIZE],
-                      const float c0[QUAD_SIZE],
+                      const float s[TGSI_QUAD_SIZE],
+                      const float t[TGSI_QUAD_SIZE],
+                      const float p[TGSI_QUAD_SIZE],
+                      const float c0[TGSI_QUAD_SIZE],
                       enum tgsi_sampler_control control,
-                      float rgba[NUM_CHANNELS][QUAD_SIZE])
+                      float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1252,7 +1252,7 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
    addr.value = 0;
    addr.bits.level = samp->level;
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *out = get_texel_3d(samp, addr, x[j], y[j], z[j]);
       int c;
       for (c = 0; c < 4; c++) {
@@ -1264,12 +1264,12 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
-                     const float s[QUAD_SIZE],
-                     const float t[QUAD_SIZE],
-                     const float p[QUAD_SIZE],
-                     const float c0[QUAD_SIZE],
+                     const float s[TGSI_QUAD_SIZE],
+                     const float t[TGSI_QUAD_SIZE],
+                     const float p[TGSI_QUAD_SIZE],
+                     const float c0[TGSI_QUAD_SIZE],
                      enum tgsi_sampler_control control,
-                     float rgba[NUM_CHANNELS][QUAD_SIZE])
+                     float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1289,7 +1289,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
 
    samp->linear_texcoord_s(s, width, x0, x1, xw);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *tx0 = get_texel_2d(samp, addr, x0[j], 0);
       const float *tx1 = get_texel_2d(samp, addr, x1[j], 0);
       int c;
@@ -1304,12 +1304,12 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_1d_array_linear(struct tgsi_sampler *tgsi_sampler,
-                           const float s[QUAD_SIZE],
-                           const float t[QUAD_SIZE],
-                           const float p[QUAD_SIZE],
-                           const float c0[QUAD_SIZE],
+                           const float s[TGSI_QUAD_SIZE],
+                           const float t[TGSI_QUAD_SIZE],
+                           const float p[TGSI_QUAD_SIZE],
+                           const float c0[TGSI_QUAD_SIZE],
                            enum tgsi_sampler_control control,
-                           float rgba[NUM_CHANNELS][QUAD_SIZE])
+                           float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1330,7 +1330,7 @@ img_filter_1d_array_linear(struct tgsi_sampler *tgsi_sampler,
    samp->linear_texcoord_s(s, width, x0, x1, xw);
    wrap_array_layer(t, texture->array_size, layer);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *tx0 = get_texel_1d_array(samp, addr, x0[j], layer[j]);
       const float *tx1 = get_texel_1d_array(samp, addr, x1[j], layer[j]);
       int c;
@@ -1345,12 +1345,12 @@ img_filter_1d_array_linear(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
-                     const float s[QUAD_SIZE],
-                     const float t[QUAD_SIZE],
-                     const float p[QUAD_SIZE],
-                     const float c0[QUAD_SIZE],
+                     const float s[TGSI_QUAD_SIZE],
+                     const float t[TGSI_QUAD_SIZE],
+                     const float p[TGSI_QUAD_SIZE],
+                     const float c0[TGSI_QUAD_SIZE],
                      enum tgsi_sampler_control control,
-                     float rgba[NUM_CHANNELS][QUAD_SIZE])
+                     float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1373,7 +1373,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
    samp->linear_texcoord_s(s, width,  x0, x1, xw);
    samp->linear_texcoord_t(t, height, y0, y1, yw);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *tx0 = get_texel_2d(samp, addr, x0[j], y0[j]);
       const float *tx1 = get_texel_2d(samp, addr, x1[j], y0[j]);
       const float *tx2 = get_texel_2d(samp, addr, x0[j], y1[j]);
@@ -1392,12 +1392,12 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_2d_array_linear(struct tgsi_sampler *tgsi_sampler,
-                           const float s[QUAD_SIZE],
-                           const float t[QUAD_SIZE],
-                           const float p[QUAD_SIZE],
-                           const float c0[QUAD_SIZE],
+                           const float s[TGSI_QUAD_SIZE],
+                           const float t[TGSI_QUAD_SIZE],
+                           const float p[TGSI_QUAD_SIZE],
+                           const float c0[TGSI_QUAD_SIZE],
                            enum tgsi_sampler_control control,
-                           float rgba[NUM_CHANNELS][QUAD_SIZE])
+                           float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1421,7 +1421,7 @@ img_filter_2d_array_linear(struct tgsi_sampler *tgsi_sampler,
    samp->linear_texcoord_t(t, height, y0, y1, yw);
    wrap_array_layer(p, texture->array_size, layer);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       const float *tx0 = get_texel_2d_array(samp, addr, x0[j], y0[j], layer[j]);
       const float *tx1 = get_texel_2d_array(samp, addr, x1[j], y0[j], layer[j]);
       const float *tx2 = get_texel_2d_array(samp, addr, x0[j], y1[j], layer[j]);
@@ -1440,12 +1440,12 @@ img_filter_2d_array_linear(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
-                       const float s[QUAD_SIZE],
-                       const float t[QUAD_SIZE],
-                       const float p[QUAD_SIZE],
-                       const float c0[QUAD_SIZE],
+                       const float s[TGSI_QUAD_SIZE],
+                       const float t[TGSI_QUAD_SIZE],
+                       const float p[TGSI_QUAD_SIZE],
+                       const float c0[TGSI_QUAD_SIZE],
                        enum tgsi_sampler_control control,
-                       float rgba[NUM_CHANNELS][QUAD_SIZE])
+                       float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1469,7 +1469,7 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
    samp->linear_texcoord_s(s, width,  x0, x1, xw);
    samp->linear_texcoord_t(t, height, y0, y1, yw);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       union tex_tile_address addrj = face(addr, faces[j]);
       const float *tx0 = get_texel_2d(samp, addrj, x0[j], y0[j]);
       const float *tx1 = get_texel_2d(samp, addrj, x1[j], y0[j]);
@@ -1489,12 +1489,12 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
 
 static void
 img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
-                     const float s[QUAD_SIZE],
-                     const float t[QUAD_SIZE],
-                     const float p[QUAD_SIZE],
-                     const float c0[QUAD_SIZE],
+                     const float s[TGSI_QUAD_SIZE],
+                     const float t[TGSI_QUAD_SIZE],
+                     const float p[TGSI_QUAD_SIZE],
+                     const float c0[TGSI_QUAD_SIZE],
                      enum tgsi_sampler_control control,
-                     float rgba[NUM_CHANNELS][QUAD_SIZE])
+                     float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1520,7 +1520,7 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
    samp->linear_texcoord_t(t, height, y0, y1, yw);
    samp->linear_texcoord_p(p, depth,  z0, z1, zw);
 
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       int c;
 
       const float *tx00 = get_texel_3d(samp, addr, x0[j], y0[j], z0[j]);
@@ -1551,12 +1551,12 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
 static INLINE void
 compute_lod(const struct pipe_sampler_state *sampler,
             const float biased_lambda,
-            const float lodbias[QUAD_SIZE],
-            float lod[QUAD_SIZE])
+            const float lodbias[TGSI_QUAD_SIZE],
+            float lod[TGSI_QUAD_SIZE])
 {
    uint i;
 
-   for (i = 0; i < QUAD_SIZE; i++) {
+   for (i = 0; i < TGSI_QUAD_SIZE; i++) {
       lod[i] = biased_lambda + lodbias[i];
       lod[i] = CLAMP(lod[i], sampler->min_lod, sampler->max_lod);
    }
@@ -1565,18 +1565,18 @@ compute_lod(const struct pipe_sampler_state *sampler,
 
 static void
 mip_filter_linear(struct tgsi_sampler *tgsi_sampler,
-                  const float s[QUAD_SIZE],
-                  const float t[QUAD_SIZE],
-                  const float p[QUAD_SIZE],
-                  const float c0[QUAD_SIZE],
+                  const float s[TGSI_QUAD_SIZE],
+                  const float t[TGSI_QUAD_SIZE],
+                  const float p[TGSI_QUAD_SIZE],
+                  const float c0[TGSI_QUAD_SIZE],
                   enum tgsi_sampler_control control,
-                  float rgba[NUM_CHANNELS][QUAD_SIZE])
+                  float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
    int level0;
    float lambda;
-   float lod[QUAD_SIZE];
+   float lod[TGSI_QUAD_SIZE];
 
    if (control == tgsi_sampler_lod_bias) {
       lambda = samp->compute_lambda(samp, s, t, p) + samp->sampler->lod_bias;
@@ -1612,7 +1612,7 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler,
       samp->level = level0+1;
       samp->min_img_filter(tgsi_sampler, s, t, p, NULL, tgsi_sampler_lod_bias, rgba1);
 
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          for (c = 0; c < 4; c++) {
             rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]);
          }
@@ -1632,17 +1632,17 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler,
  */
 static void
 mip_filter_nearest(struct tgsi_sampler *tgsi_sampler,
-                   const float s[QUAD_SIZE],
-                   const float t[QUAD_SIZE],
-                   const float p[QUAD_SIZE],
-                   const float c0[QUAD_SIZE],
+                   const float s[TGSI_QUAD_SIZE],
+                   const float t[TGSI_QUAD_SIZE],
+                   const float p[TGSI_QUAD_SIZE],
+                   const float c0[TGSI_QUAD_SIZE],
                    enum tgsi_sampler_control control,
-                   float rgba[NUM_CHANNELS][QUAD_SIZE])
+                   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
    float lambda;
-   float lod[QUAD_SIZE];
+   float lod[TGSI_QUAD_SIZE];
 
    if (control == tgsi_sampler_lod_bias) {
       lambda = samp->compute_lambda(samp, s, t, p) + samp->sampler->lod_bias;
@@ -1675,16 +1675,16 @@ mip_filter_nearest(struct tgsi_sampler *tgsi_sampler,
 
 static void
 mip_filter_none(struct tgsi_sampler *tgsi_sampler,
-                const float s[QUAD_SIZE],
-                const float t[QUAD_SIZE],
-                const float p[QUAD_SIZE],
-                const float c0[QUAD_SIZE],
+                const float s[TGSI_QUAD_SIZE],
+                const float t[TGSI_QUAD_SIZE],
+                const float p[TGSI_QUAD_SIZE],
+                const float c0[TGSI_QUAD_SIZE],
                 enum tgsi_sampler_control control,
-                float rgba[NUM_CHANNELS][QUAD_SIZE])
+                float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    float lambda;
-   float lod[QUAD_SIZE];
+   float lod[TGSI_QUAD_SIZE];
 
    if (control == tgsi_sampler_lod_bias) {
       lambda = samp->compute_lambda(samp, s, t, p) + samp->sampler->lod_bias;
@@ -1743,14 +1743,14 @@ create_filter_table(void)
  */
 static void
 img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler,
-                  const float s[QUAD_SIZE],
-                  const float t[QUAD_SIZE],
-                  const float p[QUAD_SIZE],
-                  const float c0[QUAD_SIZE],
+                  const float s[TGSI_QUAD_SIZE],
+                  const float t[TGSI_QUAD_SIZE],
+                  const float p[TGSI_QUAD_SIZE],
+                  const float c0[TGSI_QUAD_SIZE],
                   enum tgsi_sampler_control control,
                   const float dudx, const float dvdx,
                   const float dudy, const float dvdy,
-                  float rgba[NUM_CHANNELS][QUAD_SIZE])
+                  float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
@@ -1781,10 +1781,10 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler,
    float box_u = 2.0 / d * sqrt(d*C*F); /* box_u -> half of bbox with   */
    float box_v = 2.0 / d * sqrt(A*d*F); /* box_v -> half of bbox height */
 
-   float rgba_temp[NUM_CHANNELS][QUAD_SIZE];
-   float s_buffer[QUAD_SIZE];
-   float t_buffer[QUAD_SIZE];
-   float weight_buffer[QUAD_SIZE];
+   float rgba_temp[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
+   float s_buffer[TGSI_QUAD_SIZE];
+   float t_buffer[TGSI_QUAD_SIZE];
+   float weight_buffer[TGSI_QUAD_SIZE];
    unsigned buffer_next;
    int j;
    float den;// = 0.0F;
@@ -1810,7 +1810,7 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler,
     */
    ddq = 2 * A;
    
-   for (j = 0; j < QUAD_SIZE; j++) {
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
       /* Heckbert MS thesis, p. 59; scan over the bounding box of the ellipse
        * and incrementally update the value of Ax^2+Bxy*Cy^2; when this
        * value, q, is less than F, we're inside the ellipse
@@ -1847,7 +1847,7 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler,
                t_buffer[buffer_next] = v / ((float) height);
             
                buffer_next++;
-               if (buffer_next == QUAD_SIZE) {
+               if (buffer_next == TGSI_QUAD_SIZE) {
                   /* 4 texel coords are in the buffer -> read it now */
                   unsigned jj;
                   /* it is assumed that samp->min_img_filter is set to
@@ -1928,18 +1928,18 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler,
  */
 static void
 mip_filter_linear_aniso(struct tgsi_sampler *tgsi_sampler,
-                        const float s[QUAD_SIZE],
-                        const float t[QUAD_SIZE],
-                        const float p[QUAD_SIZE],
-                        const float c0[QUAD_SIZE],
+                        const float s[TGSI_QUAD_SIZE],
+                        const float t[TGSI_QUAD_SIZE],
+                        const float p[TGSI_QUAD_SIZE],
+                        const float c0[TGSI_QUAD_SIZE],
                         enum tgsi_sampler_control control,
-                        float rgba[NUM_CHANNELS][QUAD_SIZE])
+                        float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
    int level0;
    float lambda;
-   float lod[QUAD_SIZE];
+   float lod[TGSI_QUAD_SIZE];
 
    float s_to_u = u_minify(texture->width0, samp->view->u.tex.first_level);
    float t_to_v = u_minify(texture->height0, samp->view->u.tex.first_level);
@@ -2028,18 +2028,18 @@ mip_filter_linear_aniso(struct tgsi_sampler *tgsi_sampler,
 static void
 mip_filter_linear_2d_linear_repeat_POT(
    struct tgsi_sampler *tgsi_sampler,
-   const float s[QUAD_SIZE],
-   const float t[QUAD_SIZE],
-   const float p[QUAD_SIZE],
-   const float c0[QUAD_SIZE],
+   const float s[TGSI_QUAD_SIZE],
+   const float t[TGSI_QUAD_SIZE],
+   const float p[TGSI_QUAD_SIZE],
+   const float c0[TGSI_QUAD_SIZE],
    enum tgsi_sampler_control control,
-   float rgba[NUM_CHANNELS][QUAD_SIZE])
+   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->view->texture;
    int level0;
    float lambda;
-   float lod[QUAD_SIZE];
+   float lod[TGSI_QUAD_SIZE];
 
    if (control == tgsi_sampler_lod_bias) {
       lambda = samp->compute_lambda(samp, s, t, p) + samp->sampler->lod_bias;
@@ -2077,7 +2077,7 @@ mip_filter_linear_2d_linear_repeat_POT(
       samp->level = level0+1;
       img_filter_2d_linear_repeat_POT(tgsi_sampler, s, t, p, NULL, tgsi_sampler_lod_bias, rgba1);
 
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          for (c = 0; c < 4; c++) {
             rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]);
          }
@@ -2096,12 +2096,12 @@ mip_filter_linear_2d_linear_repeat_POT(
  */
 static void
 sample_compare(struct tgsi_sampler *tgsi_sampler,
-               const float s[QUAD_SIZE],
-               const float t[QUAD_SIZE],
-               const float p[QUAD_SIZE],
-               const float c0[QUAD_SIZE],
+               const float s[TGSI_QUAD_SIZE],
+               const float t[TGSI_QUAD_SIZE],
+               const float p[TGSI_QUAD_SIZE],
+               const float c0[TGSI_QUAD_SIZE],
                enum tgsi_sampler_control control,
-               float rgba[NUM_CHANNELS][QUAD_SIZE])
+               float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_sampler_state *sampler = samp->sampler;
@@ -2206,12 +2206,12 @@ sample_compare(struct tgsi_sampler *tgsi_sampler,
  */
 static void
 sample_cube(struct tgsi_sampler *tgsi_sampler,
-            const float s[QUAD_SIZE],
-            const float t[QUAD_SIZE],
-            const float p[QUAD_SIZE],
-            const float c0[QUAD_SIZE],
+            const float s[TGSI_QUAD_SIZE],
+            const float t[TGSI_QUAD_SIZE],
+            const float p[TGSI_QUAD_SIZE],
+            const float c0[TGSI_QUAD_SIZE],
             enum tgsi_sampler_control control,
-            float rgba[NUM_CHANNELS][QUAD_SIZE])
+            float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned j;
@@ -2251,7 +2251,7 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
       if (arx >= ary && arx >= arz) {
          float sign = (rx >= 0.0F) ? 1.0F : -1.0F;
          uint face = (rx >= 0.0F) ? PIPE_TEX_FACE_POS_X : PIPE_TEX_FACE_NEG_X;
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             const float ima = -0.5F / fabsf(s[j]);
             ssss[j] = sign *  p[j] * ima + 0.5F;
             tttt[j] =         t[j] * ima + 0.5F;
@@ -2261,7 +2261,7 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
       else if (ary >= arx && ary >= arz) {
          float sign = (ry >= 0.0F) ? 1.0F : -1.0F;
          uint face = (ry >= 0.0F) ? PIPE_TEX_FACE_POS_Y : PIPE_TEX_FACE_NEG_Y;
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             const float ima = -0.5F / fabsf(t[j]);
             ssss[j] =        -s[j] * ima + 0.5F;
             tttt[j] = sign * -p[j] * ima + 0.5F;
@@ -2271,7 +2271,7 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
       else {
          float sign = (rz >= 0.0F) ? 1.0F : -1.0F;
          uint face = (rz >= 0.0F) ? PIPE_TEX_FACE_POS_Z : PIPE_TEX_FACE_NEG_Z;
-         for (j = 0; j < QUAD_SIZE; j++) {
+         for (j = 0; j < TGSI_QUAD_SIZE; j++) {
             const float ima = -0.5F / fabsf(p[j]);
             ssss[j] = sign * -s[j] * ima + 0.5F;
             tttt[j] =         t[j] * ima + 0.5F;
@@ -2288,8 +2288,8 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
 }
 
 static void do_swizzling(const struct sp_sampler_variant *samp,
-                         float in[NUM_CHANNELS][QUAD_SIZE],
-                         float out[NUM_CHANNELS][QUAD_SIZE])
+                         float in[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
+                         float out[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    int j;
    const unsigned swizzle_r = samp->key.bits.swizzle_r;
@@ -2360,15 +2360,15 @@ static void do_swizzling(const struct sp_sampler_variant *samp,
 
 static void
 sample_swizzle(struct tgsi_sampler *tgsi_sampler,
-               const float s[QUAD_SIZE],
-               const float t[QUAD_SIZE],
-               const float p[QUAD_SIZE],
-               const float c0[QUAD_SIZE],
+               const float s[TGSI_QUAD_SIZE],
+               const float t[TGSI_QUAD_SIZE],
+               const float p[TGSI_QUAD_SIZE],
+               const float c0[TGSI_QUAD_SIZE],
                enum tgsi_sampler_control control,
-               float rgba[NUM_CHANNELS][QUAD_SIZE])
+               float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
-   float rgba_temp[NUM_CHANNELS][QUAD_SIZE];
+   float rgba_temp[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
 
    samp->sample_target(tgsi_sampler, s, t, p, c0, control, rgba_temp);
 
@@ -2634,12 +2634,12 @@ sample_get_dims(struct tgsi_sampler *tgsi_sampler, int level,
    via the TGSI TXF opcode. */
 static void
 sample_get_texels(struct tgsi_sampler *tgsi_sampler,
-	   const int v_i[QUAD_SIZE],
-	   const int v_j[QUAD_SIZE],
-	   const int v_k[QUAD_SIZE],
-	   const int lod[QUAD_SIZE],
+	   const int v_i[TGSI_QUAD_SIZE],
+	   const int v_j[TGSI_QUAD_SIZE],
+	   const int v_k[TGSI_QUAD_SIZE],
+	   const int lod[TGSI_QUAD_SIZE],
 	   const int8_t offset[3],
-	   float rgba[NUM_CHANNELS][QUAD_SIZE])
+	   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
 {
    const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    union tex_tile_address addr;
@@ -2657,7 +2657,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
 
    switch(texture->target) {
    case PIPE_TEXTURE_1D:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 tx = get_texel_2d(samp, addr, v_i[j] + offset[0], 0);
 	 for (c = 0; c < 4; c++) {
 	    rgba[c][j] = tx[c];
@@ -2665,7 +2665,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
       }
       break;
    case PIPE_TEXTURE_1D_ARRAY:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 tx = get_texel_1d_array(samp, addr, v_i[j] + offset[0],
 				 v_j[j] + offset[1]);
 	 for (c = 0; c < 4; c++) {
@@ -2675,7 +2675,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
       break;
    case PIPE_TEXTURE_2D:
    case PIPE_TEXTURE_RECT:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 tx = get_texel_2d(samp, addr, v_i[j] + offset[0],
 			   v_j[j] + offset[1]);
 	 for (c = 0; c < 4; c++) {
@@ -2684,7 +2684,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
       }
       break;
    case PIPE_TEXTURE_2D_ARRAY:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 tx = get_texel_2d_array(samp, addr, v_i[j] + offset[0],
 				 v_j[j] + offset[1],
 				 v_k[j] + offset[2]);
@@ -2694,7 +2694,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
       }
       break;
    case PIPE_TEXTURE_3D:
-      for (j = 0; j < QUAD_SIZE; j++) {
+      for (j = 0; j < TGSI_QUAD_SIZE; j++) {
 	 tx = get_texel_3d(samp, addr, v_i[j] + offset[0], 
 			   v_j[j] + offset[1],
 			   v_k[j] + offset[2]);
@@ -2710,7 +2710,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
    }
 
    if (need_swizzle) {
-      float rgba_temp[NUM_CHANNELS][QUAD_SIZE];
+      float rgba_temp[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
       memcpy(rgba_temp, rgba, sizeof(rgba_temp));
       do_swizzling(samp, rgba_temp, rgba);
    }
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h
index f0b867e..7fdabd4 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.h
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.h
@@ -45,17 +45,17 @@ typedef void (*wrap_linear_func)(const float s[4],
                                  float w[4]);
 
 typedef float (*compute_lambda_func)(const struct sp_sampler_variant *sampler,
-                                     const float s[QUAD_SIZE],
-                                     const float t[QUAD_SIZE],
-                                     const float p[QUAD_SIZE]);
+                                     const float s[TGSI_QUAD_SIZE],
+                                     const float t[TGSI_QUAD_SIZE],
+                                     const float p[TGSI_QUAD_SIZE]);
 
 typedef void (*filter_func)(struct tgsi_sampler *tgsi_sampler,
-                            const float s[QUAD_SIZE],
-                            const float t[QUAD_SIZE],
-                            const float p[QUAD_SIZE],
-                            const float c0[QUAD_SIZE],
+                            const float s[TGSI_QUAD_SIZE],
+                            const float t[TGSI_QUAD_SIZE],
+                            const float p[TGSI_QUAD_SIZE],
+                            const float c0[TGSI_QUAD_SIZE],
                             enum tgsi_sampler_control control,
-                            float rgba[NUM_CHANNELS][QUAD_SIZE]);
+                            float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]);
 
 
 union sp_sampler_key {
@@ -148,11 +148,11 @@ sp_sampler_variant(const struct tgsi_sampler *sampler)
 
 extern void
 sp_get_samples(struct tgsi_sampler *tgsi_sampler,
-               const float s[QUAD_SIZE],
-               const float t[QUAD_SIZE],
-               const float p[QUAD_SIZE],
+               const float s[TGSI_QUAD_SIZE],
+               const float t[TGSI_QUAD_SIZE],
+               const float p[TGSI_QUAD_SIZE],
                float lodbias,
-               float rgba[NUM_CHANNELS][QUAD_SIZE]);
+               float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]);
 
 
 #endif /* SP_TEX_SAMPLE_H */
-- 
1.7.3.4



More information about the mesa-dev mailing list