aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c8
-rw-r--r--src/gallium/auxiliary/util/u_format.c74
-rw-r--r--src/gallium/auxiliary/util/u_format.h30
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_table.py14
-rw-r--r--src/gallium/auxiliary/util/u_sampler.c18
5 files changed, 66 insertions, 78 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 3ca2c48c4c7..56aebdeb249 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1389,10 +1389,10 @@ void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ,
src_templ->u.tex.last_layer =
src->target == PIPE_TEXTURE_3D ? u_minify(src->depth0, srclevel) - 1
: src->array_size - 1;
- src_templ->swizzle_r = PIPE_SWIZZLE_RED;
- src_templ->swizzle_g = PIPE_SWIZZLE_GREEN;
- src_templ->swizzle_b = PIPE_SWIZZLE_BLUE;
- src_templ->swizzle_a = PIPE_SWIZZLE_ALPHA;
+ src_templ->swizzle_r = PIPE_SWIZZLE_X;
+ src_templ->swizzle_g = PIPE_SWIZZLE_Y;
+ src_templ->swizzle_b = PIPE_SWIZZLE_Z;
+ src_templ->swizzle_a = PIPE_SWIZZLE_W;
}
static boolean is_blit_generic_supported(struct blitter_context *blitter,
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 79630bf6dc3..1be5c97d893 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -70,7 +70,7 @@ util_format_has_alpha(enum pipe_format format)
return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
+ desc->swizzle[3] != PIPE_SWIZZLE_1;
}
@@ -82,10 +82,10 @@ util_format_is_luminance(enum pipe_format format)
if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) {
+ desc->swizzle[0] == PIPE_SWIZZLE_X &&
+ desc->swizzle[1] == PIPE_SWIZZLE_X &&
+ desc->swizzle[2] == PIPE_SWIZZLE_X &&
+ desc->swizzle[3] == PIPE_SWIZZLE_1) {
return TRUE;
}
return FALSE;
@@ -99,10 +99,10 @@ util_format_is_alpha(enum pipe_format format)
if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0 &&
- desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
- desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
- desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
+ desc->swizzle[0] == PIPE_SWIZZLE_0 &&
+ desc->swizzle[1] == PIPE_SWIZZLE_0 &&
+ desc->swizzle[2] == PIPE_SWIZZLE_0 &&
+ desc->swizzle[3] == PIPE_SWIZZLE_X) {
return TRUE;
}
return FALSE;
@@ -196,10 +196,10 @@ util_format_is_luminance_alpha(enum pipe_format format)
if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_Y) {
+ desc->swizzle[0] == PIPE_SWIZZLE_X &&
+ desc->swizzle[1] == PIPE_SWIZZLE_X &&
+ desc->swizzle[2] == PIPE_SWIZZLE_X &&
+ desc->swizzle[3] == PIPE_SWIZZLE_Y) {
return TRUE;
}
return FALSE;
@@ -214,10 +214,10 @@ util_format_is_intensity(enum pipe_format format)
if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
+ desc->swizzle[0] == PIPE_SWIZZLE_X &&
+ desc->swizzle[1] == PIPE_SWIZZLE_X &&
+ desc->swizzle[2] == PIPE_SWIZZLE_X &&
+ desc->swizzle[3] == PIPE_SWIZZLE_X) {
return TRUE;
}
return FALSE;
@@ -486,7 +486,7 @@ util_is_format_compatible(const struct util_format_description *src_desc,
}
for (chan = 0; chan < 4; ++chan) {
- enum util_format_swizzle swizzle = dst_desc->swizzle[chan];
+ enum pipe_swizzle swizzle = dst_desc->swizzle[chan];
if (swizzle < 4) {
if (src_desc->swizzle[chan] != swizzle) {
@@ -746,7 +746,7 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
unsigned i;
for (i = 0; i < 4; i++) {
- dst[i] = swz2[i] <= UTIL_FORMAT_SWIZZLE_W ?
+ dst[i] = swz2[i] <= PIPE_SWIZZLE_W ?
swz1[swz2[i]] : swz2[i];
}
}
@@ -761,41 +761,41 @@ void util_format_apply_color_swizzle(union pipe_color_union *dst,
if (is_integer) {
for (c = 0; c < 4; ++c) {
switch (swz[c]) {
- case PIPE_SWIZZLE_RED: dst->ui[c] = src->ui[0]; break;
- case PIPE_SWIZZLE_GREEN: dst->ui[c] = src->ui[1]; break;
- case PIPE_SWIZZLE_BLUE: dst->ui[c] = src->ui[2]; break;
- case PIPE_SWIZZLE_ALPHA: dst->ui[c] = src->ui[3]; break;
+ case PIPE_SWIZZLE_X: dst->ui[c] = src->ui[0]; break;
+ case PIPE_SWIZZLE_Y: dst->ui[c] = src->ui[1]; break;
+ case PIPE_SWIZZLE_Z: dst->ui[c] = src->ui[2]; break;
+ case PIPE_SWIZZLE_W: dst->ui[c] = src->ui[3]; break;
default:
- dst->ui[c] = (swz[c] == PIPE_SWIZZLE_ONE) ? 1 : 0;
+ dst->ui[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1 : 0;
break;
}
}
} else {
for (c = 0; c < 4; ++c) {
switch (swz[c]) {
- case PIPE_SWIZZLE_RED: dst->f[c] = src->f[0]; break;
- case PIPE_SWIZZLE_GREEN: dst->f[c] = src->f[1]; break;
- case PIPE_SWIZZLE_BLUE: dst->f[c] = src->f[2]; break;
- case PIPE_SWIZZLE_ALPHA: dst->f[c] = src->f[3]; break;
+ case PIPE_SWIZZLE_X: dst->f[c] = src->f[0]; break;
+ case PIPE_SWIZZLE_Y: dst->f[c] = src->f[1]; break;
+ case PIPE_SWIZZLE_Z: dst->f[c] = src->f[2]; break;
+ case PIPE_SWIZZLE_W: dst->f[c] = src->f[3]; break;
default:
- dst->f[c] = (swz[c] == PIPE_SWIZZLE_ONE) ? 1.0f : 0.0f;
+ dst->f[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1.0f : 0.0f;
break;
}
}
}
}
-void util_format_swizzle_4f(float *dst, const float *src,
+void pipe_swizzle_4f(float *dst, const float *src,
const unsigned char swz[4])
{
unsigned i;
for (i = 0; i < 4; i++) {
- if (swz[i] <= UTIL_FORMAT_SWIZZLE_W)
+ if (swz[i] <= PIPE_SWIZZLE_W)
dst[i] = src[swz[i]];
- else if (swz[i] == UTIL_FORMAT_SWIZZLE_0)
+ else if (swz[i] == PIPE_SWIZZLE_0)
dst[i] = 0;
- else if (swz[i] == UTIL_FORMAT_SWIZZLE_1)
+ else if (swz[i] == PIPE_SWIZZLE_1)
dst[i] = 1;
}
}
@@ -807,16 +807,16 @@ void util_format_unswizzle_4f(float *dst, const float *src,
for (i = 0; i < 4; i++) {
switch (swz[i]) {
- case UTIL_FORMAT_SWIZZLE_X:
+ case PIPE_SWIZZLE_X:
dst[0] = src[i];
break;
- case UTIL_FORMAT_SWIZZLE_Y:
+ case PIPE_SWIZZLE_Y:
dst[1] = src[i];
break;
- case UTIL_FORMAT_SWIZZLE_Z:
+ case PIPE_SWIZZLE_Z:
dst[2] = src[i];
break;
- case UTIL_FORMAT_SWIZZLE_W:
+ case PIPE_SWIZZLE_W:
dst[3] = src[i];
break;
}
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index ffdb864fa83..a99c1bc7bad 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -117,18 +117,6 @@ enum util_format_type {
};
-enum util_format_swizzle {
- UTIL_FORMAT_SWIZZLE_X = 0,
- UTIL_FORMAT_SWIZZLE_Y = 1,
- UTIL_FORMAT_SWIZZLE_Z = 2,
- UTIL_FORMAT_SWIZZLE_W = 3,
- UTIL_FORMAT_SWIZZLE_0 = 4,
- UTIL_FORMAT_SWIZZLE_1 = 5,
- UTIL_FORMAT_SWIZZLE_NONE = 6,
- UTIL_FORMAT_SWIZZLE_MAX = 7 /**< Number of enums counter (must be last) */
-};
-
-
enum util_format_colorspace {
UTIL_FORMAT_COLORSPACE_RGB = 0,
UTIL_FORMAT_COLORSPACE_SRGB = 1,
@@ -518,14 +506,14 @@ static inline boolean
util_format_has_depth(const struct util_format_description *desc)
{
return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
- desc->swizzle[0] != UTIL_FORMAT_SWIZZLE_NONE;
+ desc->swizzle[0] != PIPE_SWIZZLE_NONE;
}
static inline boolean
util_format_has_stencil(const struct util_format_description *desc)
{
return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
- desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE;
+ desc->swizzle[1] != PIPE_SWIZZLE_NONE;
}
static inline boolean
@@ -565,7 +553,7 @@ util_get_depth_format_type(const struct util_format_description *desc)
{
unsigned depth_channel = desc->swizzle[0];
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
- depth_channel != UTIL_FORMAT_SWIZZLE_NONE) {
+ depth_channel != PIPE_SWIZZLE_NONE) {
return desc->channel[depth_channel].type;
} else {
return UTIL_FORMAT_TYPE_VOID;
@@ -872,13 +860,13 @@ util_format_get_component_bits(enum pipe_format format,
}
switch (desc->swizzle[component]) {
- case UTIL_FORMAT_SWIZZLE_X:
+ case PIPE_SWIZZLE_X:
return desc->channel[0].size;
- case UTIL_FORMAT_SWIZZLE_Y:
+ case PIPE_SWIZZLE_Y:
return desc->channel[1].size;
- case UTIL_FORMAT_SWIZZLE_Z:
+ case PIPE_SWIZZLE_Z:
return desc->channel[2].size;
- case UTIL_FORMAT_SWIZZLE_W:
+ case PIPE_SWIZZLE_W:
return desc->channel[3].size;
default:
return 0;
@@ -1298,14 +1286,14 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
/* Apply the swizzle provided in \param swz (which is one of PIPE_SWIZZLE_x)
* to \param src and store the result in \param dst.
- * \param is_integer determines the value written for PIPE_SWIZZLE_ONE.
+ * \param is_integer determines the value written for PIPE_SWIZZLE_1.
*/
void util_format_apply_color_swizzle(union pipe_color_union *dst,
const union pipe_color_union *src,
const unsigned char swz[4],
const boolean is_integer);
-void util_format_swizzle_4f(float *dst, const float *src,
+void pipe_swizzle_4f(float *dst, const float *src,
const unsigned char swz[4]);
void util_format_unswizzle_4f(float *dst, const float *src,
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 879d10ff01d..51de9652c4d 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -69,13 +69,13 @@ def bool_map(value):
swizzle_map = {
- SWIZZLE_X: "UTIL_FORMAT_SWIZZLE_X",
- SWIZZLE_Y: "UTIL_FORMAT_SWIZZLE_Y",
- SWIZZLE_Z: "UTIL_FORMAT_SWIZZLE_Z",
- SWIZZLE_W: "UTIL_FORMAT_SWIZZLE_W",
- SWIZZLE_0: "UTIL_FORMAT_SWIZZLE_0",
- SWIZZLE_1: "UTIL_FORMAT_SWIZZLE_1",
- SWIZZLE_NONE: "UTIL_FORMAT_SWIZZLE_NONE",
+ SWIZZLE_X: "PIPE_SWIZZLE_X",
+ SWIZZLE_Y: "PIPE_SWIZZLE_Y",
+ SWIZZLE_Z: "PIPE_SWIZZLE_Z",
+ SWIZZLE_W: "PIPE_SWIZZLE_W",
+ SWIZZLE_0: "PIPE_SWIZZLE_0",
+ SWIZZLE_1: "PIPE_SWIZZLE_1",
+ SWIZZLE_NONE: "PIPE_SWIZZLE_NONE",
}
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
index 86799fdd559..5da1d5fdff2 100644
--- a/src/gallium/auxiliary/util/u_sampler.c
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -52,10 +52,10 @@ default_template(struct pipe_sampler_view *view,
view->u.tex.first_layer = 0;
view->u.tex.last_layer = texture->target == PIPE_TEXTURE_3D ?
texture->depth0 - 1 : texture->array_size - 1;
- view->swizzle_r = PIPE_SWIZZLE_RED;
- view->swizzle_g = PIPE_SWIZZLE_GREEN;
- view->swizzle_b = PIPE_SWIZZLE_BLUE;
- view->swizzle_a = PIPE_SWIZZLE_ALPHA;
+ view->swizzle_r = PIPE_SWIZZLE_X;
+ view->swizzle_g = PIPE_SWIZZLE_Y;
+ view->swizzle_b = PIPE_SWIZZLE_Z;
+ view->swizzle_a = PIPE_SWIZZLE_W;
/* Override default green and blue component expansion to the requested
* one.
@@ -66,7 +66,7 @@ default_template(struct pipe_sampler_view *view,
* components.
*
* To make it look less hackish, one would have to add
- * UTIL_FORMAT_SWIZZLE_EXPAND to indicate components for expansion
+ * PIPE_SWIZZLE_EXPAND to indicate components for expansion
* and then override without exceptions or favoring one component
* over another.
*/
@@ -75,10 +75,10 @@ default_template(struct pipe_sampler_view *view,
assert(desc);
if (desc) {
- if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) {
+ if (desc->swizzle[1] == PIPE_SWIZZLE_0) {
view->swizzle_g = expand_green_blue;
}
- if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) {
+ if (desc->swizzle[2] == PIPE_SWIZZLE_0) {
view->swizzle_b = expand_green_blue;
}
}
@@ -94,7 +94,7 @@ u_sampler_view_default_template(struct pipe_sampler_view *view,
default_template(view,
texture,
format,
- PIPE_SWIZZLE_ZERO);
+ PIPE_SWIZZLE_0);
}
void
@@ -106,5 +106,5 @@ u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
default_template(view,
texture,
format,
- PIPE_SWIZZLE_ONE);
+ PIPE_SWIZZLE_1);
}