diff options
author | Marek Olšák <[email protected]> | 2016-04-16 14:05:47 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-04-22 01:30:39 +0200 |
commit | fb523cb6ad3ffef22ab4b9cce9e53859c17c5739 (patch) | |
tree | 45b67da368c4c387329e5887ab6d49d61f0b85a9 /src/mesa/state_tracker | |
parent | ed23335a313dfc9cec26999c0adffe3ab3a73a58 (diff) |
gallium: merge PIPE_SWIZZLE_* and UTIL_FORMAT_SWIZZLE_*
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 <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_copyimage.c | 32 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 16 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 52 |
3 files changed, 50 insertions, 50 deletions
diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index 03a7294e7c9..a1cf15f628c 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -67,34 +67,34 @@ get_canonical_format(enum pipe_format format) desc->channel[1].size == 10 && desc->channel[2].size == 10 && desc->channel[3].size == 2) { - if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X && - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_Y && - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_Z) + if (desc->swizzle[0] == PIPE_SWIZZLE_X && + desc->swizzle[1] == PIPE_SWIZZLE_Y && + desc->swizzle[2] == PIPE_SWIZZLE_Z) return get_canonical_format(PIPE_FORMAT_R8G8B8A8_UINT); return PIPE_FORMAT_NONE; } #define RETURN_FOR_SWIZZLE1(x, format) \ - if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x) \ + if (desc->swizzle[0] == PIPE_SWIZZLE_##x) \ return format #define RETURN_FOR_SWIZZLE2(x, y, format) \ - if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x && \ - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_##y) \ + if (desc->swizzle[0] == PIPE_SWIZZLE_##x && \ + desc->swizzle[1] == PIPE_SWIZZLE_##y) \ return format #define RETURN_FOR_SWIZZLE3(x, y, z, format) \ - if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x && \ - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_##y && \ - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_##z) \ + if (desc->swizzle[0] == PIPE_SWIZZLE_##x && \ + desc->swizzle[1] == PIPE_SWIZZLE_##y && \ + desc->swizzle[2] == PIPE_SWIZZLE_##z) \ return format #define RETURN_FOR_SWIZZLE4(x, y, z, w, format) \ - if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_##x && \ - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_##y && \ - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_##z && \ - desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_##w) \ + if (desc->swizzle[0] == PIPE_SWIZZLE_##x && \ + desc->swizzle[1] == PIPE_SWIZZLE_##y && \ + desc->swizzle[2] == PIPE_SWIZZLE_##z && \ + desc->swizzle[3] == PIPE_SWIZZLE_##w) \ return format /* Array formats. */ @@ -196,7 +196,7 @@ has_identity_swizzle(const struct util_format_description *desc) int i; for (i = 0; i < desc->nr_channels; i++) - if (desc->swizzle[i] != UTIL_FORMAT_SWIZZLE_X + i) + if (desc->swizzle[i] != PIPE_SWIZZLE_X + i) return false; return true; @@ -348,8 +348,8 @@ same_size_and_swizzle(const struct util_format_description *d1, if (d1->channel[i].size != d2->channel[i].size) return false; - if (d1->swizzle[i] <= UTIL_FORMAT_SWIZZLE_W && - d2->swizzle[i] <= UTIL_FORMAT_SWIZZLE_W && + if (d1->swizzle[i] <= PIPE_SWIZZLE_W && + d2->swizzle[i] <= PIPE_SWIZZLE_W && d1->swizzle[i] != d2->swizzle[i]) return false; } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c3e05bbb7ce..3d4c83fab57 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1025,17 +1025,17 @@ setup_sampler_swizzle(struct pipe_sampler_view *sv, GLenum format, GLenum type) /* invert the format's swizzle to setup the sampler's swizzle */ if (format == GL_RGBA) { - c0 = UTIL_FORMAT_SWIZZLE_X; - c1 = UTIL_FORMAT_SWIZZLE_Y; - c2 = UTIL_FORMAT_SWIZZLE_Z; - c3 = UTIL_FORMAT_SWIZZLE_W; + c0 = PIPE_SWIZZLE_X; + c1 = PIPE_SWIZZLE_Y; + c2 = PIPE_SWIZZLE_Z; + c3 = PIPE_SWIZZLE_W; } else { assert(format == GL_BGRA); - c0 = UTIL_FORMAT_SWIZZLE_Z; - c1 = UTIL_FORMAT_SWIZZLE_Y; - c2 = UTIL_FORMAT_SWIZZLE_X; - c3 = UTIL_FORMAT_SWIZZLE_W; + c0 = PIPE_SWIZZLE_Z; + c1 = PIPE_SWIZZLE_Y; + c2 = PIPE_SWIZZLE_X; + c3 = PIPE_SWIZZLE_W; } sv->swizzle_r = search_swizzle(desc->swizzle, c0); sv->swizzle_g = search_swizzle(desc->swizzle, c1); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index a18b08b3226..00ad88e7ed8 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -900,10 +900,10 @@ format_is_alpha(enum pipe_format format) const struct util_format_description *desc = util_format_description(format); if (desc->nr_channels == 1 && - desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) + desc->swizzle[0] == PIPE_SWIZZLE_0 && + desc->swizzle[1] == PIPE_SWIZZLE_0 && + desc->swizzle[2] == PIPE_SWIZZLE_0 && + desc->swizzle[3] == PIPE_SWIZZLE_X) return true; return false; @@ -918,10 +918,10 @@ format_is_red(enum pipe_format format) const struct util_format_description *desc = util_format_description(format); if (desc->nr_channels == 1 && - desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X && - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) + desc->swizzle[0] == PIPE_SWIZZLE_X && + desc->swizzle[1] == PIPE_SWIZZLE_0 && + desc->swizzle[2] == PIPE_SWIZZLE_0 && + desc->swizzle[3] == PIPE_SWIZZLE_1) return true; return false; @@ -937,10 +937,10 @@ format_is_luminance(enum pipe_format format) const struct util_format_description *desc = util_format_description(format); if (desc->nr_channels == 1 && - desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X && - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X && - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X && - desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) + desc->swizzle[0] == PIPE_SWIZZLE_X && + desc->swizzle[1] == PIPE_SWIZZLE_X && + desc->swizzle[2] == PIPE_SWIZZLE_X && + desc->swizzle[3] == PIPE_SWIZZLE_1) return true; return false; @@ -955,10 +955,10 @@ format_is_red_alpha(enum pipe_format format) const struct util_format_description *desc = util_format_description(format); if (desc->nr_channels == 2 && - desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X && - desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 && - desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_Y) + desc->swizzle[0] == PIPE_SWIZZLE_X && + desc->swizzle[1] == PIPE_SWIZZLE_0 && + desc->swizzle[2] == PIPE_SWIZZLE_0 && + desc->swizzle[3] == PIPE_SWIZZLE_Y) return true; return false; @@ -969,10 +969,10 @@ format_is_swizzled_rgba(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); - if ((desc->swizzle[0] == TGSI_SWIZZLE_X || desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0) && - (desc->swizzle[1] == TGSI_SWIZZLE_Y || desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) && - (desc->swizzle[2] == TGSI_SWIZZLE_Z || desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) && - (desc->swizzle[3] == TGSI_SWIZZLE_W || desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1)) + if ((desc->swizzle[0] == TGSI_SWIZZLE_X || desc->swizzle[0] == PIPE_SWIZZLE_0) && + (desc->swizzle[1] == TGSI_SWIZZLE_Y || desc->swizzle[1] == PIPE_SWIZZLE_0) && + (desc->swizzle[2] == TGSI_SWIZZLE_Z || desc->swizzle[2] == PIPE_SWIZZLE_0) && + (desc->swizzle[3] == TGSI_SWIZZLE_W || desc->swizzle[3] == PIPE_SWIZZLE_1)) return false; return true; @@ -1101,10 +1101,10 @@ reinterpret_formats(enum pipe_format *src_format, enum pipe_format *dst_format) unsigned i; /* Make sure the format is an RGBA and not an RGBX format */ - if (src_desc->nr_channels != 4 || src_desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) + if (src_desc->nr_channels != 4 || src_desc->swizzle[3] == PIPE_SWIZZLE_1) return false; - if (dst_desc->nr_channels != 4 || dst_desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) + if (dst_desc->nr_channels != 4 || dst_desc->swizzle[3] == PIPE_SWIZZLE_1) return false; for (i = 0; i < 4; i++) @@ -1371,10 +1371,10 @@ try_pbo_upload_common(struct gl_context *ctx, templ.format = src_format; templ.u.buf.first_element = first_element; templ.u.buf.last_element = last_element; - templ.swizzle_r = PIPE_SWIZZLE_RED; - templ.swizzle_g = PIPE_SWIZZLE_GREEN; - templ.swizzle_b = PIPE_SWIZZLE_BLUE; - templ.swizzle_a = PIPE_SWIZZLE_ALPHA; + templ.swizzle_r = PIPE_SWIZZLE_X; + templ.swizzle_g = PIPE_SWIZZLE_Y; + templ.swizzle_b = PIPE_SWIZZLE_Z; + templ.swizzle_a = PIPE_SWIZZLE_W; sampler_view = pipe->create_sampler_view(pipe, buffer, &templ); if (sampler_view == NULL) |