gallium: merge PIPE_SWIZZLE_* and UTIL_FORMAT_SWIZZLE_*
authorMarek Olšák <marek.olsak@amd.com>
Sat, 16 Apr 2016 12:05:47 +0000 (14:05 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 21 Apr 2016 23:30:39 +0000 (01:30 +0200)
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.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
63 files changed:
src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/auxiliary/translate/translate_sse.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_format.c
src/gallium/auxiliary/util/u_format.h
src/gallium/auxiliary/util/u_format_table.py
src/gallium/auxiliary/util/u_sampler.c
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
src/gallium/auxiliary/vl/vl_video_buffer.c
src/gallium/drivers/freedreno/a2xx/fd2_gmem.c
src/gallium/drivers/freedreno/a2xx/fd2_util.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a3xx/fd3_format.c
src/gallium/drivers/freedreno/a4xx/fd4_emit.c
src/gallium/drivers/freedreno/a4xx/fd4_format.c
src/gallium/drivers/i915/i915_state_sampler.c
src/gallium/drivers/ilo/ilo_shader.c
src/gallium/drivers/ilo/shader/ilo_shader_fs.c
src/gallium/drivers/ilo/shader/ilo_shader_vs.c
src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
src/gallium/drivers/llvmpipe/lp_bld_depth.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_setup.c
src/gallium/drivers/nouveau/nouveau_video.c
src/gallium/drivers/nouveau/nouveau_vp3_video.c
src/gallium/drivers/nouveau/nv30/nv30_texture.c
src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
src/gallium/drivers/nouveau/nv50/nv50_surface.c
src/gallium/drivers/nouveau/nv50/nv50_tex.c
src/gallium/drivers/nouveau/nv50/nv84_video.c
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeon/r600_texture.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/softpipe/sp_tex_sample.c
src/gallium/drivers/svga/svga_tgsi_insn.c
src/gallium/drivers/svga/svga_tgsi_vgpu10.c
src/gallium/drivers/vc4/vc4_formats.c
src/gallium/drivers/vc4/vc4_nir_lower_io.c
src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_uniforms.c
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/nine/basetexture9.c
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/xvmc/subpicture.c
src/gallium/tests/graw/graw_util.h
src/gallium/tests/graw/tex-srgb.c
src/gallium/tests/graw/tex-swizzle.c
src/mesa/state_tracker/st_cb_copyimage.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_texture.c

index a41b30bbb96b4bfb4f5027da52477579b7f58346..b921e97e32b995d9f3fffff985f4eaee768bff16 100644 (file)
@@ -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];
          }
index 8bae94af3d7608fe6cd99a0938caf35855d1c884..7fc4e8d24fde09a4a5c5804827a4ac9a9111e626 100644 (file)
@@ -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);
       }
    }
index e4849fe043fdedf6e676586e27fe62174c3ee097..a6311a1ce84dae75316185eba27b37f7df5bd7a6 100644 (file)
@@ -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;
index 1727105e4f41a7feecf5d511a3ae78c77fcc95bc..332394e0f0465e9ff1f8580e4fc0f0a14a27d3d9 100644 (file)
@@ -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;
index f5718389f33cc3442fc3e44084cd31341b894d28..92f387dc1b080dc09fadceed9c97b3159ecb19fd 100644 (file)
@@ -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);
index 13fd877083a790ca3f8e7abd7af46f657083b9c3..e3943c7d5284b3f26232870d64003c96706037c3 100644 (file)
@@ -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;
index b3c3b30596211196ca020d1affac9e0c4fd44ab9..162e555a873bd975c0f60feda7d7379bf9e0528f 100644 (file)
@@ -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;
index 3ca2c48c4c78b369ae24e8b9154dc05c92a0214e..56aebdeb2496738b1b72eb8fbab37dc68a6800ec 100644 (file)
@@ -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,
index 79630bf6dc36293c5f3151c3e6eb1abe9cb87a34..1be5c97d893dfda4ab5b9b00d82a801e85215de2 100644 (file)
@@ -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;
       }
index ffdb864fa83e40be0b096b9c60c9ecbf434f529e..a99c1bc7bad233af8eca15188f4ae0a6bdbf4861 100644 (file)
@@ -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,
index 879d10ff01d979b51de4284688f9b01ecd793a7d..51de9652c4d7a423f2397b96a2c7b6ecfa1ce070 100755 (executable)
@@ -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",
 }
 
 
index 86799fdd5590256c9e8438d8de2fdf7a2bb383d2..5da1d5fdff2b65e67814576f75c0483911910858 100644 (file)
@@ -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);
 }
