[Mesa-dev] [PATCH 3/6] gallium: merge PIPE_SWIZZLE_* and UTIL_FORMAT_SWIZZLE_*

Marek Olšák maraeo at gmail.com
Sat Apr 16 12:50:09 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

Use PIPE_SWIZZLE_* everywhere.
Use X/Y/Z/W/0/1 instead of RED, GREEN, BLUE, ALPHA, ZERO, ONE.
The new enum is called pipe_swizzle.
---
 src/gallium/auxiliary/gallivm/lp_bld_format_aos.c  |  10 +-
 src/gallium/auxiliary/gallivm/lp_bld_format_soa.c  |   8 +-
 src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c |   2 +-
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c  |   8 +-
 src/gallium/auxiliary/gallivm/lp_bld_swizzle.c     |  46 ++++-----
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c    |  16 +--
 src/gallium/auxiliary/translate/translate_sse.c    | 110 ++++++++++-----------
 src/gallium/auxiliary/util/u_blitter.c             |   8 +-
 src/gallium/auxiliary/util/u_format.c              |  74 +++++++-------
 src/gallium/auxiliary/util/u_format.h              |  30 ++----
 src/gallium/auxiliary/util/u_format_table.py       |  14 +--
 src/gallium/auxiliary/util/u_sampler.c             |  18 ++--
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c       |   2 +-
 src/gallium/auxiliary/vl/vl_video_buffer.c         |   6 +-
 src/gallium/drivers/freedreno/a2xx/fd2_gmem.c      |   4 +-
 src/gallium/drivers/freedreno/a2xx/fd2_util.c      |  16 +--
 src/gallium/drivers/freedreno/a3xx/fd3_emit.c      |   4 +-
 src/gallium/drivers/freedreno/a3xx/fd3_format.c    |  12 +--
 src/gallium/drivers/freedreno/a4xx/fd4_emit.c      |   4 +-
 src/gallium/drivers/freedreno/a4xx/fd4_format.c    |  12 +--
 src/gallium/drivers/i915/i915_state_sampler.c      |  32 +++---
 src/gallium/drivers/ilo/ilo_shader.c               |  32 +++---
 src/gallium/drivers/ilo/shader/ilo_shader_fs.c     |  12 +--
 src/gallium/drivers/ilo/shader/ilo_shader_vs.c     |  12 +--
 src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c    |   8 +-
 src/gallium/drivers/llvmpipe/lp_bld_depth.c        |   8 +-
 src/gallium/drivers/llvmpipe/lp_screen.c           |   2 +-
 src/gallium/drivers/llvmpipe/lp_state_fs.c         |   2 +-
 src/gallium/drivers/llvmpipe/lp_state_setup.c      |   4 +-
 src/gallium/drivers/nouveau/nouveau_video.c        |   6 +-
 src/gallium/drivers/nouveau/nouveau_vp3_video.c    |   4 +-
 src/gallium/drivers/nouveau/nv30/nv30_texture.c    |   2 +-
 src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c   |   8 +-
 src/gallium/drivers/nouveau/nv50/nv50_surface.c    |   8 +-
 src/gallium/drivers/nouveau/nv50/nv50_tex.c        |  12 +--
 src/gallium/drivers/nouveau/nv50/nv84_video.c      |   4 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_surface.c    |   8 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_tex.c        |  12 +--
 src/gallium/drivers/r300/r300_context.h            |   2 +-
 src/gallium/drivers/r300/r300_state_derived.c      |   4 +-
 src/gallium/drivers/r300/r300_texture.c            |  12 +--
 src/gallium/drivers/r600/evergreen_state.c         |   2 +-
 src/gallium/drivers/r600/r600_state_common.c       |  12 +--
 src/gallium/drivers/radeon/r600_texture.c          |  14 +--
 src/gallium/drivers/radeonsi/si_state.c            |  30 +++---
 src/gallium/drivers/softpipe/sp_tex_sample.c       |  30 +++---
 src/gallium/drivers/svga/svga_tgsi_insn.c          |  22 ++---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c        |  24 ++---
 src/gallium/drivers/vc4/vc4_formats.c              |   8 +-
 src/gallium/drivers/vc4/vc4_nir_lower_io.c         |   2 +-
 src/gallium/drivers/vc4/vc4_program.c              |  14 +--
 src/gallium/drivers/vc4/vc4_uniforms.c             |   8 +-
 src/gallium/include/pipe/p_defines.h               |  20 ++--
 src/gallium/state_trackers/nine/basetexture9.c     |  36 +++----
 src/gallium/state_trackers/nine/device9.c          |   8 +-
 src/gallium/state_trackers/vdpau/device.c          |  24 ++---
 src/gallium/state_trackers/xvmc/subpicture.c       |   2 +-
 src/gallium/tests/graw/graw_util.h                 |   8 +-
 src/gallium/tests/graw/tex-srgb.c                  |  16 +--
 src/gallium/tests/graw/tex-swizzle.c               |  22 ++---
 src/mesa/state_tracker/st_cb_copyimage.c           |  32 +++---
 src/mesa/state_tracker/st_cb_drawpixels.c          |  16 +--
 src/mesa/state_tracker/st_cb_texture.c             |  52 +++++-----
 63 files changed, 495 insertions(+), 505 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
index a41b30b..b921e97 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
@@ -54,7 +54,7 @@
 
 /**
  * Basic swizzling.  Rearrange the order of the unswizzled array elements
- * according to the format description.  PIPE_SWIZZLE_ZERO/ONE are supported
+ * according to the format description.  PIPE_SWIZZLE_0/ONE are supported
  * too.
  * Ex: if unswizzled[4] = {B, G, R, x}, then swizzled_out[4] = {R, G, B, 1}.
  */