index b5c70451ce840ce3b18c8549baf6b2850e01b3b4..db62b44f563251b92f0534a1da33963f363455a5 100644 (file)
@@ -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)
index 462fdcb08823409b04366932b1936bd1204bd550..4a68ac1337f38878178f546cd18adb956dd077d6 100644 (file)
@@ -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;
index 982c9c2b0975a3757177ad6291ec799e5e334595..aa47267444f8e65f7d7c1f1f58014b9811697721 100644 (file)
@@ -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);
index 9781326a5aff5a6e3ef5a98502c56627de3a1152..6cece91a277cdf21bc010bbcf99bda0102a5efae 100644 (file)
@@ -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]])) |
index adfa9a96a46f73a5233542f57607035fc7b65acd..7d508e7397caa97388251be219ce9808b1cb3fc6 100644 (file)
@@ -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));
index 52ea9444517033c582be72ac93960fec78fbf7f7..7050ded133d6e23c3faf45ccf667ca4f37b6687a 100644 (file)
@@ -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;
        }
 }
 
index 81ed16ce8acc1a2e56d8440bac531bd1d0a3c6e5..e984d9bb64cf8655b9989beb786693a6c5872489 100644 (file)
@@ -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) |
index c240745cec14472f860d8f0f9ce74eb47f3531ee..bd7e285f39d341e1d0a98e0e6c90cbed39e245fa 100644 (file)
@@ -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;
        }
 }
 
index c874361dfd9659b3adb384babaf37debf1696a7e..84ed1514630dcb3e3b0087931c4a36142e99ccc1 100644 (file)
@@ -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,
index c61716dc7916e5940fde7e936479be57ee1c854e..4eab174e433059092116e326a07935e93d595e7b 100644 (file)
@@ -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;
       }
    }
 }
index 6c8f1b5222e76e7fc067b9d60b81b30915f683f5..d2b205a370d1a21cc9d10d19eced8208da3f9aa0 100644 (file)
@@ -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:
index 2b46d44f5bead0af9bdce59728f196fc8e990462..514e636f3273ec5fd0a28153cecbe0bb8ef0388c 100644 (file)
@@ -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;
index 564e19a156516674962f2fdf8297c26213349d7e..a57670d49567ebdfb63b7124b40103f0780a63a0 100644 (file)
@@ -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,
index b25e041375070a4bdc2209b2c2a722a723775bb1..0c27c2f89723bd3f63ab2a3127e61ca152718117 100644 (file)
@@ -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);
 
index cb681bac9398ccafc8593a4442645284ba39f4d3..4f61de8000f9bc218b9647eaa0f5414a80521bae 100644 (file)
@@ -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;
       }
    }
index 93460a39e90858ea72d86f9d8fc4e644e85e7ca3..76cbb5be8ef466fae3fd839dd2e716b3a42e63f3 100644 (file)
@@ -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) &&
index 6a4fbbbf202f5743a5984cdb78617230488a6572..fec0ec1f7051f1d79377e59b0b297d67281ddb55 100644 (file)
@@ -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
index 8bb12b22ac1966a839f7f8de653c6347daa3f358..bb3aad784c59e4e97d5383f1893a16da16574081 100644 (file)
@@ -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;
index d76d93241f4145da91f61b7b88a3b0399c59573d..172d80c44c29c6758650205b3ed614248252ab0f 100644 (file)
@@ -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])
index bfe21cceaa25352358805d1ba199d8faf35bd6c2..4f4f87e2ce9fe30f34f2a2f46c3dad871761d067 100644 (file)
@@ -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;
index b9cfb313fb54a43d82b9436e82c01a5c27a7beb3..89ac208c15509132fc5ed371621c58f795ff4ce9 100644 (file)
@@ -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));
index 68b0e18ef8f28f5e263a6974e1c1655ef464bffc..a284f27c366afaf274c2550825ae9803ed1eade6 100644 (file)
@@ -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;
index 414d326eeed4c24715d02586e6150e33cdd6fe8e..36c07bc4fc3110f4caa20a306760dd04c732a23b 100644 (file)
@@ -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;
    }
index 88655dbfae5c93528e6b0dbbf2a6dbc717dca1f8..1b1f31ac485918ac2dcde4c43e3c993945f96d92 100644 (file)
@@ -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);
index e108590e2157f054edfc148226d89636c7554718..a1775698a3dc1efa94ada637fd0ddec3bbb8c4d6 100644 (file)
@@ -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;
index e04573f82497f9cbc2be51fd8e36c0521fc2f973..21618468befed591069c3fdffb4186fc69a40548 100644 (file)
@@ -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;
    }
index 5c443d144ba5d963ff2f37b6274752245ccaec8a..a4783f396e136d17f0132b00b6cac3a40b127421 100644 (file)
@@ -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];
 
index 741e263e7ed96464f32ddf2d6edacd0ac00bfb99..bae669e78cb16b26f87295b0610788f508832dd8 100644 (file)
@@ -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
index 709345a492ec66a43cd3d779d11ae1020cab3bd5..da51661d5cd92935734db8141415116f6aeb3251 100644 (file)
@@ -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];
         }
     }
index 2ad9e3eb1abb2ee068f49778e5dd3b740ec82429..81feb2931222e40c775b1159efc0cc124ef731e9 100644 (file)
@@ -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);
index cb40c20a7dda9d3699b0da512c74967f9b08e1af..19c61ff44358220e502b27148599f01bbfaa5778 100644 (file)
@@ -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];
                }
        }
index 72af5344b70c04eb2c30eda4d3989a905f5a7a72..4bbe04d1b7962b4badca403f904b4a09e343eb00 100644 (file)
@@ -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;
index 3f74176d04110df4ad404c1c313aa08fe57f2278..7ae6e8aff08f6576cf14139fd03527cd6d55ba03 100644 (file)
@@ -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;
        }
 }
@@ -2205,7 +2205,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) {
@@ -3562,10 +3562,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);
index 5703ca2dedba077092e2723cf21ec42c489e7c4e..5998681c0fc0ee9466771034d3d21bc094573540 100644 (file)
@@ -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);
 }
 
 
index bedda2ecf7117ed481174f41727e29c3e328be20..f0ef65f3d71325010d2714f70833fa1037a04ab8 100644 (file)
@@ -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;
       }
 
index f8f615e76514b75cdbf2ba187b4265862b753243..a899c47cd7f76791d8a6d146fb0ab96b1d81f30b 100644 (file)
@@ -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 ?
index ffce61237de47e296de65a7ea35fa99a209cb453..dd700cdec7d7f5a9b9ac6afabb5fb5faa378fed8 100644 (file)
@@ -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)                                     \
index be89bfcc937e02e8ff1622c9efd163ea029d04f8..f1e5478126e28025c1e7d2605a19e21c37a06f73 100644 (file)
@@ -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);
index 8aba8badc4250faa330cf7ba77e9830d2693b8e6..02cae2d4648423feec3e6d0d6844b2100012e050 100644 (file)
@@ -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];
         }
 }
index 262531f1bd7060df2c447ef88619e1855803ac9c..4715a7fffd5bad742e017e18b569f44b47fb00ce 100644 (file)
@@ -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
index 62387eac18b8e17f8f0fa7e7e8e127e7d0aa22b2..bd02a79f19cf38e61069b69218ff07ef6ec6adef 100644 (file)
@@ -544,15 +544,17 @@ enum pipe_sprite_coord_mode {
 };
 
 /**
- * Texture swizzles
+ * Texture & format swizzles
  */
 enum pipe_swizzle {
-   PIPE_SWIZZLE_RED,
-   PIPE_SWIZZLE_GREEN,
-   PIPE_SWIZZLE_BLUE,
-   PIPE_SWIZZLE_ALPHA,
-   PIPE_SWIZZLE_ZERO,
-   PIPE_SWIZZLE_ONE,
+   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
index c4eb813e9f8c8c1ee429a538460d0a3cba3ee778..829a7c61f50568a3b07b936d0c41faecdb6ee1e6 100644 (file)
@@ -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;
         }
     }
 
index e4403f0db03014a7d19d34b3f63ad6d5a280f94d..74ba3040ce4fab55390362d5cb09c772bb792c1d 100644 (file)
@@ -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);
index c70cc6e2752e925d23e80ef907e63774768a4973..de7e951a46a8a94808b4b554a5a42bd11b1562fb 100644 (file)
@@ -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
index 6f42216262f7ef70afc1d580fbbb0fed61f402ab..8b95a4effd76b75d12cf86a42f63ee4b42741f01 100644 (file)
@@ -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) {
index 3c7dbd061cc605e31d8f120d2d843bb49e092256..5d72bb9d4a7cb653456d99f12b5a859b17f5f07b 100644 (file)
@@ -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);
 
index 3b43bcbf73e9a4ac6af157990cd2001622ce7d2e..9d3af94800ea89cee67353d09f66a0e6df2687c1 100644 (file)
@@ -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);
index 8b472c9364c8384a6f7b206f282ff089ed9bede9..bc56a9570fc339ba9039630e8b7bfbff64284e83 100644 (file)
@@ -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]);
index 03a7294e7c9be130536a4bcca38b1ad60b630397..a1cf15f628ce629aa3621478f4494bb1428772fd 100644 (file)
@@ -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;
    }
index c3e05bbb7ce15afa79fc7f624ba64632e42ac11f..3d4c83fab57b66ca5674b56fdd695a669b670d2c 100644 (file)
@@ -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);
index a18b08b32267768ed43a086a9935ad09058bba22..00ad88e7ed8b92b5974a5e2621c6a88ead625da5 100644 (file)
@@ -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)