@@ -69,16 +69,16 @@ lp_build_format_swizzle_aos(const struct util_format_description *desc,
    assert(bld->type.length % 4 == 0);
 
    for (chan = 0; chan < 4; ++chan) {
-      enum util_format_swizzle swizzle;
+      enum pipe_swizzle swizzle;
 
       if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
          /*
           * For ZS formats do RGBA = ZZZ1
           */
          if (chan == 3) {
-            swizzle = UTIL_FORMAT_SWIZZLE_1;
-         } else if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_NONE) {
-            swizzle = UTIL_FORMAT_SWIZZLE_0;
+            swizzle = PIPE_SWIZZLE_1;
+         } else if (desc->swizzle[0] == PIPE_SWIZZLE_NONE) {
+            swizzle = PIPE_SWIZZLE_0;
          } else {
             swizzle = desc->swizzle[0];
          }
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index 8bae94a..7fc4e8d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -48,11 +48,11 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
                             const LLVMValueRef *unswizzled,
                             LLVMValueRef swizzled_out[4])
 {
-   assert(UTIL_FORMAT_SWIZZLE_0 == PIPE_SWIZZLE_ZERO);
-   assert(UTIL_FORMAT_SWIZZLE_1 == PIPE_SWIZZLE_ONE);
+   assert(PIPE_SWIZZLE_0 == (int)PIPE_SWIZZLE_0);
+   assert(PIPE_SWIZZLE_1 == (int)PIPE_SWIZZLE_1);
 
    if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
-      enum util_format_swizzle swizzle;
+      enum pipe_swizzle swizzle;
       LLVMValueRef depth_or_stencil;
 
       if (util_format_has_stencil(format_desc) &&
@@ -76,7 +76,7 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
    else {
       unsigned chan;
       for (chan = 0; chan < 4; ++chan) {
-         enum util_format_swizzle swizzle = format_desc->swizzle[chan];
+         enum pipe_swizzle swizzle = format_desc->swizzle[chan];
          swizzled_out[chan] = lp_build_swizzle_soa_channel(bld, unswizzled, swizzle);
       }
    }
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
index e4849fe..a6311a1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
@@ -353,7 +353,7 @@ lp_build_float_to_srgb_packed(struct gallivm_state *gallivm,
 
    dst = lp_build_zero(gallivm, int32_type);
    for (chan = 0; chan < dst_fmt->nr_channels; chan++) {
-      if (dst_fmt->swizzle[chan] <= UTIL_FORMAT_SWIZZLE_W) {
+      if (dst_fmt->swizzle[chan] <= PIPE_SWIZZLE_W) {
          unsigned ls;
          LLVMValueRef shifted, shift_val;
          ls = dst_fmt->channel[dst_fmt->swizzle[chan]].shift;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 937948b..394c429 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1360,7 +1360,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
          if (is_gather) {
             /* more hacks for swizzling, should be X, ONE or ZERO... */
             unsigned chan_swiz = bld->static_texture_state->swizzle_r;
-            if (chan_swiz <= PIPE_SWIZZLE_ALPHA) {
+            if (chan_swiz <= PIPE_SWIZZLE_W) {
                colors0[0] = lp_build_select(texel_bld, cmpval10,
                                             texel_bld->one, texel_bld->zero);
                colors0[1] = lp_build_select(texel_bld, cmpval11,
@@ -1370,7 +1370,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
                colors0[3] = lp_build_select(texel_bld, cmpval00,
                                             texel_bld->one, texel_bld->zero);
             }
-            else if (chan_swiz == PIPE_SWIZZLE_ZERO) {
+            else if (chan_swiz == PIPE_SWIZZLE_0) {
                colors0[0] = colors0[1] = colors0[2] = colors0[3] =
                             texel_bld->zero;
             }
@@ -1838,7 +1838,7 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
       const struct util_format_description *format_desc = bld->format_desc;
       unsigned chan_type;
       /* not entirely sure we couldn't end up with non-valid swizzle here */
-      chan_type = format_desc->swizzle[0] <= UTIL_FORMAT_SWIZZLE_W ?
+      chan_type = format_desc->swizzle[0] <= PIPE_SWIZZLE_W ?
                      format_desc->channel[format_desc->swizzle[0]].type :
                      UTIL_FORMAT_TYPE_FLOAT;
       if (chan_type != UTIL_FORMAT_TYPE_FLOAT) {
@@ -1957,7 +1957,7 @@ lp_build_clamp_border_color(struct lp_build_sample_context *bld,
       else {
          chan = util_format_get_first_non_void_channel(format_desc->format);
       }
-      if (chan >= 0 && chan <= UTIL_FORMAT_SWIZZLE_W) {
+      if (chan >= 0 && chan <= PIPE_SWIZZLE_W) {
          unsigned chan_type = format_desc->channel[chan].type;
          unsigned chan_norm = format_desc->channel[chan].normalized;
          unsigned chan_pure = format_desc->channel[chan].pure_integer;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index f571838..92f387d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -361,10 +361,10 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
    const unsigned n = type.length;
    unsigned i, j;
 
-   if (swizzles[0] == PIPE_SWIZZLE_RED &&
-       swizzles[1] == PIPE_SWIZZLE_GREEN &&
-       swizzles[2] == PIPE_SWIZZLE_BLUE &&
-       swizzles[3] == PIPE_SWIZZLE_ALPHA) {
+   if (swizzles[0] == PIPE_SWIZZLE_X &&
+       swizzles[1] == PIPE_SWIZZLE_Y &&
+       swizzles[2] == PIPE_SWIZZLE_Z &&
+       swizzles[3] == PIPE_SWIZZLE_W) {
       return a;
    }
 
@@ -372,14 +372,14 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
        swizzles[1] == swizzles[2] &&
        swizzles[2] == swizzles[3]) {
       switch (swizzles[0]) {
-      case PIPE_SWIZZLE_RED:
-      case PIPE_SWIZZLE_GREEN:
-      case PIPE_SWIZZLE_BLUE:
-      case PIPE_SWIZZLE_ALPHA:
+      case PIPE_SWIZZLE_X:
+      case PIPE_SWIZZLE_Y:
+      case PIPE_SWIZZLE_Z:
+      case PIPE_SWIZZLE_W:
          return lp_build_swizzle_scalar_aos(bld, a, swizzles[0], 4);
-      case PIPE_SWIZZLE_ZERO:
+      case PIPE_SWIZZLE_0:
          return bld->zero;
-      case PIPE_SWIZZLE_ONE:
+      case PIPE_SWIZZLE_1:
          return bld->one;
       case LP_BLD_SWIZZLE_DONTCARE:
          return bld->undef;
@@ -408,21 +408,21 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
             default:
                assert(0);
                /* fall through */
-            case PIPE_SWIZZLE_RED:
-            case PIPE_SWIZZLE_GREEN:
-            case PIPE_SWIZZLE_BLUE:
-            case PIPE_SWIZZLE_ALPHA:
+            case PIPE_SWIZZLE_X:
+            case PIPE_SWIZZLE_Y:
+            case PIPE_SWIZZLE_Z:
+            case PIPE_SWIZZLE_W:
                shuffle = j + swizzles[i];
                shuffles[j + i] = LLVMConstInt(i32t, shuffle, 0);
                break;
-            case PIPE_SWIZZLE_ZERO:
+            case PIPE_SWIZZLE_0:
                shuffle = type.length + 0;
                shuffles[j + i] = LLVMConstInt(i32t, shuffle, 0);
                if (!aux[0]) {
                   aux[0] = lp_build_const_elem(bld->gallivm, type, 0.0);
                }
                break;
-            case PIPE_SWIZZLE_ONE:
+            case PIPE_SWIZZLE_1:
                shuffle = type.length + 1;
                shuffles[j + i] = LLVMConstInt(i32t, shuffle, 0);
                if (!aux[1]) {
@@ -474,7 +474,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
        * Start with a mixture of 1 and 0.
        */
       for (chan = 0; chan < 4; ++chan) {
-         if (swizzles[chan] == PIPE_SWIZZLE_ONE) {
+         if (swizzles[chan] == PIPE_SWIZZLE_1) {
             cond |= 1 << chan;
          }
       }
@@ -574,14 +574,14 @@ lp_build_swizzle_soa_channel(struct lp_build_context *bld,
                              unsigned swizzle)
 {
    switch (swizzle) {
-   case PIPE_SWIZZLE_RED:
-   case PIPE_SWIZZLE_GREEN:
-   case PIPE_SWIZZLE_BLUE:
-   case PIPE_SWIZZLE_ALPHA:
+   case PIPE_SWIZZLE_X:
+   case PIPE_SWIZZLE_Y:
+   case PIPE_SWIZZLE_Z:
+   case PIPE_SWIZZLE_W:
       return unswizzled[swizzle];
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
       return bld->zero;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_1:
       return bld->one;
    default:
       assert(0);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index a19be8a..cdee083 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2507,10 +2507,10 @@ emit_sample(struct lp_build_tgsi_soa_context *bld,
                                  bld->bld_base.base.gallivm,
                                  &params);
 
-   if (inst->Src[1].Register.SwizzleX != PIPE_SWIZZLE_RED ||
-       inst->Src[1].Register.SwizzleY != PIPE_SWIZZLE_GREEN ||
-       inst->Src[1].Register.SwizzleZ != PIPE_SWIZZLE_BLUE ||
-       inst->Src[1].Register.SwizzleW != PIPE_SWIZZLE_ALPHA) {
+   if (inst->Src[1].Register.SwizzleX != PIPE_SWIZZLE_X ||
+       inst->Src[1].Register.SwizzleY != PIPE_SWIZZLE_Y ||
+       inst->Src[1].Register.SwizzleZ != PIPE_SWIZZLE_Z ||
+       inst->Src[1].Register.SwizzleW != PIPE_SWIZZLE_W) {
       unsigned char swizzles[4];
       swizzles[0] = inst->Src[1].Register.SwizzleX;
       swizzles[1] = inst->Src[1].Register.SwizzleY;
@@ -2638,10 +2638,10 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
                                  &params);
 
    if (is_samplei &&
-       (inst->Src[1].Register.SwizzleX != PIPE_SWIZZLE_RED ||
-        inst->Src[1].Register.SwizzleY != PIPE_SWIZZLE_GREEN ||
-        inst->Src[1].Register.SwizzleZ != PIPE_SWIZZLE_BLUE ||
-        inst->Src[1].Register.SwizzleW != PIPE_SWIZZLE_ALPHA)) {
+       (inst->Src[1].Register.SwizzleX != PIPE_SWIZZLE_X ||
+        inst->Src[1].Register.SwizzleY != PIPE_SWIZZLE_Y ||
+        inst->Src[1].Register.SwizzleZ != PIPE_SWIZZLE_Z ||
+        inst->Src[1].Register.SwizzleW != PIPE_SWIZZLE_W)) {
       unsigned char swizzles[4];
       swizzles[0] = inst->Src[1].Register.SwizzleX;
       swizzles[1] = inst->Src[1].Register.SwizzleY;
diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c
index b3c3b30..162e555 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -467,8 +467,8 @@ translate_attr_convert(struct translate_sse *p,
    unsigned i;
    boolean id_swizzle = TRUE;
    unsigned swizzle[4] =
-      { UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE,
-        UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE };
+      { PIPE_SWIZZLE_NONE, PIPE_SWIZZLE_NONE,
+        PIPE_SWIZZLE_NONE, PIPE_SWIZZLE_NONE };
    unsigned needed_chans = 0;
    unsigned imms[2] = { 0, 0x3f800000 };
 
@@ -510,7 +510,7 @@ translate_attr_convert(struct translate_sse *p,
       struct x86_reg dataXMM = x86_make_reg(file_XMM, 0);
 
       for (i = 0; i < output_desc->nr_channels; ++i) {
-         if (swizzle[i] == UTIL_FORMAT_SWIZZLE_0
+         if (swizzle[i] == PIPE_SWIZZLE_0
              && i >= input_desc->nr_channels)
             swizzle[i] = i;
       }
@@ -518,7 +518,7 @@ translate_attr_convert(struct translate_sse *p,
       for (i = 0; i < output_desc->nr_channels; ++i) {
          if (swizzle[i] < 4)
             needed_chans = MAX2(needed_chans, swizzle[i] + 1);
-         if (swizzle[i] < UTIL_FORMAT_SWIZZLE_0 && swizzle[i] != i)
+         if (swizzle[i] < PIPE_SWIZZLE_0 && swizzle[i] != i)
             id_swizzle = FALSE;
       }
 
@@ -630,9 +630,9 @@ translate_attr_convert(struct translate_sse *p,
                 && input_desc->channel[0].size != 64) {
                return FALSE;
             }
-            if (swizzle[3] == UTIL_FORMAT_SWIZZLE_1
+            if (swizzle[3] == PIPE_SWIZZLE_1
                 && input_desc->nr_channels <= 3) {
-               swizzle[3] = UTIL_FORMAT_SWIZZLE_W;
+               swizzle[3] = PIPE_SWIZZLE_W;
                needed_chans = CHANNELS_0001;
             }
             switch (input_desc->channel[0].size) {
@@ -661,63 +661,63 @@ translate_attr_convert(struct translate_sse *p,
       }
 
       if (output_desc->nr_channels >= 4
-          && swizzle[0] < UTIL_FORMAT_SWIZZLE_0
-          && swizzle[1] < UTIL_FORMAT_SWIZZLE_0
-          && swizzle[2] < UTIL_FORMAT_SWIZZLE_0
-          && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) {
+          && swizzle[0] < PIPE_SWIZZLE_0
+          && swizzle[1] < PIPE_SWIZZLE_0
+          && swizzle[2] < PIPE_SWIZZLE_0
+          && swizzle[3] < PIPE_SWIZZLE_0) {
          sse_movups(p->func, dst, dataXMM);
       }
       else {
          if (output_desc->nr_channels >= 2
-             && swizzle[0] < UTIL_FORMAT_SWIZZLE_0
-             && swizzle[1] < UTIL_FORMAT_SWIZZLE_0) {
+             && swizzle[0] < PIPE_SWIZZLE_0
+             && swizzle[1] < PIPE_SWIZZLE_0) {
             sse_movlps(p->func, dst, dataXMM);
          }
          else {
-            if (swizzle[0] < UTIL_FORMAT_SWIZZLE_0) {
+            if (swizzle[0] < PIPE_SWIZZLE_0) {
                sse_movss(p->func, dst, dataXMM);
             }
             else {
                x86_mov_imm(p->func, dst,
-                           imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]);
+                           imms[swizzle[0] - PIPE_SWIZZLE_0]);
             }
 
             if (output_desc->nr_channels >= 2) {
-               if (swizzle[1] < UTIL_FORMAT_SWIZZLE_0) {
+               if (swizzle[1] < PIPE_SWIZZLE_0) {
                   sse_shufps(p->func, dataXMM, dataXMM, SHUF(1, 1, 2, 3));
                   sse_movss(p->func, x86_make_disp(dst, 4), dataXMM);
                }
                else {
                   x86_mov_imm(p->func, x86_make_disp(dst, 4),
-                              imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0]);
+                              imms[swizzle[1] - PIPE_SWIZZLE_0]);
                }
             }
          }
 
          if (output_desc->nr_channels >= 3) {
             if (output_desc->nr_channels >= 4
-                && swizzle[2] < UTIL_FORMAT_SWIZZLE_0
-                && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) {
+                && swizzle[2] < PIPE_SWIZZLE_0
+                && swizzle[3] < PIPE_SWIZZLE_0) {
                sse_movhps(p->func, x86_make_disp(dst, 8), dataXMM);
             }
             else {
-               if (swizzle[2] < UTIL_FORMAT_SWIZZLE_0) {
+               if (swizzle[2] < PIPE_SWIZZLE_0) {
                   sse_shufps(p->func, dataXMM, dataXMM, SHUF(2, 2, 2, 3));
                   sse_movss(p->func, x86_make_disp(dst, 8), dataXMM);
                }
                else {
                   x86_mov_imm(p->func, x86_make_disp(dst, 8),
-                              imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]);
+                              imms[swizzle[2] - PIPE_SWIZZLE_0]);
                }
 
                if (output_desc->nr_channels >= 4) {
-                  if (swizzle[3] < UTIL_FORMAT_SWIZZLE_0) {
+                  if (swizzle[3] < PIPE_SWIZZLE_0) {
                      sse_shufps(p->func, dataXMM, dataXMM, SHUF(3, 3, 3, 3));
                      sse_movss(p->func, x86_make_disp(dst, 12), dataXMM);
                   }
                   else {
                      x86_mov_imm(p->func, x86_make_disp(dst, 12),
-                                 imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0]);
+                                 imms[swizzle[3] - PIPE_SWIZZLE_0]);
                   }
                }
             }
@@ -742,7 +742,7 @@ translate_attr_convert(struct translate_sse *p,
       unsigned imms[2] = { 0, 1 };
 
       for (i = 0; i < output_desc->nr_channels; ++i) {
-         if (swizzle[i] == UTIL_FORMAT_SWIZZLE_0
+         if (swizzle[i] == PIPE_SWIZZLE_0
              && i >= input_desc->nr_channels) {
             swizzle[i] = i;
          }
@@ -751,7 +751,7 @@ translate_attr_convert(struct translate_sse *p,
       for (i = 0; i < output_desc->nr_channels; ++i) {
          if (swizzle[i] < 4)
             needed_chans = MAX2(needed_chans, swizzle[i] + 1);
-         if (swizzle[i] < UTIL_FORMAT_SWIZZLE_0 && swizzle[i] != i)
+         if (swizzle[i] < PIPE_SWIZZLE_0 && swizzle[i] != i)
             id_swizzle = FALSE;
       }
 
@@ -806,16 +806,16 @@ translate_attr_convert(struct translate_sse *p,
       }
 
       if (output_desc->nr_channels >= 4
-          && swizzle[0] < UTIL_FORMAT_SWIZZLE_0
-          && swizzle[1] < UTIL_FORMAT_SWIZZLE_0
-          && swizzle[2] < UTIL_FORMAT_SWIZZLE_0
-          && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) {
+          && swizzle[0] < PIPE_SWIZZLE_0
+          && swizzle[1] < PIPE_SWIZZLE_0
+          && swizzle[2] < PIPE_SWIZZLE_0
+          && swizzle[3] < PIPE_SWIZZLE_0) {
          sse2_movq(p->func, dst, dataXMM);
       }
       else {
-         if (swizzle[0] < UTIL_FORMAT_SWIZZLE_0) {
+         if (swizzle[0] < PIPE_SWIZZLE_0) {
             if (output_desc->nr_channels >= 2
-                && swizzle[1] < UTIL_FORMAT_SWIZZLE_0) {
+                && swizzle[1] < PIPE_SWIZZLE_0) {
                sse2_movd(p->func, dst, dataXMM);
             }
             else {
@@ -823,19 +823,19 @@ translate_attr_convert(struct translate_sse *p,
                x86_mov16(p->func, dst, tmp);
                if (output_desc->nr_channels >= 2)
                   x86_mov16_imm(p->func, x86_make_disp(dst, 2),
-                                imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0]);
+                                imms[swizzle[1] - PIPE_SWIZZLE_0]);
             }
          }
          else {
             if (output_desc->nr_channels >= 2
-                && swizzle[1] >= UTIL_FORMAT_SWIZZLE_0) {
+                && swizzle[1] >= PIPE_SWIZZLE_0) {
                x86_mov_imm(p->func, dst,
-                           (imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0] << 16) |
-                           imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]);
+                           (imms[swizzle[1] - PIPE_SWIZZLE_0] << 16) |
+                           imms[swizzle[0] - PIPE_SWIZZLE_0]);
             }
             else {
                x86_mov16_imm(p->func, dst,
-                             imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]);
+                             imms[swizzle[0] - PIPE_SWIZZLE_0]);
                if (output_desc->nr_channels >= 2) {
                   sse2_movd(p->func, tmp, dataXMM);
                   x86_shr_imm(p->func, tmp, 16);
@@ -845,9 +845,9 @@ translate_attr_convert(struct translate_sse *p,
          }
 
          if (output_desc->nr_channels >= 3) {
-            if (swizzle[2] < UTIL_FORMAT_SWIZZLE_0) {
+            if (swizzle[2] < PIPE_SWIZZLE_0) {
                if (output_desc->nr_channels >= 4
-                   && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) {
+                   && swizzle[3] < PIPE_SWIZZLE_0) {
                   sse2_psrlq_imm(p->func, dataXMM, 32);
                   sse2_movd(p->func, x86_make_disp(dst, 4), dataXMM);
                }
@@ -857,20 +857,20 @@ translate_attr_convert(struct translate_sse *p,
                   x86_mov16(p->func, x86_make_disp(dst, 4), tmp);
                   if (output_desc->nr_channels >= 4) {
                      x86_mov16_imm(p->func, x86_make_disp(dst, 6),
-                                   imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0]);
+                                   imms[swizzle[3] - PIPE_SWIZZLE_0]);
                   }
                }
             }
             else {
                if (output_desc->nr_channels >= 4
-                   && swizzle[3] >= UTIL_FORMAT_SWIZZLE_0) {
+                   && swizzle[3] >= PIPE_SWIZZLE_0) {
                   x86_mov_imm(p->func, x86_make_disp(dst, 4),
-                              (imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0] << 16)
-                              | imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]);
+                              (imms[swizzle[3] - PIPE_SWIZZLE_0] << 16)
+                              | imms[swizzle[2] - PIPE_SWIZZLE_0]);
                }
                else {
                   x86_mov16_imm(p->func, x86_make_disp(dst, 4),
-                                imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]);
+                                imms[swizzle[2] - PIPE_SWIZZLE_0]);
 
                   if (output_desc->nr_channels >= 4) {
                      sse2_psrlq_imm(p->func, dataXMM, 48);
@@ -890,10 +890,10 @@ translate_attr_convert(struct translate_sse *p,
 
       if (input_desc->channel[0].size == 8 && input_desc->nr_channels == 4
           && output_desc->nr_channels == 4
-          && swizzle[0] == UTIL_FORMAT_SWIZZLE_W
-          && swizzle[1] == UTIL_FORMAT_SWIZZLE_Z
-          && swizzle[2] == UTIL_FORMAT_SWIZZLE_Y
-          && swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
+          && swizzle[0] == PIPE_SWIZZLE_W
+          && swizzle[1] == PIPE_SWIZZLE_Z
+          && swizzle[2] == PIPE_SWIZZLE_Y
+          && swizzle[3] == PIPE_SWIZZLE_X) {
          /* TODO: support movbe */
          x86_mov(p->func, tmp, src);
          x86_bswap(p->func, tmp);
@@ -904,9 +904,9 @@ translate_attr_convert(struct translate_sse *p,
       for (i = 0; i < output_desc->nr_channels; ++i) {
          switch (output_desc->channel[0].size) {
          case 8:
-            if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) {
+            if (swizzle[i] >= PIPE_SWIZZLE_0) {
                unsigned v = 0;
-               if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) {
+               if (swizzle[i] == PIPE_SWIZZLE_1) {
                   switch (output_desc->channel[0].type) {
                   case UTIL_FORMAT_TYPE_UNSIGNED:
                      v = output_desc->channel[0].normalized ? 0xff : 1;
@@ -926,9 +926,9 @@ translate_attr_convert(struct translate_sse *p,
             }
             break;
          case 16:
-            if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) {
+            if (swizzle[i] >= PIPE_SWIZZLE_0) {
                unsigned v = 0;
-               if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) {
+               if (swizzle[i] == PIPE_SWIZZLE_1) {
                   switch (output_desc->channel[1].type) {
                   case UTIL_FORMAT_TYPE_UNSIGNED:
                      v = output_desc->channel[1].normalized ? 0xffff : 1;
@@ -945,7 +945,7 @@ translate_attr_convert(struct translate_sse *p,
                }
                x86_mov16_imm(p->func, x86_make_disp(dst, i * 2), v);
             }
-            else if (swizzle[i] == UTIL_FORMAT_SWIZZLE_0) {
+            else if (swizzle[i] == PIPE_SWIZZLE_0) {
                x86_mov16_imm(p->func, x86_make_disp(dst, i * 2), 0);
             }
             else {
@@ -954,9 +954,9 @@ translate_attr_convert(struct translate_sse *p,
             }
             break;
          case 32:
-            if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) {
+            if (swizzle[i] >= PIPE_SWIZZLE_0) {
                unsigned v = 0;
-               if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) {
+               if (swizzle[i] == PIPE_SWIZZLE_1) {
                   switch (output_desc->channel[1].type) {
                   case UTIL_FORMAT_TYPE_UNSIGNED:
                      v = output_desc->channel[1].normalized ? 0xffffffff : 1;
@@ -979,10 +979,10 @@ translate_attr_convert(struct translate_sse *p,
             }
             break;
          case 64:
-            if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) {
+            if (swizzle[i] >= PIPE_SWIZZLE_0) {
                unsigned l = 0;
                unsigned h = 0;
-               if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) {
+               if (swizzle[i] == PIPE_SWIZZLE_1) {
                   switch (output_desc->channel[1].type) {
                   case UTIL_FORMAT_TYPE_UNSIGNED:
                      h = output_desc->channel[1].normalized ? 0xffffffff : 0;
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 3ca2c48..56aebde 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1389,10 +1389,10 @@ void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ,
     src_templ->u.tex.last_layer =
         src->target == PIPE_TEXTURE_3D ? u_minify(src->depth0, srclevel) - 1
                                        : src->array_size - 1;
-    src_templ->swizzle_r = PIPE_SWIZZLE_RED;
-    src_templ->swizzle_g = PIPE_SWIZZLE_GREEN;
-    src_templ->swizzle_b = PIPE_SWIZZLE_BLUE;
-    src_templ->swizzle_a = PIPE_SWIZZLE_ALPHA;
+    src_templ->swizzle_r = PIPE_SWIZZLE_X;
+    src_templ->swizzle_g = PIPE_SWIZZLE_Y;
+    src_templ->swizzle_b = PIPE_SWIZZLE_Z;
+    src_templ->swizzle_a = PIPE_SWIZZLE_W;
 }
 
 static boolean is_blit_generic_supported(struct blitter_context *blitter,
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 79630bf..1be5c97 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -70,7 +70,7 @@ util_format_has_alpha(enum pipe_format format)
 
    return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
            desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-          desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
+          desc->swizzle[3] != PIPE_SWIZZLE_1;
 }
 
 
@@ -82,10 +82,10 @@ util_format_is_luminance(enum pipe_format format)
 
    if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
         desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) {
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_1) {
       return TRUE;
    }
    return FALSE;
@@ -99,10 +99,10 @@ util_format_is_alpha(enum pipe_format format)
 
    if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
         desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
+       desc->swizzle[0] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[1] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[2] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[3] == PIPE_SWIZZLE_X) {
       return TRUE;
    }
    return FALSE;
@@ -196,10 +196,10 @@ util_format_is_luminance_alpha(enum pipe_format format)
 
    if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
         desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_Y) {
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_Y) {
       return TRUE;
    }
    return FALSE;
@@ -214,10 +214,10 @@ util_format_is_intensity(enum pipe_format format)
 
    if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
         desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_X) {
       return TRUE;
    }
    return FALSE;
@@ -486,7 +486,7 @@ util_is_format_compatible(const struct util_format_description *src_desc,
    }
 
    for (chan = 0; chan < 4; ++chan) {
-      enum util_format_swizzle swizzle = dst_desc->swizzle[chan];
+      enum pipe_swizzle swizzle = dst_desc->swizzle[chan];
 
       if (swizzle < 4) {
          if (src_desc->swizzle[chan] != swizzle) {
@@ -746,7 +746,7 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
    unsigned i;
 
    for (i = 0; i < 4; i++) {
-      dst[i] = swz2[i] <= UTIL_FORMAT_SWIZZLE_W ?
+      dst[i] = swz2[i] <= PIPE_SWIZZLE_W ?
                swz1[swz2[i]] : swz2[i];
    }
 }
@@ -761,41 +761,41 @@ void util_format_apply_color_swizzle(union pipe_color_union *dst,
    if (is_integer) {
       for (c = 0; c < 4; ++c) {
          switch (swz[c]) {
-         case PIPE_SWIZZLE_RED:   dst->ui[c] = src->ui[0]; break;
-         case PIPE_SWIZZLE_GREEN: dst->ui[c] = src->ui[1]; break;
-         case PIPE_SWIZZLE_BLUE:  dst->ui[c] = src->ui[2]; break;
-         case PIPE_SWIZZLE_ALPHA: dst->ui[c] = src->ui[3]; break;
+         case PIPE_SWIZZLE_X:   dst->ui[c] = src->ui[0]; break;
+         case PIPE_SWIZZLE_Y: dst->ui[c] = src->ui[1]; break;
+         case PIPE_SWIZZLE_Z:  dst->ui[c] = src->ui[2]; break;
+         case PIPE_SWIZZLE_W: dst->ui[c] = src->ui[3]; break;
          default:
-            dst->ui[c] = (swz[c] == PIPE_SWIZZLE_ONE) ? 1 : 0;
+            dst->ui[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1 : 0;
             break;
          }
       }
    } else {
       for (c = 0; c < 4; ++c) {
          switch (swz[c]) {
-         case PIPE_SWIZZLE_RED:   dst->f[c] = src->f[0]; break;
-         case PIPE_SWIZZLE_GREEN: dst->f[c] = src->f[1]; break;
-         case PIPE_SWIZZLE_BLUE:  dst->f[c] = src->f[2]; break;
-         case PIPE_SWIZZLE_ALPHA: dst->f[c] = src->f[3]; break;
+         case PIPE_SWIZZLE_X:   dst->f[c] = src->f[0]; break;
+         case PIPE_SWIZZLE_Y: dst->f[c] = src->f[1]; break;
+         case PIPE_SWIZZLE_Z:  dst->f[c] = src->f[2]; break;
+         case PIPE_SWIZZLE_W: dst->f[c] = src->f[3]; break;
          default:
-            dst->f[c] = (swz[c] == PIPE_SWIZZLE_ONE) ? 1.0f : 0.0f;
+            dst->f[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1.0f : 0.0f;
             break;
          }
       }
    }
 }
 
-void util_format_swizzle_4f(float *dst, const float *src,
+void pipe_swizzle_4f(float *dst, const float *src,
                             const unsigned char swz[4])
 {
    unsigned i;
 
    for (i = 0; i < 4; i++) {
-      if (swz[i] <= UTIL_FORMAT_SWIZZLE_W)
+      if (swz[i] <= PIPE_SWIZZLE_W)
          dst[i] = src[swz[i]];
-      else if (swz[i] == UTIL_FORMAT_SWIZZLE_0)
+      else if (swz[i] == PIPE_SWIZZLE_0)
          dst[i] = 0;
-      else if (swz[i] == UTIL_FORMAT_SWIZZLE_1)
+      else if (swz[i] == PIPE_SWIZZLE_1)
          dst[i] = 1;
    }
 }
@@ -807,16 +807,16 @@ void util_format_unswizzle_4f(float *dst, const float *src,
 
    for (i = 0; i < 4; i++) {
       switch (swz[i]) {
-      case UTIL_FORMAT_SWIZZLE_X:
+      case PIPE_SWIZZLE_X:
          dst[0] = src[i];
          break;
-      case UTIL_FORMAT_SWIZZLE_Y:
+      case PIPE_SWIZZLE_Y:
          dst[1] = src[i];
          break;
-      case UTIL_FORMAT_SWIZZLE_Z:
+      case PIPE_SWIZZLE_Z:
          dst[2] = src[i];
          break;
-      case UTIL_FORMAT_SWIZZLE_W:
+      case PIPE_SWIZZLE_W:
          dst[3] = src[i];
          break;
       }
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index ffdb864..a99c1bc 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -117,18 +117,6 @@ enum util_format_type {
 };
 
 
-enum util_format_swizzle {
-   UTIL_FORMAT_SWIZZLE_X = 0,
-   UTIL_FORMAT_SWIZZLE_Y = 1,
-   UTIL_FORMAT_SWIZZLE_Z = 2,
-   UTIL_FORMAT_SWIZZLE_W = 3,
-   UTIL_FORMAT_SWIZZLE_0 = 4,
-   UTIL_FORMAT_SWIZZLE_1 = 5,
-   UTIL_FORMAT_SWIZZLE_NONE = 6,
-   UTIL_FORMAT_SWIZZLE_MAX = 7  /**< Number of enums counter (must be last) */
-};
-
-
 enum util_format_colorspace {
    UTIL_FORMAT_COLORSPACE_RGB = 0,
    UTIL_FORMAT_COLORSPACE_SRGB = 1,
@@ -518,14 +506,14 @@ static inline boolean
 util_format_has_depth(const struct util_format_description *desc)
 {
    return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
-          desc->swizzle[0] != UTIL_FORMAT_SWIZZLE_NONE;
+          desc->swizzle[0] != PIPE_SWIZZLE_NONE;
 }
 
 static inline boolean
 util_format_has_stencil(const struct util_format_description *desc)
 {
    return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
-          desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE;
+          desc->swizzle[1] != PIPE_SWIZZLE_NONE;
 }
 
 static inline boolean
@@ -565,7 +553,7 @@ util_get_depth_format_type(const struct util_format_description *desc)
 {
    unsigned depth_channel = desc->swizzle[0];
    if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
-       depth_channel != UTIL_FORMAT_SWIZZLE_NONE) {
+       depth_channel != PIPE_SWIZZLE_NONE) {
       return desc->channel[depth_channel].type;
    } else {
       return UTIL_FORMAT_TYPE_VOID;
@@ -872,13 +860,13 @@ util_format_get_component_bits(enum pipe_format format,
    }
 
    switch (desc->swizzle[component]) {
-   case UTIL_FORMAT_SWIZZLE_X:
+   case PIPE_SWIZZLE_X:
       return desc->channel[0].size;
-   case UTIL_FORMAT_SWIZZLE_Y:
+   case PIPE_SWIZZLE_Y:
       return desc->channel[1].size;
-   case UTIL_FORMAT_SWIZZLE_Z:
+   case PIPE_SWIZZLE_Z:
       return desc->channel[2].size;
-   case UTIL_FORMAT_SWIZZLE_W:
+   case PIPE_SWIZZLE_W:
       return desc->channel[3].size;
    default:
       return 0;
@@ -1298,14 +1286,14 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
 
 /* Apply the swizzle provided in \param swz (which is one of PIPE_SWIZZLE_x)
  * to \param src and store the result in \param dst.
- * \param is_integer determines the value written for PIPE_SWIZZLE_ONE.
+ * \param is_integer determines the value written for PIPE_SWIZZLE_1.
  */
 void util_format_apply_color_swizzle(union pipe_color_union *dst,
                                      const union pipe_color_union *src,
                                      const unsigned char swz[4],
                                      const boolean is_integer);
 
-void util_format_swizzle_4f(float *dst, const float *src,
+void pipe_swizzle_4f(float *dst, const float *src,
                             const unsigned char swz[4]);
 
 void util_format_unswizzle_4f(float *dst, const float *src,
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 879d10f..51de965 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -69,13 +69,13 @@ def bool_map(value):
 
 
 swizzle_map = {
-    SWIZZLE_X:    "UTIL_FORMAT_SWIZZLE_X",
-    SWIZZLE_Y:    "UTIL_FORMAT_SWIZZLE_Y",
-    SWIZZLE_Z:    "UTIL_FORMAT_SWIZZLE_Z",
-    SWIZZLE_W:    "UTIL_FORMAT_SWIZZLE_W",
-    SWIZZLE_0:    "UTIL_FORMAT_SWIZZLE_0",
-    SWIZZLE_1:    "UTIL_FORMAT_SWIZZLE_1",
-    SWIZZLE_NONE: "UTIL_FORMAT_SWIZZLE_NONE",
+    SWIZZLE_X:    "PIPE_SWIZZLE_X",
+    SWIZZLE_Y:    "PIPE_SWIZZLE_Y",
+    SWIZZLE_Z:    "PIPE_SWIZZLE_Z",
+    SWIZZLE_W:    "PIPE_SWIZZLE_W",
+    SWIZZLE_0:    "PIPE_SWIZZLE_0",
+    SWIZZLE_1:    "PIPE_SWIZZLE_1",
+    SWIZZLE_NONE: "PIPE_SWIZZLE_NONE",
 }
 
 
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
index 86799fd..5da1d5f 100644
--- a/src/gallium/auxiliary/util/u_sampler.c
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -52,10 +52,10 @@ default_template(struct pipe_sampler_view *view,
    view->u.tex.first_layer = 0;
    view->u.tex.last_layer = texture->target == PIPE_TEXTURE_3D ?
                                texture->depth0 - 1 : texture->array_size - 1;
-   view->swizzle_r = PIPE_SWIZZLE_RED;
-   view->swizzle_g = PIPE_SWIZZLE_GREEN;
-   view->swizzle_b = PIPE_SWIZZLE_BLUE;
-   view->swizzle_a = PIPE_SWIZZLE_ALPHA;
+   view->swizzle_r = PIPE_SWIZZLE_X;
+   view->swizzle_g = PIPE_SWIZZLE_Y;
+   view->swizzle_b = PIPE_SWIZZLE_Z;
+   view->swizzle_a = PIPE_SWIZZLE_W;
 
    /* Override default green and blue component expansion to the requested
     * one.
@@ -66,7 +66,7 @@ default_template(struct pipe_sampler_view *view,
     * components.
     *
     * To make it look less hackish, one would have to add
-    * UTIL_FORMAT_SWIZZLE_EXPAND to indicate components for expansion
+    * PIPE_SWIZZLE_EXPAND to indicate components for expansion
     * and then override without exceptions or favoring one component
     * over another.
     */
@@ -75,10 +75,10 @@ default_template(struct pipe_sampler_view *view,
 
       assert(desc);
       if (desc) {
-         if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) {
+         if (desc->swizzle[1] == PIPE_SWIZZLE_0) {
             view->swizzle_g = expand_green_blue;
          }
-         if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) {
+         if (desc->swizzle[2] == PIPE_SWIZZLE_0) {
             view->swizzle_b = expand_green_blue;
          }
       }
@@ -94,7 +94,7 @@ u_sampler_view_default_template(struct pipe_sampler_view *view,
    default_template(view,
                     texture,
                     format,
-                    PIPE_SWIZZLE_ZERO);
+                    PIPE_SWIZZLE_0);
 }
 
 void
@@ -106,5 +106,5 @@ u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
    default_template(view,
                     texture,
                     format,
-                    PIPE_SWIZZLE_ONE);
+                    PIPE_SWIZZLE_1);
 }
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index b5c7045..db62b44 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -189,7 +189,7 @@ init_zscan_buffer(struct vl_mpeg12_decoder *dec, struct vl_mpeg12_buffer *buffer
 
    memset(&sv_tmpl, 0, sizeof(sv_tmpl));
    u_sampler_view_default_template(&sv_tmpl, res, res->format);
-   sv_tmpl.swizzle_r = sv_tmpl.swizzle_g = sv_tmpl.swizzle_b = sv_tmpl.swizzle_a = PIPE_SWIZZLE_RED;
+   sv_tmpl.swizzle_r = sv_tmpl.swizzle_g = sv_tmpl.swizzle_b = sv_tmpl.swizzle_a = PIPE_SWIZZLE_X;
    buffer->zscan_source = dec->context->create_sampler_view(dec->context, res, &sv_tmpl);
    pipe_resource_reference(&res, NULL);
    if (!buffer->zscan_source)
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 462fdcb..4a68ac1 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -297,7 +297,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer)
          u_sampler_view_default_template(&sv_templ, buf->resources[i], buf->resources[i]->format);
 
          if (util_format_get_nr_components(buf->resources[i]->format) == 1)
-            sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = sv_templ.swizzle_a = PIPE_SWIZZLE_RED;
+            sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = sv_templ.swizzle_a = PIPE_SWIZZLE_X;
 
          buf->sampler_view_planes[i] = pipe->create_sampler_view(pipe, buf->resources[i], &sv_templ);
          if (!buf->sampler_view_planes[i])
@@ -344,8 +344,8 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer)
 
          memset(&sv_templ, 0, sizeof(sv_templ));
          u_sampler_view_default_template(&sv_templ, res, sampler_format[plane_order[i]]);
-         sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_RED + j;
-         sv_templ.swizzle_a = PIPE_SWIZZLE_ONE;
+         sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_X + j;
+         sv_templ.swizzle_a = PIPE_SWIZZLE_1;
          buf->sampler_view_components[component] = pipe->create_sampler_view(pipe, res, &sv_templ);
          if (!buf->sampler_view_components[component])
             goto error;
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c
index 982c9c2..aa47267 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c
@@ -186,8 +186,8 @@ emit_mem2gmem_surf(struct fd_context *ctx, uint32_t base,
 			A2XX_RB_COLOR_INFO_BASE(base) |
 			A2XX_RB_COLOR_INFO_FORMAT(fd2_pipe2color(psurf->format)));
 
-	swiz = fd2_tex_swiz(psurf->format, PIPE_SWIZZLE_RED, PIPE_SWIZZLE_GREEN,
-			PIPE_SWIZZLE_BLUE, PIPE_SWIZZLE_ALPHA);
+	swiz = fd2_tex_swiz(psurf->format, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y,
+			PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W);
 
 	/* emit fb as a texture: */
 	OUT_PKT3(ring, CP_SET_CONSTANT, 7);
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_util.c b/src/gallium/drivers/freedreno/a2xx/fd2_util.c
index 9781326..6cece91 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_util.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_util.c
@@ -294,12 +294,12 @@ tex_swiz(unsigned swiz)
 {
 	switch (swiz) {
 	default:
-	case PIPE_SWIZZLE_RED:   return SQ_TEX_X;
-	case PIPE_SWIZZLE_GREEN: return SQ_TEX_Y;
-	case PIPE_SWIZZLE_BLUE:  return SQ_TEX_Z;
-	case PIPE_SWIZZLE_ALPHA: return SQ_TEX_W;
-	case PIPE_SWIZZLE_ZERO:  return SQ_TEX_ZERO;
-	case PIPE_SWIZZLE_ONE:   return SQ_TEX_ONE;
+	case PIPE_SWIZZLE_X:   return SQ_TEX_X;
+	case PIPE_SWIZZLE_Y: return SQ_TEX_Y;
+	case PIPE_SWIZZLE_Z:  return SQ_TEX_Z;
+	case PIPE_SWIZZLE_W: return SQ_TEX_W;
+	case PIPE_SWIZZLE_0:  return SQ_TEX_ZERO;
+	case PIPE_SWIZZLE_1:   return SQ_TEX_ONE;
 	}
 }
 
@@ -311,8 +311,8 @@ fd2_tex_swiz(enum pipe_format format, unsigned swizzle_r, unsigned swizzle_g,
 			util_format_description(format);
 	uint8_t swiz[] = {
 			swizzle_r, swizzle_g, swizzle_b, swizzle_a,
-			PIPE_SWIZZLE_ZERO, PIPE_SWIZZLE_ONE,
-			PIPE_SWIZZLE_ONE, PIPE_SWIZZLE_ONE,
+			PIPE_SWIZZLE_0, PIPE_SWIZZLE_1,
+			PIPE_SWIZZLE_1, PIPE_SWIZZLE_1,
 	};
 
 	return A2XX_SQ_TEX_3_SWIZ_X(tex_swiz(swiz[desc->swizzle[0]])) |
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
index adfa9a9..7d508e7 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
@@ -309,8 +309,8 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring,
 
 		OUT_RING(ring, A3XX_TEX_CONST_0_FMT(fd3_pipe2tex(format)) |
 				 A3XX_TEX_CONST_0_TYPE(A3XX_TEX_2D) |
-				 fd3_tex_swiz(format,  PIPE_SWIZZLE_RED, PIPE_SWIZZLE_GREEN,
-							  PIPE_SWIZZLE_BLUE, PIPE_SWIZZLE_ALPHA));
+				 fd3_tex_swiz(format,  PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y,
+							  PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W));
 		OUT_RING(ring, A3XX_TEX_CONST_1_FETCHSIZE(TFETCH_DISABLE) |
 				 A3XX_TEX_CONST_1_WIDTH(psurf[i]->width) |
 				 A3XX_TEX_CONST_1_HEIGHT(psurf[i]->height));
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_format.c b/src/gallium/drivers/freedreno/a3xx/fd3_format.c
index 52ea944..7050ded 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_format.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_format.c
@@ -391,12 +391,12 @@ tex_swiz(unsigned swiz)
 {
 	switch (swiz) {
 	default:
-	case PIPE_SWIZZLE_RED:   return A3XX_TEX_X;
-	case PIPE_SWIZZLE_GREEN: return A3XX_TEX_Y;
-	case PIPE_SWIZZLE_BLUE:  return A3XX_TEX_Z;
-	case PIPE_SWIZZLE_ALPHA: return A3XX_TEX_W;
-	case PIPE_SWIZZLE_ZERO:  return A3XX_TEX_ZERO;
-	case PIPE_SWIZZLE_ONE:   return A3XX_TEX_ONE;
+	case PIPE_SWIZZLE_X:   return A3XX_TEX_X;
+	case PIPE_SWIZZLE_Y: return A3XX_TEX_Y;
+	case PIPE_SWIZZLE_Z:  return A3XX_TEX_Z;
+	case PIPE_SWIZZLE_W: return A3XX_TEX_W;
+	case PIPE_SWIZZLE_0:  return A3XX_TEX_ZERO;
+	case PIPE_SWIZZLE_1:   return A3XX_TEX_ONE;
 	}
 }
 
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
index 81ed16c..e984d9b 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
@@ -282,8 +282,8 @@ fd4_emit_gmem_restore_tex(struct fd_ringbuffer *ring, unsigned nr_bufs,
 
 			OUT_RING(ring, A4XX_TEX_CONST_0_FMT(fd4_pipe2tex(format)) |
 					A4XX_TEX_CONST_0_TYPE(A4XX_TEX_2D) |
-					fd4_tex_swiz(format,  PIPE_SWIZZLE_RED, PIPE_SWIZZLE_GREEN,
-							PIPE_SWIZZLE_BLUE, PIPE_SWIZZLE_ALPHA));
+					fd4_tex_swiz(format,  PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y,
+							PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W));
 			OUT_RING(ring, A4XX_TEX_CONST_1_WIDTH(bufs[i]->width) |
 					A4XX_TEX_CONST_1_HEIGHT(bufs[i]->height));
 			OUT_RING(ring, A4XX_TEX_CONST_2_PITCH(slice->pitch * rsc->cpp) |
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_format.c b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
index c240745..bd7e285 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_format.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
@@ -441,12 +441,12 @@ tex_swiz(unsigned swiz)
 {
 	switch (swiz) {
 	default:
-	case PIPE_SWIZZLE_RED:   return A4XX_TEX_X;
-	case PIPE_SWIZZLE_GREEN: return A4XX_TEX_Y;
-	case PIPE_SWIZZLE_BLUE:  return A4XX_TEX_Z;
-	case PIPE_SWIZZLE_ALPHA: return A4XX_TEX_W;
-	case PIPE_SWIZZLE_ZERO:  return A4XX_TEX_ZERO;
-	case PIPE_SWIZZLE_ONE:   return A4XX_TEX_ONE;
+	case PIPE_SWIZZLE_X:   return A4XX_TEX_X;
+	case PIPE_SWIZZLE_Y: return A4XX_TEX_Y;
+	case PIPE_SWIZZLE_Z:  return A4XX_TEX_Z;
+	case PIPE_SWIZZLE_W: return A4XX_TEX_W;
+	case PIPE_SWIZZLE_0:  return A4XX_TEX_ZERO;
+	case PIPE_SWIZZLE_1:   return A4XX_TEX_ONE;
 	}
 }
 
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index c874361..84ed151 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -193,10 +193,10 @@ struct i915_tracked_state i915_hw_samplers = {
 static uint translate_texture_format(enum pipe_format pipeFormat,
                                      const struct pipe_sampler_view* view)
 {
-   if ( (view->swizzle_r != PIPE_SWIZZLE_RED ||
-         view->swizzle_g != PIPE_SWIZZLE_GREEN ||
-         view->swizzle_b != PIPE_SWIZZLE_BLUE ||
-         view->swizzle_a != PIPE_SWIZZLE_ALPHA ) &&
+   if ( (view->swizzle_r != PIPE_SWIZZLE_X ||
+         view->swizzle_g != PIPE_SWIZZLE_Y ||
+         view->swizzle_b != PIPE_SWIZZLE_Z ||
+         view->swizzle_a != PIPE_SWIZZLE_W ) &&
          pipeFormat != PIPE_FORMAT_Z24_UNORM_S8_UINT &&
          pipeFormat != PIPE_FORMAT_Z24X8_UNORM )
       debug_printf("i915: unsupported texture swizzle for format %d\n", pipeFormat);
@@ -248,20 +248,20 @@ static uint translate_texture_format(enum pipe_format pipeFormat,
    case PIPE_FORMAT_Z24_UNORM_S8_UINT:
    case PIPE_FORMAT_Z24X8_UNORM:
       {
-         if ( view->swizzle_r == PIPE_SWIZZLE_RED &&
-              view->swizzle_g == PIPE_SWIZZLE_RED &&
-              view->swizzle_b == PIPE_SWIZZLE_RED &&
-              view->swizzle_a == PIPE_SWIZZLE_ONE)
+         if ( view->swizzle_r == PIPE_SWIZZLE_X &&
+              view->swizzle_g == PIPE_SWIZZLE_X &&
+              view->swizzle_b == PIPE_SWIZZLE_X &&
+              view->swizzle_a == PIPE_SWIZZLE_1)
             return (MAPSURF_32BIT | MT_32BIT_xA824);
-         if ( view->swizzle_r == PIPE_SWIZZLE_RED &&
-              view->swizzle_g == PIPE_SWIZZLE_RED &&
-              view->swizzle_b == PIPE_SWIZZLE_RED &&
-              view->swizzle_a == PIPE_SWIZZLE_RED)
+         if ( view->swizzle_r == PIPE_SWIZZLE_X &&
+              view->swizzle_g == PIPE_SWIZZLE_X &&
+              view->swizzle_b == PIPE_SWIZZLE_X &&
+              view->swizzle_a == PIPE_SWIZZLE_X)
             return (MAPSURF_32BIT | MT_32BIT_xI824);
-         if ( view->swizzle_r == PIPE_SWIZZLE_ZERO &&
-              view->swizzle_g == PIPE_SWIZZLE_ZERO &&
-              view->swizzle_b == PIPE_SWIZZLE_ZERO &&
-              view->swizzle_a == PIPE_SWIZZLE_RED)
+         if ( view->swizzle_r == PIPE_SWIZZLE_0 &&
+              view->swizzle_g == PIPE_SWIZZLE_0 &&
+              view->swizzle_b == PIPE_SWIZZLE_0 &&
+              view->swizzle_a == PIPE_SWIZZLE_X)
             return (MAPSURF_32BIT | MT_32BIT_xL824);
          debug_printf("i915: unsupported depth swizzle %d %d %d %d\n",
                       view->swizzle_r,
diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c
index c61716d..4eab174 100644
--- a/src/gallium/drivers/ilo/ilo_shader.c
+++ b/src/gallium/drivers/ilo/ilo_shader.c
@@ -265,16 +265,16 @@ ilo_shader_variant_init(struct ilo_shader_variant *variant,
          variant->sampler_view_swizzles[i].a = view->swizzle_a;
       }
       else if (info->shadow_samplers & (1 << i)) {
-         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_ONE;
+         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_1;
       }
       else {
-         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_GREEN;
-         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_BLUE;
-         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_ALPHA;
+         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_Y;
+         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_Z;
+         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_W;
       }
 
       /*
@@ -323,16 +323,16 @@ ilo_shader_variant_guess(struct ilo_shader_variant *variant,
    variant->num_sampler_views = info->num_samplers;
    for (i = 0; i < info->num_samplers; i++) {
       if (info->shadow_samplers & (1 << i)) {
-         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_ONE;
+         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_1;
       }
       else {
-         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_RED;
-         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_GREEN;
-         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_BLUE;
-         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_ALPHA;
+         variant->sampler_view_swizzles[i].r = PIPE_SWIZZLE_X;
+         variant->sampler_view_swizzles[i].g = PIPE_SWIZZLE_Y;
+         variant->sampler_view_swizzles[i].b = PIPE_SWIZZLE_Z;
+         variant->sampler_view_swizzles[i].a = PIPE_SWIZZLE_W;
       }
    }
 }
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
index 6c8f1b5..d2b205a 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
@@ -1143,19 +1143,19 @@ fs_lower_opcode_tgsi_sampling(struct fs_compile_context *fcc,
       swizzles[3] = fcc->variant->sampler_view_swizzles[sampler_index].a;
    }
    else {
-      swizzles[0] = PIPE_SWIZZLE_RED;
-      swizzles[1] = PIPE_SWIZZLE_GREEN;
-      swizzles[2] = PIPE_SWIZZLE_BLUE;
-      swizzles[3] = PIPE_SWIZZLE_ALPHA;
+      swizzles[0] = PIPE_SWIZZLE_X;
+      swizzles[1] = PIPE_SWIZZLE_Y;
+      swizzles[2] = PIPE_SWIZZLE_Z;
+      swizzles[3] = PIPE_SWIZZLE_W;
    }
 
    /* swizzle the results */
    for (i = 0; i < 4; i++) {
       switch (swizzles[i]) {
-      case PIPE_SWIZZLE_ZERO:
+      case PIPE_SWIZZLE_0:
          tc_MOV(tc, dst[i], tsrc_imm_f(0.0f));
          break;
-      case PIPE_SWIZZLE_ONE:
+      case PIPE_SWIZZLE_1:
          tc_MOV(tc, dst[i], tsrc_imm_f(1.0f));
          break;
       default:
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
index 2b46d44..514e636 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
@@ -610,10 +610,10 @@ vs_lower_opcode_tgsi_sampling(struct vs_compile_context *vcc,
       swizzles[3] = vcc->variant->sampler_view_swizzles[sampler_index].a;
    }
    else {
-      swizzles[0] = PIPE_SWIZZLE_RED;
-      swizzles[1] = PIPE_SWIZZLE_GREEN;
-      swizzles[2] = PIPE_SWIZZLE_BLUE;
-      swizzles[3] = PIPE_SWIZZLE_ALPHA;
+      swizzles[0] = PIPE_SWIZZLE_X;
+      swizzles[1] = PIPE_SWIZZLE_Y;
+      swizzles[2] = PIPE_SWIZZLE_Z;
+      swizzles[3] = PIPE_SWIZZLE_W;
    }
 
    swizzle_zero_mask = 0;
@@ -621,11 +621,11 @@ vs_lower_opcode_tgsi_sampling(struct vs_compile_context *vcc,
    swizzle_normal_mask = 0;
    for (i = 0; i < 4; i++) {
       switch (swizzles[i]) {
-      case PIPE_SWIZZLE_ZERO:
+      case PIPE_SWIZZLE_0:
          swizzle_zero_mask |= 1 << i;
          swizzles[i] = i;
          break;
-      case PIPE_SWIZZLE_ONE:
+      case PIPE_SWIZZLE_1:
          swizzle_one_mask |= 1 << i;
          swizzles[i] = i;
          break;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
index 564e19a..a57670d 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
@@ -255,13 +255,13 @@ lp_build_blend_factor(struct lp_build_blend_aos_context *bld,
    LLVMValueRef rgb_factor_, alpha_factor_;
    enum lp_build_blend_swizzle rgb_swizzle;
 
-   if (alpha_swizzle == UTIL_FORMAT_SWIZZLE_X && num_channels == 1) {
+   if (alpha_swizzle == PIPE_SWIZZLE_X && num_channels == 1) {
       return lp_build_blend_factor_unswizzled(bld, alpha_factor, TRUE);
    }
 
    rgb_factor_ = lp_build_blend_factor_unswizzled(bld, rgb_factor, FALSE);
 
-   if (alpha_swizzle != UTIL_FORMAT_SWIZZLE_NONE) {
+   if (alpha_swizzle != PIPE_SWIZZLE_NONE) {
       rgb_swizzle   = lp_build_blend_factor_swizzle(rgb_factor);
       alpha_factor_ = lp_build_blend_factor_unswizzled(bld, alpha_factor, TRUE);
       return lp_build_blend_swizzle(bld, rgb_factor_, alpha_factor_, rgb_swizzle, alpha_swizzle, num_channels);
@@ -312,7 +312,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
    struct lp_build_blend_aos_context bld;
    LLVMValueRef src_factor, dst_factor;
    LLVMValueRef result;
-   unsigned alpha_swizzle = UTIL_FORMAT_SWIZZLE_NONE;
+   unsigned alpha_swizzle = PIPE_SWIZZLE_NONE;
    unsigned i;
 
    desc = util_format_description(cbuf_format);
@@ -370,7 +370,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
                               rgb_alpha_same,
                               false);
 
-      if(state->rgb_func != state->alpha_func && nr_channels > 1 && alpha_swizzle != UTIL_FORMAT_SWIZZLE_NONE) {
+      if(state->rgb_func != state->alpha_func && nr_channels > 1 && alpha_swizzle != PIPE_SWIZZLE_NONE) {
          LLVMValueRef alpha;
 
          alpha = lp_build_blend(&bld.base,
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
index b25e041..0c27c2f 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
@@ -359,7 +359,7 @@ get_z_shift_and_mask(const struct util_format_description *format_desc,
 
    z_swizzle = format_desc->swizzle[0];
 
-   if (z_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
+   if (z_swizzle == PIPE_SWIZZLE_NONE)
       return FALSE;
 
    *width = format_desc->channel[z_swizzle].size;
@@ -390,7 +390,7 @@ get_s_shift_and_mask(const struct util_format_description *format_desc,
 
    s_swizzle = format_desc->swizzle[1];
 
-   if (s_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
+   if (s_swizzle == PIPE_SWIZZLE_NONE)
       return FALSE;
 
    /* just special case 64bit d/s format */
@@ -873,8 +873,8 @@ lp_build_depth_stencil_test(struct gallivm_state *gallivm,
       const unsigned z_swizzle = format_desc->swizzle[0];
       const unsigned s_swizzle = format_desc->swizzle[1];
 
-      assert(z_swizzle != UTIL_FORMAT_SWIZZLE_NONE ||
-             s_swizzle != UTIL_FORMAT_SWIZZLE_NONE);
+      assert(z_swizzle != PIPE_SWIZZLE_NONE ||
+             s_swizzle != PIPE_SWIZZLE_NONE);
 
       assert(depth->enabled || stencil[0].enabled);
 
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index cb681ba..4f61de8 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -475,7 +475,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
          return FALSE;
 
       /* TODO: Support stencil-only formats */
-      if (format_desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_NONE) {
+      if (format_desc->swizzle[0] == PIPE_SWIZZLE_NONE) {
          return FALSE;
       }
    }
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 93460a3..76cbb5b 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -3027,7 +3027,7 @@ make_variant_key(struct llvmpipe_context *lp,
           * Also, force rgb/alpha func/factors match, to make AoS blending
           * easier.
           */
-         if (format_desc->swizzle[3] > UTIL_FORMAT_SWIZZLE_W ||
+         if (format_desc->swizzle[3] > PIPE_SWIZZLE_W ||
              format_desc->swizzle[3] == format_desc->swizzle[0]) {
             /* Doesn't cover mixed snorm/unorm but can't render to them anyway */
             boolean clamped_zero = !util_format_is_float(format) &&
diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index 6a4fbbb..fec0ec1 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
@@ -135,8 +135,8 @@ emit_facing_coef(struct gallivm_state *gallivm,
    LLVMValueRef a0_0 = args->facing;
    LLVMValueRef a0_0f = LLVMBuildSIToFP(builder, a0_0, float_type, "");
    LLVMValueRef a0, face_val;
-   const unsigned char swizzles[4] = { PIPE_SWIZZLE_RED, PIPE_SWIZZLE_ZERO,
-                                       PIPE_SWIZZLE_ZERO, PIPE_SWIZZLE_ZERO };
+   const unsigned char swizzles[4] = { PIPE_SWIZZLE_X, PIPE_SWIZZLE_0,
+                                       PIPE_SWIZZLE_0, PIPE_SWIZZLE_0 };
    /* Our face val is either 1 or 0 so we do
     * face = (val * 2) - 1
     * to make it 1 or -1
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index 8bb12b2..bb3aad7 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -657,7 +657,7 @@ nouveau_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer)
          u_sampler_view_default_template(&sv_templ, buf->resources[i], buf->resources[i]->format);
 
          if (util_format_get_nr_components(buf->resources[i]->format) == 1)
-            sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = sv_templ.swizzle_a = PIPE_SWIZZLE_RED;
+            sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = sv_templ.swizzle_a = PIPE_SWIZZLE_X;
 
          buf->sampler_view_planes[i] = pipe->create_sampler_view(pipe, buf->resources[i], &sv_templ);
          if (!buf->sampler_view_planes[i])
@@ -695,8 +695,8 @@ nouveau_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer)
          if (!buf->sampler_view_components[component]) {
             memset(&sv_templ, 0, sizeof(sv_templ));
             u_sampler_view_default_template(&sv_templ, buf->resources[i], buf->resources[i]->format);
-            sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_RED + j;
-            sv_templ.swizzle_a = PIPE_SWIZZLE_ONE;
+            sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_X + j;
+            sv_templ.swizzle_a = PIPE_SWIZZLE_1;
             buf->sampler_view_components[component] = pipe->create_sampler_view(pipe, buf->resources[i], &sv_templ);
             if (!buf->sampler_view_components[component])
                goto error;
diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.c b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
index d76d932..172d80c 100644
--- a/src/gallium/drivers/nouveau/nouveau_vp3_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
@@ -139,8 +139,8 @@ nouveau_vp3_video_buffer_create(struct pipe_context *pipe,
          goto error;
 
       for (j = 0; j < nr_components; ++j, ++component) {
-         sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_RED + j;
-         sv_templ.swizzle_a = PIPE_SWIZZLE_ONE;
+         sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_X + j;
+         sv_templ.swizzle_a = PIPE_SWIZZLE_1;
 
          buffer->sampler_view_components[component] = pipe->create_sampler_view(pipe, res, &sv_templ);
          if (!buffer->sampler_view_components[component])
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_texture.c b/src/gallium/drivers/nouveau/nv30/nv30_texture.c
index bfe21cc..4f4f87e 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_texture.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_texture.c
@@ -205,7 +205,7 @@ static inline uint32_t
 swizzle(const struct nv30_texfmt *fmt, unsigned cmp, unsigned swz)
 {
    uint32_t data = fmt->swz[swz].src << 8;
-   if (swz <= PIPE_SWIZZLE_ALPHA)
+   if (swz <= PIPE_SWIZZLE_W)
       data |= fmt->swz[swz].cmp;
    else
       data |= fmt->swz[cmp].cmp;
diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
index b9cfb31..89ac208 100644
--- a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
+++ b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
@@ -474,10 +474,10 @@ nvfx_fragprog_parse_instruction(struct nvfx_fpc *fpc,
       switch (fsrc->Register.File) {
       case TGSI_FILE_INPUT:
          if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG && (0
-               || fsrc->Register.SwizzleX == PIPE_SWIZZLE_ALPHA
-               || fsrc->Register.SwizzleY == PIPE_SWIZZLE_ALPHA
-               || fsrc->Register.SwizzleZ == PIPE_SWIZZLE_ALPHA
-               || fsrc->Register.SwizzleW == PIPE_SWIZZLE_ALPHA
+               || fsrc->Register.SwizzleX == PIPE_SWIZZLE_W
+               || fsrc->Register.SwizzleY == PIPE_SWIZZLE_W
+               || fsrc->Register.SwizzleZ == PIPE_SWIZZLE_W
+               || fsrc->Register.SwizzleW == PIPE_SWIZZLE_W
                )) {
             /* hardware puts 0 in fogcoord.w, but GL/Gallium want 1 there */
             struct nvfx_src addend = nvfx_src(nvfx_fp_imm(fpc, 0, 0, 0, 1));
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
index 68b0e18..a284f27 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
@@ -1122,10 +1122,10 @@ nv50_blit_set_src(struct nv50_blitctx *blit,
    templ.format = format;
    templ.u.tex.first_level = templ.u.tex.last_level = level;
    templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
-   templ.swizzle_r = PIPE_SWIZZLE_RED;
-   templ.swizzle_g = PIPE_SWIZZLE_GREEN;
-   templ.swizzle_b = PIPE_SWIZZLE_BLUE;
-   templ.swizzle_a = PIPE_SWIZZLE_ALPHA;
+   templ.swizzle_r = PIPE_SWIZZLE_X;
+   templ.swizzle_g = PIPE_SWIZZLE_Y;
+   templ.swizzle_b = PIPE_SWIZZLE_Z;
+   templ.swizzle_a = PIPE_SWIZZLE_W;
 
    if (layer == -1) {
       templ.u.tex.first_layer = 0;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
index 414d326..36c07bc 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
@@ -31,13 +31,13 @@ static inline uint32_t
 nv50_tic_swizzle(const struct nv50_format *fmt, unsigned swz, bool tex_int)
 {
    switch (swz) {
-   case PIPE_SWIZZLE_RED  : return fmt->tic.src_x;
-   case PIPE_SWIZZLE_GREEN: return fmt->tic.src_y;
-   case PIPE_SWIZZLE_BLUE : return fmt->tic.src_z;
-   case PIPE_SWIZZLE_ALPHA: return fmt->tic.src_w;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_X  : return fmt->tic.src_x;
+   case PIPE_SWIZZLE_Y: return fmt->tic.src_y;
+   case PIPE_SWIZZLE_Z : return fmt->tic.src_z;
+   case PIPE_SWIZZLE_W: return fmt->tic.src_w;
+   case PIPE_SWIZZLE_1:
       return tex_int ? G80_TIC_SOURCE_ONE_INT : G80_TIC_SOURCE_ONE_FLOAT;
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
    default:
       return G80_TIC_SOURCE_ZERO;
    }
diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video.c b/src/gallium/drivers/nouveau/nv50/nv84_video.c
index 88655db..1b1f31a 100644
--- a/src/gallium/drivers/nouveau/nv50/nv84_video.c
+++ b/src/gallium/drivers/nouveau/nv50/nv84_video.c
@@ -705,8 +705,8 @@ nv84_video_buffer_create(struct pipe_context *pipe,
 
       for (j = 0; j < nr_components; ++j, ++component) {
          sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b =
-            PIPE_SWIZZLE_RED + j;
-         sv_templ.swizzle_a = PIPE_SWIZZLE_ONE;
+            PIPE_SWIZZLE_X + j;
+         sv_templ.swizzle_a = PIPE_SWIZZLE_1;
 
          buffer->sampler_view_components[component] =
             pipe->create_sampler_view(pipe, res, &sv_templ);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
index e108590..a177569 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
@@ -959,10 +959,10 @@ nvc0_blit_set_src(struct nvc0_blitctx *ctx,
    templ.format = format;
    templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
    templ.u.tex.first_level = templ.u.tex.last_level = level;
-   templ.swizzle_r = PIPE_SWIZZLE_RED;
-   templ.swizzle_g = PIPE_SWIZZLE_GREEN;
-   templ.swizzle_b = PIPE_SWIZZLE_BLUE;
-   templ.swizzle_a = PIPE_SWIZZLE_ALPHA;
+   templ.swizzle_r = PIPE_SWIZZLE_X;
+   templ.swizzle_g = PIPE_SWIZZLE_Y;
+   templ.swizzle_b = PIPE_SWIZZLE_Z;
+   templ.swizzle_a = PIPE_SWIZZLE_W;
 
    if (layer == -1) {
       templ.u.tex.first_layer = 0;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
index e04573f..2161846 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
@@ -36,13 +36,13 @@ static inline uint32_t
 nv50_tic_swizzle(const struct nvc0_format *fmt, unsigned swz, bool tex_int)
 {
    switch (swz) {
-   case PIPE_SWIZZLE_RED  : return fmt->tic.src_x;
-   case PIPE_SWIZZLE_GREEN: return fmt->tic.src_y;
-   case PIPE_SWIZZLE_BLUE : return fmt->tic.src_z;
-   case PIPE_SWIZZLE_ALPHA: return fmt->tic.src_w;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_X  : return fmt->tic.src_x;
+   case PIPE_SWIZZLE_Y: return fmt->tic.src_y;
+   case PIPE_SWIZZLE_Z : return fmt->tic.src_z;
+   case PIPE_SWIZZLE_W: return fmt->tic.src_w;
+   case PIPE_SWIZZLE_1:
       return tex_int ? G80_TIC_SOURCE_ONE_INT : G80_TIC_SOURCE_ONE_FLOAT;
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
    default:
       return G80_TIC_SOURCE_ZERO;
    }
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 5c443d1..a4783f3 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -199,7 +199,7 @@ struct r300_sampler_view {
     unsigned width0_override;
     unsigned height0_override;
 
-    /* Swizzles in the UTIL_FORMAT_SWIZZLE_* representation,
+    /* Swizzles in the PIPE_SWIZZLE_* representation,
      * derived from base. */
     unsigned char swizzle[4];
 
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 741e263..bae669e 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -865,10 +865,10 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
                     /* X24x8 is sampled as Y16X16 on r3xx-r4xx.
                      * The depth here is at the Y component. */
                     for (j = 0; j < 4; j++)
-                        depth_swizzle[j] = UTIL_FORMAT_SWIZZLE_Y;
+                        depth_swizzle[j] = PIPE_SWIZZLE_Y;
                 } else {
                     for (j = 0; j < 4; j++)
-                        depth_swizzle[j] = UTIL_FORMAT_SWIZZLE_X;
+                        depth_swizzle[j] = PIPE_SWIZZLE_X;
                 }
 
                 /* If compare mode is disabled, sampler view swizzles
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 709345a..da51661 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -68,22 +68,22 @@ unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
     /* Get swizzle. */
     for (i = 0; i < 4; i++) {
         switch (swizzle[i]) {
-            case UTIL_FORMAT_SWIZZLE_Y:
+            case PIPE_SWIZZLE_Y:
                 result |= swizzle_bit[1] << swizzle_shift[i];
                 break;
-            case UTIL_FORMAT_SWIZZLE_Z:
+            case PIPE_SWIZZLE_Z:
                 result |= swizzle_bit[2] << swizzle_shift[i];
                 break;
-            case UTIL_FORMAT_SWIZZLE_W:
+            case PIPE_SWIZZLE_W:
                 result |= swizzle_bit[3] << swizzle_shift[i];
                 break;
-            case UTIL_FORMAT_SWIZZLE_0:
+            case PIPE_SWIZZLE_0:
                 result |= R300_TX_FORMAT_ZERO << swizzle_shift[i];
                 break;
-            case UTIL_FORMAT_SWIZZLE_1:
+            case PIPE_SWIZZLE_1:
                 result |= R300_TX_FORMAT_ONE << swizzle_shift[i];
                 break;
-            default: /* UTIL_FORMAT_SWIZZLE_X */
+            default: /* PIPE_SWIZZLE_X */
                 result |= swizzle_bit[0] << swizzle_shift[i];
         }
     }
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 2ad9e3e..81feb29 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1072,7 +1072,7 @@ void evergreen_init_color_surface(struct r600_context *rctx,
 
 	if (rctx->b.chip_class == CAYMAN) {
 		color_attrib |=	S_028C74_FORCE_DST_ALPHA_1(desc->swizzle[3] ==
-							   UTIL_FORMAT_SWIZZLE_1);
+							   PIPE_SWIZZLE_1);
 
 		if (rtex->resource.b.b.nr_samples > 1) {
 			unsigned log_samples = util_logbase2(rtex->resource.b.b.nr_samples);
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index cb40c20..19c61ff 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2191,22 +2191,22 @@ unsigned r600_get_swizzle_combined(const unsigned char *swizzle_format,
 	/* Get swizzle. */
 	for (i = 0; i < 4; i++) {
 		switch (swizzle[i]) {
-		case UTIL_FORMAT_SWIZZLE_Y:
+		case PIPE_SWIZZLE_Y:
 			result |= swizzle_bit[1] << swizzle_shift[i];
 			break;
-		case UTIL_FORMAT_SWIZZLE_Z:
+		case PIPE_SWIZZLE_Z:
 			result |= swizzle_bit[2] << swizzle_shift[i];
 			break;
-		case UTIL_FORMAT_SWIZZLE_W:
+		case PIPE_SWIZZLE_W:
 			result |= swizzle_bit[3] << swizzle_shift[i];
 			break;
-		case UTIL_FORMAT_SWIZZLE_0:
+		case PIPE_SWIZZLE_0:
 			result |= V_038010_SQ_SEL_0 << swizzle_shift[i];
 			break;
-		case UTIL_FORMAT_SWIZZLE_1:
+		case PIPE_SWIZZLE_1:
 			result |= V_038010_SQ_SEL_1 << swizzle_shift[i];
 			break;
-		default: /* UTIL_FORMAT_SWIZZLE_X */
+		default: /* PIPE_SWIZZLE_X */
 			result |= swizzle_bit[0] << swizzle_shift[i];
 		}
 	}
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 72af534..4bbe04d 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -1396,7 +1396,7 @@ unsigned r600_translate_colorswap(enum pipe_format format)
 {
 	const struct util_format_description *desc = util_format_description(format);
 
-#define HAS_SWIZZLE(chan,swz) (desc->swizzle[chan] == UTIL_FORMAT_SWIZZLE_##swz)
+#define HAS_SWIZZLE(chan,swz) (desc->swizzle[chan] == PIPE_SWIZZLE_##swz)
 
 	if (format == PIPE_FORMAT_R11G11B10_FLOAT) /* isn't plain */
 		return V_0280A0_SWAP_STD;
@@ -1499,10 +1499,10 @@ static void vi_get_fast_clear_parameters(enum pipe_format surface_format,
 		return;
 
 	for (i = 0; i < 4; ++i) {
-		int index = desc->swizzle[i] - UTIL_FORMAT_SWIZZLE_X;
+		int index = desc->swizzle[i] - PIPE_SWIZZLE_X;
 
-		if (desc->swizzle[i] < UTIL_FORMAT_SWIZZLE_X ||
-		    desc->swizzle[i] > UTIL_FORMAT_SWIZZLE_W)
+		if (desc->swizzle[i] < PIPE_SWIZZLE_X ||
+		    desc->swizzle[i] > PIPE_SWIZZLE_W)
 			continue;
 
 		if (util_format_is_pure_sint(surface_format)) {
@@ -1527,9 +1527,9 @@ static void vi_get_fast_clear_parameters(enum pipe_format surface_format,
 
 	for (int i = 0; i < 4; ++i)
 		if (values[i] != main_value &&
-		    desc->swizzle[i] - UTIL_FORMAT_SWIZZLE_X != extra_channel &&
-		    desc->swizzle[i] >= UTIL_FORMAT_SWIZZLE_X &&
-		    desc->swizzle[i] <= UTIL_FORMAT_SWIZZLE_W)
+		    desc->swizzle[i] - PIPE_SWIZZLE_X != extra_channel &&
+		    desc->swizzle[i] >= PIPE_SWIZZLE_X &&
+		    desc->swizzle[i] <= PIPE_SWIZZLE_W)
 			return;
 
 	*clear_words_needed = false;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index af9ffdd..9b6fb01 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -209,17 +209,17 @@ unsigned cik_db_pipe_config(struct si_screen *sscreen, unsigned tile_mode)
 static unsigned si_map_swizzle(unsigned swizzle)
 {
 	switch (swizzle) {
-	case UTIL_FORMAT_SWIZZLE_Y:
+	case PIPE_SWIZZLE_Y:
 		return V_008F0C_SQ_SEL_Y;
-	case UTIL_FORMAT_SWIZZLE_Z:
+	case PIPE_SWIZZLE_Z:
 		return V_008F0C_SQ_SEL_Z;
-	case UTIL_FORMAT_SWIZZLE_W:
+	case PIPE_SWIZZLE_W:
 		return V_008F0C_SQ_SEL_W;
-	case UTIL_FORMAT_SWIZZLE_0:
+	case PIPE_SWIZZLE_0:
 		return V_008F0C_SQ_SEL_0;
-	case UTIL_FORMAT_SWIZZLE_1:
+	case PIPE_SWIZZLE_1:
 		return V_008F0C_SQ_SEL_1;
-	default: /* UTIL_FORMAT_SWIZZLE_X */
+	default: /* PIPE_SWIZZLE_X */
 		return V_008F0C_SQ_SEL_X;
 	}
 }
@@ -2204,7 +2204,7 @@ static void si_initialize_color_surface(struct si_context *sctx,
 
 	/* Intensity is implemented as Red, so treat it that way. */
 	color_attrib = S_028C74_TILE_MODE_INDEX(tile_mode_index) |
-		S_028C74_FORCE_DST_ALPHA_1(desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1 ||
+		S_028C74_FORCE_DST_ALPHA_1(desc->swizzle[3] == PIPE_SWIZZLE_1 ||
 					   util_format_is_intensity(surf->base.format));
 
 	if (rtex->resource.b.b.nr_samples > 1) {
@@ -3398,11 +3398,11 @@ static void si_set_polygon_stipple(struct pipe_context *ctx,
 	if (is_zero || is_one) {
 		struct pipe_sampler_view templ = {{0}};
 
-		templ.swizzle_r = PIPE_SWIZZLE_ZERO;
-		templ.swizzle_g = PIPE_SWIZZLE_ZERO;
-		templ.swizzle_b = PIPE_SWIZZLE_ZERO;
+		templ.swizzle_r = PIPE_SWIZZLE_0;
+		templ.swizzle_g = PIPE_SWIZZLE_0;
+		templ.swizzle_b = PIPE_SWIZZLE_0;
 		/* The pattern should be inverted in the texture. */
-		templ.swizzle_a = is_zero ? PIPE_SWIZZLE_ONE : PIPE_SWIZZLE_ZERO;
+		templ.swizzle_a = is_zero ? PIPE_SWIZZLE_1 : PIPE_SWIZZLE_0;
 
 		view = ctx->create_sampler_view(ctx, NULL, &templ);
 	} else {
@@ -3612,10 +3612,10 @@ static void si_query_opaque_metadata(struct r600_common_screen *rscreen,
 	struct si_screen *sscreen = (struct si_screen*)rscreen;
 	struct pipe_resource *res = &rtex->resource.b.b;
 	static const unsigned char swizzle[] = {
-		PIPE_SWIZZLE_RED,
-		PIPE_SWIZZLE_GREEN,
-		PIPE_SWIZZLE_BLUE,
-		PIPE_SWIZZLE_ALPHA
+		PIPE_SWIZZLE_X,
+		PIPE_SWIZZLE_Y,
+		PIPE_SWIZZLE_Z,
+		PIPE_SWIZZLE_W
 	};
 	uint32_t desc[8], i;
 	bool is_array = util_resource_is_array_texture(res);
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 5703ca2..5998681 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -1500,9 +1500,9 @@ get_gather_value(const struct sp_sampler_view *sp_sview,
 
    /* get correct result using the channel and swizzle */
    switch (swizzle) {
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
       return 0.0;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_1:
       return 1.0;
    default:
       return tx[chan][swizzle];
@@ -2651,7 +2651,7 @@ sample_compare(const struct sp_sampler_view *sp_sview,
       util_format_description(sp_sview->base.format);
    /* not entirely sure we couldn't end up with non-valid swizzle here */
    const unsigned chan_type =
-      format_desc->swizzle[0] <= UTIL_FORMAT_SWIZZLE_W ?
+      format_desc->swizzle[0] <= PIPE_SWIZZLE_W ?
       format_desc->channel[format_desc->swizzle[0]].type :
       UTIL_FORMAT_TYPE_FLOAT;
    const bool is_gather = (control == TGSI_SAMPLER_GATHER);
@@ -2773,11 +2773,11 @@ do_swizzling(const struct pipe_sampler_view *sview,
    const unsigned swizzle_a = sview->swizzle_a;
 
    switch (swizzle_r) {
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
       for (j = 0; j < 4; j++)
          out[0][j] = 0.0f;
       break;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
          out[0][j] = 1.0f;
       break;
@@ -2788,11 +2788,11 @@ do_swizzling(const struct pipe_sampler_view *sview,
    }
 
    switch (swizzle_g) {
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
       for (j = 0; j < 4; j++)
          out[1][j] = 0.0f;
       break;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
          out[1][j] = 1.0f;
       break;
@@ -2803,11 +2803,11 @@ do_swizzling(const struct pipe_sampler_view *sview,
    }
 
    switch (swizzle_b) {
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
       for (j = 0; j < 4; j++)
          out[2][j] = 0.0f;
       break;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
          out[2][j] = 1.0f;
       break;
@@ -2818,11 +2818,11 @@ do_swizzling(const struct pipe_sampler_view *sview,
    }
 
    switch (swizzle_a) {
-   case PIPE_SWIZZLE_ZERO:
+   case PIPE_SWIZZLE_0:
       for (j = 0; j < 4; j++)
          out[3][j] = 0.0f;
       break;
-   case PIPE_SWIZZLE_ONE:
+   case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
          out[3][j] = 1.0f;
       break;
@@ -2928,10 +2928,10 @@ get_linear_wrap(unsigned mode)
 static inline bool
 any_swizzle(const struct pipe_sampler_view *view)
 {
-   return (view->swizzle_r != PIPE_SWIZZLE_RED ||
-           view->swizzle_g != PIPE_SWIZZLE_GREEN ||
-           view->swizzle_b != PIPE_SWIZZLE_BLUE ||
-           view->swizzle_a != PIPE_SWIZZLE_ALPHA);
+   return (view->swizzle_r != PIPE_SWIZZLE_X ||
+           view->swizzle_g != PIPE_SWIZZLE_Y ||
+           view->swizzle_b != PIPE_SWIZZLE_Z ||
+           view->swizzle_a != PIPE_SWIZZLE_W);
 }
 
 
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index bedda2e..f0ef65f 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -1826,11 +1826,11 @@ emit_tex_swizzle(struct svga_shader_emitter *emit,
 
    /* build writemasks and srcSwizzle terms */
    for (i = 0; i < 4; i++) {
-      if (swizzleIn[i] == PIPE_SWIZZLE_ZERO) {
+      if (swizzleIn[i] == PIPE_SWIZZLE_0) {
          srcSwizzle[i] = TGSI_SWIZZLE_X + i;
          zeroWritemask |= (1 << i);
       }
-      else if (swizzleIn[i] == PIPE_SWIZZLE_ONE) {
+      else if (swizzleIn[i] == PIPE_SWIZZLE_1) {
          srcSwizzle[i] = TGSI_SWIZZLE_X + i;
          oneWritemask |= (1 << i);
       }
@@ -1897,10 +1897,10 @@ emit_tex(struct svga_shader_emitter *emit,
                       PIPE_TEX_COMPARE_R_TO_TEXTURE);
 
    /* texture swizzle */
-   boolean swizzle = (emit->key.tex[unit].swizzle_r != PIPE_SWIZZLE_RED ||
-                      emit->key.tex[unit].swizzle_g != PIPE_SWIZZLE_GREEN ||
-                      emit->key.tex[unit].swizzle_b != PIPE_SWIZZLE_BLUE ||
-                      emit->key.tex[unit].swizzle_a != PIPE_SWIZZLE_ALPHA);
+   boolean swizzle = (emit->key.tex[unit].swizzle_r != PIPE_SWIZZLE_X ||
+                      emit->key.tex[unit].swizzle_g != PIPE_SWIZZLE_Y ||
+                      emit->key.tex[unit].swizzle_b != PIPE_SWIZZLE_Z ||
+                      emit->key.tex[unit].swizzle_a != PIPE_SWIZZLE_W);
 
    boolean saturate = insn->Instruction.Saturate;
 
@@ -3633,12 +3633,12 @@ needs_to_create_common_immediate(const struct svga_shader_emitter *emit)
       if (emit->inverted_texcoords)
          return TRUE;
 
-      /* look for any PIPE_SWIZZLE_ZERO/ONE terms */
+      /* look for any PIPE_SWIZZLE_0/ONE terms */
       for (i = 0; i < emit->key.num_textures; i++) {
-         if (emit->key.tex[i].swizzle_r > PIPE_SWIZZLE_ALPHA ||
-             emit->key.tex[i].swizzle_g > PIPE_SWIZZLE_ALPHA ||
-             emit->key.tex[i].swizzle_b > PIPE_SWIZZLE_ALPHA ||
-             emit->key.tex[i].swizzle_a > PIPE_SWIZZLE_ALPHA)
+         if (emit->key.tex[i].swizzle_r > PIPE_SWIZZLE_W ||
+             emit->key.tex[i].swizzle_g > PIPE_SWIZZLE_W ||
+             emit->key.tex[i].swizzle_b > PIPE_SWIZZLE_W ||
+             emit->key.tex[i].swizzle_a > PIPE_SWIZZLE_W)
             return TRUE;
       }
 
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index f8f615e..a899c47 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -5049,20 +5049,20 @@ end_tex_swizzle(struct svga_shader_emitter_v10 *emit,
       /* Swizzle w/out zero/one terms */
       struct tgsi_full_src_register src_swizzled =
          swizzle_src(&swz->tmp_src,
-                     swz_r < PIPE_SWIZZLE_ZERO ? swz_r : PIPE_SWIZZLE_RED,
-                     swz_g < PIPE_SWIZZLE_ZERO ? swz_g : PIPE_SWIZZLE_GREEN,
-                     swz_b < PIPE_SWIZZLE_ZERO ? swz_b : PIPE_SWIZZLE_BLUE,
-                     swz_a < PIPE_SWIZZLE_ZERO ? swz_a : PIPE_SWIZZLE_ALPHA);
+                     swz_r < PIPE_SWIZZLE_0 ? swz_r : PIPE_SWIZZLE_X,
+                     swz_g < PIPE_SWIZZLE_0 ? swz_g : PIPE_SWIZZLE_Y,
+                     swz_b < PIPE_SWIZZLE_0 ? swz_b : PIPE_SWIZZLE_Z,
+                     swz_a < PIPE_SWIZZLE_0 ? swz_a : PIPE_SWIZZLE_W);
 
       /* MOV dst, color(tmp).<swizzle> */
       emit_instruction_op1(emit, VGPU10_OPCODE_MOV,
                            swz->inst_dst, &src_swizzled, FALSE);
 
       /* handle swizzle zero terms */
-      writemask_0 = (((swz_r == PIPE_SWIZZLE_ZERO) << 0) |
-                     ((swz_g == PIPE_SWIZZLE_ZERO) << 1) |
-                     ((swz_b == PIPE_SWIZZLE_ZERO) << 2) |
-                     ((swz_a == PIPE_SWIZZLE_ZERO) << 3));
+      writemask_0 = (((swz_r == PIPE_SWIZZLE_0) << 0) |
+                     ((swz_g == PIPE_SWIZZLE_0) << 1) |
+                     ((swz_b == PIPE_SWIZZLE_0) << 2) |
+                     ((swz_a == PIPE_SWIZZLE_0) << 3));
 
       if (writemask_0) {
          struct tgsi_full_src_register zero = int_tex ?
@@ -5077,10 +5077,10 @@ end_tex_swizzle(struct svga_shader_emitter_v10 *emit,
       }
 
       /* handle swizzle one terms */
-      writemask_1 = (((swz_r == PIPE_SWIZZLE_ONE) << 0) |
-                     ((swz_g == PIPE_SWIZZLE_ONE) << 1) |
-                     ((swz_b == PIPE_SWIZZLE_ONE) << 2) |
-                     ((swz_a == PIPE_SWIZZLE_ONE) << 3));
+      writemask_1 = (((swz_r == PIPE_SWIZZLE_1) << 0) |
+                     ((swz_g == PIPE_SWIZZLE_1) << 1) |
+                     ((swz_b == PIPE_SWIZZLE_1) << 2) |
+                     ((swz_a == PIPE_SWIZZLE_1) << 3));
 
       if (writemask_1) {
          struct tgsi_full_src_register one = int_tex ?
diff --git a/src/gallium/drivers/vc4/vc4_formats.c b/src/gallium/drivers/vc4/vc4_formats.c
index ffce612..dd700cd 100644
--- a/src/gallium/drivers/vc4/vc4_formats.c
+++ b/src/gallium/drivers/vc4/vc4_formats.c
@@ -61,10 +61,10 @@ struct vc4_format {
 };
 
 #define SWIZ(x,y,z,w) {          \
-        UTIL_FORMAT_SWIZZLE_##x, \
-        UTIL_FORMAT_SWIZZLE_##y, \
-        UTIL_FORMAT_SWIZZLE_##z, \
-        UTIL_FORMAT_SWIZZLE_##w  \
+        PIPE_SWIZZLE_##x, \
+        PIPE_SWIZZLE_##y, \
+        PIPE_SWIZZLE_##z, \
+        PIPE_SWIZZLE_##w  \
 }
 
 #define FORMAT(pipe, rt, tex, swiz)                                     \
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
index 22c602a..7a0f4f9 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
@@ -98,7 +98,7 @@ vc4_nir_get_vattr_channel_vpm(struct vc4_compile *c,
                 &desc->channel[swiz];
         nir_ssa_def *temp;
 
-        if (swiz > UTIL_FORMAT_SWIZZLE_W) {
+        if (swiz > PIPE_SWIZZLE_W) {
                 return vc4_nir_get_swizzled_channel(b, vpm_reads, swiz);
         } else if (chan->size == 32 && chan->type == UTIL_FORMAT_TYPE_FLOAT) {
                 return vc4_nir_get_swizzled_channel(b, vpm_reads, swiz);
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index eccc7ab..5df2c53 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -127,17 +127,17 @@ vc4_nir_get_swizzled_channel(nir_builder *b, nir_ssa_def **srcs, int swiz)
 {
         switch (swiz) {
         default:
-        case UTIL_FORMAT_SWIZZLE_NONE:
+        case PIPE_SWIZZLE_NONE:
                 fprintf(stderr, "warning: unknown swizzle\n");
                 /* FALLTHROUGH */
-        case UTIL_FORMAT_SWIZZLE_0:
+        case PIPE_SWIZZLE_0:
                 return nir_imm_float(b, 0.0);
-        case UTIL_FORMAT_SWIZZLE_1:
+        case PIPE_SWIZZLE_1:
                 return nir_imm_float(b, 1.0);
-        case UTIL_FORMAT_SWIZZLE_X:
-        case UTIL_FORMAT_SWIZZLE_Y:
-        case UTIL_FORMAT_SWIZZLE_Z:
-        case UTIL_FORMAT_SWIZZLE_W:
+        case PIPE_SWIZZLE_X:
+        case PIPE_SWIZZLE_Y:
+        case PIPE_SWIZZLE_Z:
+        case PIPE_SWIZZLE_W:
                 return srcs[swiz];
         }
 }
diff --git a/src/gallium/drivers/vc4/vc4_uniforms.c b/src/gallium/drivers/vc4/vc4_uniforms.c
index 262531f..4715a7f 100644
--- a/src/gallium/drivers/vc4/vc4_uniforms.c
+++ b/src/gallium/drivers/vc4/vc4_uniforms.c
@@ -85,10 +85,10 @@ write_texture_msaa_addr(struct vc4_context *vc4,
 
 
 #define SWIZ(x,y,z,w) {          \
-        UTIL_FORMAT_SWIZZLE_##x, \
-        UTIL_FORMAT_SWIZZLE_##y, \
-        UTIL_FORMAT_SWIZZLE_##z, \
-        UTIL_FORMAT_SWIZZLE_##w  \
+        PIPE_SWIZZLE_##x, \
+        PIPE_SWIZZLE_##y, \
+        PIPE_SWIZZLE_##z, \
+        PIPE_SWIZZLE_##w  \
 }
 
 static void
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 6bb180d..62391bd 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -544,15 +544,17 @@ enum {
 };
 
 /**
- * Texture swizzles
- */
-enum {
-   PIPE_SWIZZLE_RED,
-   PIPE_SWIZZLE_GREEN,
-   PIPE_SWIZZLE_BLUE,
-   PIPE_SWIZZLE_ALPHA,
-   PIPE_SWIZZLE_ZERO,
-   PIPE_SWIZZLE_ONE,
+ * Texture & format swizzles
+ */
+enum pipe_swizzle {
+   PIPE_SWIZZLE_X,
+   PIPE_SWIZZLE_Y,
+   PIPE_SWIZZLE_Z,
+   PIPE_SWIZZLE_W,
+   PIPE_SWIZZLE_0,
+   PIPE_SWIZZLE_1,
+   PIPE_SWIZZLE_NONE,
+   PIPE_SWIZZLE_MAX, /**< Number of enums counter (must be last) */
 };
 
 #define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index c4eb813..829a7c6 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -483,9 +483,9 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This,
     return D3D_OK;
 }
 
-#define SWIZZLE_TO_REPLACE(s) (s == UTIL_FORMAT_SWIZZLE_0 || \
-                               s == UTIL_FORMAT_SWIZZLE_1 || \
-                               s == UTIL_FORMAT_SWIZZLE_NONE)
+#define SWIZZLE_TO_REPLACE(s) (s == PIPE_SWIZZLE_0 || \
+                               s == PIPE_SWIZZLE_1 || \
+                               s == PIPE_SWIZZLE_NONE)
 
 HRESULT
 NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
@@ -511,10 +511,10 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
 
     pipe_sampler_view_reference(&This->view[sRGB], NULL);
 
-    swizzle[0] = PIPE_SWIZZLE_RED;
-    swizzle[1] = PIPE_SWIZZLE_GREEN;
-    swizzle[2] = PIPE_SWIZZLE_BLUE;
-    swizzle[3] = PIPE_SWIZZLE_ALPHA;
+    swizzle[0] = PIPE_SWIZZLE_X;
+    swizzle[1] = PIPE_SWIZZLE_Y;
+    swizzle[2] = PIPE_SWIZZLE_Z;
+    swizzle[3] = PIPE_SWIZZLE_W;
     desc = util_format_description(resource->format);
     if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
         /* msdn doc is incomplete here and wrong.
@@ -528,19 +528,19 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
          * all channel */
         if (This->format == D3DFMT_DF16 ||
             This->format == D3DFMT_DF24) {
-            swizzle[1] = PIPE_SWIZZLE_ZERO;
-            swizzle[2] = PIPE_SWIZZLE_ZERO;
-            swizzle[3] = PIPE_SWIZZLE_ONE;
+            swizzle[1] = PIPE_SWIZZLE_0;
+            swizzle[2] = PIPE_SWIZZLE_0;
+            swizzle[3] = PIPE_SWIZZLE_1;
         } else {
-            swizzle[1] = PIPE_SWIZZLE_RED;
-            swizzle[2] = PIPE_SWIZZLE_RED;
-            swizzle[3] = PIPE_SWIZZLE_RED;
+            swizzle[1] = PIPE_SWIZZLE_X;
+            swizzle[2] = PIPE_SWIZZLE_X;
+            swizzle[3] = PIPE_SWIZZLE_X;
         }
     } else if (resource->format == PIPE_FORMAT_RGTC2_UNORM) {
-        swizzle[0] = PIPE_SWIZZLE_GREEN;
-        swizzle[1] = PIPE_SWIZZLE_RED;
-        swizzle[2] = PIPE_SWIZZLE_ONE;
-        swizzle[3] = PIPE_SWIZZLE_ONE;
+        swizzle[0] = PIPE_SWIZZLE_Y;
+        swizzle[1] = PIPE_SWIZZLE_X;
+        swizzle[2] = PIPE_SWIZZLE_1;
+        swizzle[3] = PIPE_SWIZZLE_1;
     } else if (resource->format != PIPE_FORMAT_A8_UNORM &&
                resource->format != PIPE_FORMAT_RGTC1_UNORM) {
         /* exceptions:
@@ -550,7 +550,7 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
          * should have 1.0 for non-defined values */
         for (i = 0; i < 4; i++) {
             if (SWIZZLE_TO_REPLACE(desc->swizzle[i]))
-                swizzle[i] = PIPE_SWIZZLE_ONE;
+                swizzle[i] = PIPE_SWIZZLE_1;
         }
     }
 
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index e4403f0..74ba304 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -383,10 +383,10 @@ NineDevice9_ctor( struct NineDevice9 *This,
         templ.u.tex.last_layer = 0;
         templ.u.tex.first_level = 0;
         templ.u.tex.last_level = 0;
-        templ.swizzle_r = PIPE_SWIZZLE_ZERO;
-        templ.swizzle_g = PIPE_SWIZZLE_ZERO;
-        templ.swizzle_b = PIPE_SWIZZLE_ZERO;
-        templ.swizzle_a = PIPE_SWIZZLE_ONE;
+        templ.swizzle_r = PIPE_SWIZZLE_0;
+        templ.swizzle_g = PIPE_SWIZZLE_0;
+        templ.swizzle_b = PIPE_SWIZZLE_0;
+        templ.swizzle_a = PIPE_SWIZZLE_1;
         templ.target = This->dummy_texture->target;
 
         This->dummy_sampler_view = This->pipe->create_sampler_view(This->pipe, This->dummy_texture, &templ);
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index c70cc6e..de7e951 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -106,10 +106,10 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device,
    memset(&sv_tmpl, 0, sizeof(sv_tmpl));
    u_sampler_view_default_template(&sv_tmpl, res, res->format);
 
-   sv_tmpl.swizzle_r = PIPE_SWIZZLE_ONE;
-   sv_tmpl.swizzle_g = PIPE_SWIZZLE_ONE;
-   sv_tmpl.swizzle_b = PIPE_SWIZZLE_ONE;
-   sv_tmpl.swizzle_a = PIPE_SWIZZLE_ONE;
+   sv_tmpl.swizzle_r = PIPE_SWIZZLE_1;
+   sv_tmpl.swizzle_g = PIPE_SWIZZLE_1;
+   sv_tmpl.swizzle_b = PIPE_SWIZZLE_1;
+   sv_tmpl.swizzle_a = PIPE_SWIZZLE_1;
 
    dev->dummy_sv = dev->context->create_sampler_view(dev->context, res, &sv_tmpl);
    pipe_resource_reference(&res, NULL);
@@ -308,14 +308,14 @@ vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_res
    u_sampler_view_default_template(templ, res, res->format);
 
    desc = util_format_description(res->format);
-   if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0)
-      templ->swizzle_r = PIPE_SWIZZLE_ONE;
-   if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0)
-      templ->swizzle_g = PIPE_SWIZZLE_ONE;
-   if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0)
-      templ->swizzle_b = PIPE_SWIZZLE_ONE;
-   if (desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_0)
-      templ->swizzle_a = PIPE_SWIZZLE_ONE;
+   if (desc->swizzle[0] == PIPE_SWIZZLE_0)
+      templ->swizzle_r = PIPE_SWIZZLE_1;
+   if (desc->swizzle[1] == PIPE_SWIZZLE_0)
+      templ->swizzle_g = PIPE_SWIZZLE_1;
+   if (desc->swizzle[2] == PIPE_SWIZZLE_0)
+      templ->swizzle_b = PIPE_SWIZZLE_1;
+   if (desc->swizzle[3] == PIPE_SWIZZLE_0)
+      templ->swizzle_a = PIPE_SWIZZLE_1;
 }
 
 void
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
index 6f42216..8b95a4e 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -276,7 +276,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
 
       memset(&sampler_templ, 0, sizeof(sampler_templ));
       u_sampler_view_default_template(&sampler_templ, tex, tex->format);
-      sampler_templ.swizzle_a = PIPE_SWIZZLE_ONE;
+      sampler_templ.swizzle_a = PIPE_SWIZZLE_1;
       subpicture_priv->palette = pipe->create_sampler_view(pipe, tex, &sampler_templ);
       pipe_resource_reference(&tex, NULL);
       if (!subpicture_priv->sampler) {
diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h
index 3c7dbd0..5d72bb9 100644
--- a/src/gallium/tests/graw/graw_util.h
+++ b/src/gallium/tests/graw/graw_util.h
@@ -315,10 +315,10 @@ graw_util_create_simple_sampler_view(const struct graw_info *info,
    memset(&sv_temp, 0, sizeof(sv_temp));
    sv_temp.format = texture->format;
    sv_temp.texture = texture;
-   sv_temp.swizzle_r = PIPE_SWIZZLE_RED;
-   sv_temp.swizzle_g = PIPE_SWIZZLE_GREEN;
-   sv_temp.swizzle_b = PIPE_SWIZZLE_BLUE;
-   sv_temp.swizzle_a = PIPE_SWIZZLE_ALPHA;
+   sv_temp.swizzle_r = PIPE_SWIZZLE_X;
+   sv_temp.swizzle_g = PIPE_SWIZZLE_Y;
+   sv_temp.swizzle_b = PIPE_SWIZZLE_Z;
+   sv_temp.swizzle_a = PIPE_SWIZZLE_W;
 
    sv = info->ctx->create_sampler_view(info->ctx, texture, &sv_temp);
 
diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c
index 3b43bcb..9d3af94 100644
--- a/src/gallium/tests/graw/tex-srgb.c
+++ b/src/gallium/tests/graw/tex-srgb.c
@@ -176,10 +176,10 @@ static void init_tex( void )
       memset(&sv_temp, 0, sizeof sv_temp);
       sv_temp.format = PIPE_FORMAT_B8G8R8A8_UNORM;
       sv_temp.texture = texture;
-      sv_temp.swizzle_r = PIPE_SWIZZLE_RED;
-      sv_temp.swizzle_g = PIPE_SWIZZLE_GREEN;
-      sv_temp.swizzle_b = PIPE_SWIZZLE_BLUE;
-      sv_temp.swizzle_a = PIPE_SWIZZLE_ALPHA;
+      sv_temp.swizzle_r = PIPE_SWIZZLE_X;
+      sv_temp.swizzle_g = PIPE_SWIZZLE_Y;
+      sv_temp.swizzle_b = PIPE_SWIZZLE_Z;
+      sv_temp.swizzle_a = PIPE_SWIZZLE_W;
       linear_sv = info.ctx->create_sampler_view(info.ctx, texture, &sv_temp);
       if (linear_sv == NULL)
          exit(0);
@@ -191,10 +191,10 @@ static void init_tex( void )
       memset(&sv_temp, 0, sizeof sv_temp);
       sv_temp.format = PIPE_FORMAT_B8G8R8A8_SRGB;
       sv_temp.texture = texture;
-      sv_temp.swizzle_r = PIPE_SWIZZLE_RED;
-      sv_temp.swizzle_g = PIPE_SWIZZLE_GREEN;
-      sv_temp.swizzle_b = PIPE_SWIZZLE_BLUE;
-      sv_temp.swizzle_a = PIPE_SWIZZLE_ALPHA;
+      sv_temp.swizzle_r = PIPE_SWIZZLE_X;
+      sv_temp.swizzle_g = PIPE_SWIZZLE_Y;
+      sv_temp.swizzle_b = PIPE_SWIZZLE_Z;
+      sv_temp.swizzle_a = PIPE_SWIZZLE_W;
       srgb_sv = info.ctx->create_sampler_view(info.ctx, texture, &sv_temp);
       if (srgb_sv == NULL)
          exit(0);
diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c
index 8b472c9..bc56a95 100644
--- a/src/gallium/tests/graw/tex-swizzle.c
+++ b/src/gallium/tests/graw/tex-swizzle.c
@@ -182,19 +182,19 @@ char_to_swizzle(char c)
 {
    switch (c) {
    case 'r':
-      return PIPE_SWIZZLE_RED;
+      return PIPE_SWIZZLE_X;
    case 'g':
-      return PIPE_SWIZZLE_GREEN;
+      return PIPE_SWIZZLE_Y;
    case 'b':
-      return PIPE_SWIZZLE_BLUE;
+      return PIPE_SWIZZLE_Z;
    case 'a':
-      return PIPE_SWIZZLE_ALPHA;
+      return PIPE_SWIZZLE_W;
    case '0':
-      return PIPE_SWIZZLE_ZERO;
+      return PIPE_SWIZZLE_0;
    case '1':
-      return PIPE_SWIZZLE_ONE;
+      return PIPE_SWIZZLE_1;
    default:
-      return PIPE_SWIZZLE_RED;
+      return PIPE_SWIZZLE_X;
    }
 }
 
@@ -205,10 +205,10 @@ int main(int argc, char *argv[])
    uint swizzle[4];
    int i;
 
-   swizzle[0] = PIPE_SWIZZLE_RED;
-   swizzle[1] = PIPE_SWIZZLE_GREEN;
-   swizzle[2] = PIPE_SWIZZLE_BLUE;
-   swizzle[3] = PIPE_SWIZZLE_ALPHA;
+   swizzle[0] = PIPE_SWIZZLE_X;
+   swizzle[1] = PIPE_SWIZZLE_Y;
+   swizzle[2] = PIPE_SWIZZLE_Z;
+   swizzle[3] = PIPE_SWIZZLE_W;
 
    for (i = 1; i < argc; i++) {
       swizzle[i-1] = char_to_swizzle(argv[i][0]);
diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c
index 03a7294..a1cf15f 100644
--- a/src/mesa/state_tracker/st_cb_copyimage.c
+++ b/src/mesa/state_tracker/st_cb_copyimage.c
@@ -67,34 +67,34 @@ get_canonical_format(enum pipe_format format)
        desc->channel[1].size == 10 &&
        desc->channel[2].size == 10 &&
        desc->channel[3].size == 2) {
-      if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-          desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_Y &&
-          desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_Z)
+      if (desc->swizzle[0] == PIPE_SWIZZLE_X &&
+          desc->swizzle[1] == PIPE_SWIZZLE_Y &&
+          desc->swizzle[2] == PIPE_SWIZZLE_Z)
          return get_canonical_format(PIPE_FORMAT_R8G8B8A8_UINT);
 
       return PIPE_FORMAT_NONE;
    }
 
 #define RETURN_FOR_SWIZZLE1(x, format) \
-   if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x) \
+   if (desc->swizzle[0] == PIPE_SWIZZLE_##x) \
       return format
 
 #define RETURN_FOR_SWIZZLE2(x, y, format) \
-   if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x && \
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_##y) \
+   if (desc->swizzle[0] == PIPE_SWIZZLE_##x && \
+       desc->swizzle[1] == PIPE_SWIZZLE_##y) \
       return format
 
 #define RETURN_FOR_SWIZZLE3(x, y, z, format) \
-   if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x && \
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_##y && \
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_##z) \
+   if (desc->swizzle[0] == PIPE_SWIZZLE_##x && \
+       desc->swizzle[1] == PIPE_SWIZZLE_##y && \
+       desc->swizzle[2] == PIPE_SWIZZLE_##z) \
       return format
 
 #define RETURN_FOR_SWIZZLE4(x, y, z, w, format) \
-   if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x && \
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_##y && \
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_##z && \
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_##w) \
+   if (desc->swizzle[0] == PIPE_SWIZZLE_##x && \
+       desc->swizzle[1] == PIPE_SWIZZLE_##y && \
+       desc->swizzle[2] == PIPE_SWIZZLE_##z && \
+       desc->swizzle[3] == PIPE_SWIZZLE_##w) \
       return format
 
    /* Array formats. */
@@ -196,7 +196,7 @@ has_identity_swizzle(const struct util_format_description *desc)
    int i;
 
    for (i = 0; i < desc->nr_channels; i++)
-      if (desc->swizzle[i] != UTIL_FORMAT_SWIZZLE_X + i)
+      if (desc->swizzle[i] != PIPE_SWIZZLE_X + i)
          return false;
 
    return true;
@@ -348,8 +348,8 @@ same_size_and_swizzle(const struct util_format_description *d1,
       if (d1->channel[i].size != d2->channel[i].size)
          return false;
 
-      if (d1->swizzle[i] <= UTIL_FORMAT_SWIZZLE_W &&
-          d2->swizzle[i] <= UTIL_FORMAT_SWIZZLE_W &&
+      if (d1->swizzle[i] <= PIPE_SWIZZLE_W &&
+          d2->swizzle[i] <= PIPE_SWIZZLE_W &&
           d1->swizzle[i] != d2->swizzle[i])
          return false;
    }
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index c3e05bb..3d4c83f 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1025,17 +1025,17 @@ setup_sampler_swizzle(struct pipe_sampler_view *sv, GLenum format, GLenum type)
 
       /* invert the format's swizzle to setup the sampler's swizzle */
       if (format == GL_RGBA) {
-         c0 = UTIL_FORMAT_SWIZZLE_X;
-         c1 = UTIL_FORMAT_SWIZZLE_Y;
-         c2 = UTIL_FORMAT_SWIZZLE_Z;
-         c3 = UTIL_FORMAT_SWIZZLE_W;
+         c0 = PIPE_SWIZZLE_X;
+         c1 = PIPE_SWIZZLE_Y;
+         c2 = PIPE_SWIZZLE_Z;
+         c3 = PIPE_SWIZZLE_W;
       }
       else {
          assert(format == GL_BGRA);
-         c0 = UTIL_FORMAT_SWIZZLE_Z;
-         c1 = UTIL_FORMAT_SWIZZLE_Y;
-         c2 = UTIL_FORMAT_SWIZZLE_X;
-         c3 = UTIL_FORMAT_SWIZZLE_W;
+         c0 = PIPE_SWIZZLE_Z;
+         c1 = PIPE_SWIZZLE_Y;
+         c2 = PIPE_SWIZZLE_X;
+         c3 = PIPE_SWIZZLE_W;
       }
       sv->swizzle_r = search_swizzle(desc->swizzle, c0);
       sv->swizzle_g = search_swizzle(desc->swizzle, c1);
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a18b08b..00ad88e 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -900,10 +900,10 @@ format_is_alpha(enum pipe_format format)
    const struct util_format_description *desc = util_format_description(format);
 
    if (desc->nr_channels == 1 &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X)
+       desc->swizzle[0] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[1] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[2] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[3] == PIPE_SWIZZLE_X)
       return true;
 
    return false;
@@ -918,10 +918,10 @@ format_is_red(enum pipe_format format)
    const struct util_format_description *desc = util_format_description(format);
 
    if (desc->nr_channels == 1 &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1)
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[2] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[3] == PIPE_SWIZZLE_1)
       return true;
 
    return false;
@@ -937,10 +937,10 @@ format_is_luminance(enum pipe_format format)
    const struct util_format_description *desc = util_format_description(format);
 
    if (desc->nr_channels == 1 &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1)
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_1)
       return true;
 
    return false;
@@ -955,10 +955,10 @@ format_is_red_alpha(enum pipe_format format)
    const struct util_format_description *desc = util_format_description(format);
 
    if (desc->nr_channels == 2 &&
-       desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
-       desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
-       desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_Y)
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[2] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[3] == PIPE_SWIZZLE_Y)
       return true;
 
    return false;
@@ -969,10 +969,10 @@ format_is_swizzled_rgba(enum pipe_format format)
 {
     const struct util_format_description *desc = util_format_description(format);
 
-    if ((desc->swizzle[0] == TGSI_SWIZZLE_X || desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0) &&
-        (desc->swizzle[1] == TGSI_SWIZZLE_Y || desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) &&
-        (desc->swizzle[2] == TGSI_SWIZZLE_Z || desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) &&
-        (desc->swizzle[3] == TGSI_SWIZZLE_W || desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1))
+    if ((desc->swizzle[0] == TGSI_SWIZZLE_X || desc->swizzle[0] == PIPE_SWIZZLE_0) &&
+        (desc->swizzle[1] == TGSI_SWIZZLE_Y || desc->swizzle[1] == PIPE_SWIZZLE_0) &&
+        (desc->swizzle[2] == TGSI_SWIZZLE_Z || desc->swizzle[2] == PIPE_SWIZZLE_0) &&
+        (desc->swizzle[3] == TGSI_SWIZZLE_W || desc->swizzle[3] == PIPE_SWIZZLE_1))
        return false;
 
     return true;
@@ -1101,10 +1101,10 @@ reinterpret_formats(enum pipe_format *src_format, enum pipe_format *dst_format)
       unsigned i;
 
       /* Make sure the format is an RGBA and not an RGBX format */
-      if (src_desc->nr_channels != 4 || src_desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1)
+      if (src_desc->nr_channels != 4 || src_desc->swizzle[3] == PIPE_SWIZZLE_1)
          return false;
 
-      if (dst_desc->nr_channels != 4 || dst_desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1)
+      if (dst_desc->nr_channels != 4 || dst_desc->swizzle[3] == PIPE_SWIZZLE_1)
          return false;
 
       for (i = 0; i < 4; i++)
@@ -1371,10 +1371,10 @@ try_pbo_upload_common(struct gl_context *ctx,
       templ.format = src_format;
       templ.u.buf.first_element = first_element;
       templ.u.buf.last_element = last_element;
-      templ.swizzle_r = PIPE_SWIZZLE_RED;
-      templ.swizzle_g = PIPE_SWIZZLE_GREEN;
-      templ.swizzle_b = PIPE_SWIZZLE_BLUE;
-      templ.swizzle_a = PIPE_SWIZZLE_ALPHA;
+      templ.swizzle_r = PIPE_SWIZZLE_X;
+      templ.swizzle_g = PIPE_SWIZZLE_Y;
+      templ.swizzle_b = PIPE_SWIZZLE_Z;
+      templ.swizzle_a = PIPE_SWIZZLE_W;
 
       sampler_view = pipe->create_sampler_view(pipe, buffer, &templ);
       if (sampler_view == NULL)
-- 
2.5.0



More information about the mesa-dev mailing list