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/gallium/auxiliary/gallivm | |
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/gallium/auxiliary/gallivm')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_format_soa.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_swizzle.c | 46 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 16 |
6 files changed, 45 insertions, 45 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index a41b30bbb96..b921e97e32b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -54,7 +54,7 @@ /** * Basic swizzling. Rearrange the order of the unswizzled array elements - * according to the format description. PIPE_SWIZZLE_ZERO/ONE are supported + * according to the format description. PIPE_SWIZZLE_0/ONE are supported * too. * Ex: if unswizzled[4] = {B, G, R, x}, then swizzled_out[4] = {R, G, B, 1}. */ @@ -69,16 +69,16 @@ lp_build_format_swizzle_aos(const struct util_format_description *desc, assert(bld->type.length % 4 == 0); for (chan = 0; chan < 4; ++chan) { - enum util_format_swizzle swizzle; + enum pipe_swizzle swizzle; if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { /* * For ZS formats do RGBA = ZZZ1 */ if (chan == 3) { - swizzle = UTIL_FORMAT_SWIZZLE_1; - } else if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_NONE) { - swizzle = UTIL_FORMAT_SWIZZLE_0; + swizzle = PIPE_SWIZZLE_1; + } else if (desc->swizzle[0] == PIPE_SWIZZLE_NONE) { + swizzle = PIPE_SWIZZLE_0; } else { swizzle = desc->swizzle[0]; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c index 8bae94af3d7..7fc4e8d24fd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c @@ -48,11 +48,11 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc, const LLVMValueRef *unswizzled, LLVMValueRef swizzled_out[4]) { - assert(UTIL_FORMAT_SWIZZLE_0 == PIPE_SWIZZLE_ZERO); - assert(UTIL_FORMAT_SWIZZLE_1 == PIPE_SWIZZLE_ONE); + assert(PIPE_SWIZZLE_0 == (int)PIPE_SWIZZLE_0); + assert(PIPE_SWIZZLE_1 == (int)PIPE_SWIZZLE_1); if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { - enum util_format_swizzle swizzle; + enum pipe_swizzle swizzle; LLVMValueRef depth_or_stencil; if (util_format_has_stencil(format_desc) && @@ -76,7 +76,7 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc, else { unsigned chan; for (chan = 0; chan < 4; ++chan) { - enum util_format_swizzle swizzle = format_desc->swizzle[chan]; + enum pipe_swizzle swizzle = format_desc->swizzle[chan]; swizzled_out[chan] = lp_build_swizzle_soa_channel(bld, unswizzled, swizzle); } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c index e4849fe043f..a6311a1ce84 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c @@ -353,7 +353,7 @@ lp_build_float_to_srgb_packed(struct gallivm_state *gallivm, dst = lp_build_zero(gallivm, int32_type); for (chan = 0; chan < dst_fmt->nr_channels; chan++) { - if (dst_fmt->swizzle[chan] <= UTIL_FORMAT_SWIZZLE_W) { + if (dst_fmt->swizzle[chan] <= PIPE_SWIZZLE_W) { unsigned ls; LLVMValueRef shifted, shift_val; ls = dst_fmt->channel[dst_fmt->swizzle[chan]].shift; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 1727105e4f4..332394e0f04 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1360,7 +1360,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, if (is_gather) { /* more hacks for swizzling, should be X, ONE or ZERO... */ unsigned chan_swiz = bld->static_texture_state->swizzle_r; - if (chan_swiz <= PIPE_SWIZZLE_ALPHA) { + if (chan_swiz <= PIPE_SWIZZLE_W) { colors0[0] = lp_build_select(texel_bld, cmpval10, texel_bld->one, texel_bld->zero); colors0[1] = lp_build_select(texel_bld, cmpval11, @@ -1370,7 +1370,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, colors0[3] = lp_build_select(texel_bld, cmpval00, texel_bld->one, texel_bld->zero); } - else if (chan_swiz == PIPE_SWIZZLE_ZERO) { + else if (chan_swiz == PIPE_SWIZZLE_0) { colors0[0] = colors0[1] = colors0[2] = colors0[3] = texel_bld->zero; } @@ -1838,7 +1838,7 @@ lp_build_sample_common(struct lp_build_sample_context *bld, const struct util_format_description *format_desc = bld->format_desc; unsigned chan_type; /* not entirely sure we couldn't end up with non-valid swizzle here */ - chan_type = format_desc->swizzle[0] <= UTIL_FORMAT_SWIZZLE_W ? + chan_type = format_desc->swizzle[0] <= PIPE_SWIZZLE_W ? format_desc->channel[format_desc->swizzle[0]].type : UTIL_FORMAT_TYPE_FLOAT; if (chan_type != UTIL_FORMAT_TYPE_FLOAT) { @@ -1957,7 +1957,7 @@ lp_build_clamp_border_color(struct lp_build_sample_context *bld, else { chan = util_format_get_first_non_void_channel(format_desc->format); } - if (chan >= 0 && chan <= UTIL_FORMAT_SWIZZLE_W) { + if (chan >= 0 && chan <= PIPE_SWIZZLE_W) { unsigned chan_type = format_desc->channel[chan].type; unsigned chan_norm = format_desc->channel[chan].normalized; unsigned chan_pure = format_desc->channel[chan].pure_integer; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c index f5718389f33..92f387dc1b0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c @@ -361,10 +361,10 @@ lp_build_swizzle_aos(struct lp_build_context *bld, const unsigned n = type.length; unsigned i, j; - if (swizzles[0] == PIPE_SWIZZLE_RED && - swizzles[1] == PIPE_SWIZZLE_GREEN && - swizzles[2] == PIPE_SWIZZLE_BLUE && - swizzles[3] == PIPE_SWIZZLE_ALPHA) { + if (swizzles[0] == PIPE_SWIZZLE_X && + swizzles[1] == PIPE_SWIZZLE_Y && + swizzles[2] == PIPE_SWIZZLE_Z && + swizzles[3] == PIPE_SWIZZLE_W) { return a; } @@ -372,14 +372,14 @@ lp_build_swizzle_aos(struct lp_build_context *bld, swizzles[1] == swizzles[2] && swizzles[2] == swizzles[3]) { switch (swizzles[0]) { - case PIPE_SWIZZLE_RED: - case PIPE_SWIZZLE_GREEN: - case PIPE_SWIZZLE_BLUE: - case PIPE_SWIZZLE_ALPHA: + case PIPE_SWIZZLE_X: + case PIPE_SWIZZLE_Y: + case PIPE_SWIZZLE_Z: + case PIPE_SWIZZLE_W: return lp_build_swizzle_scalar_aos(bld, a, swizzles[0], 4); - case PIPE_SWIZZLE_ZERO: + case PIPE_SWIZZLE_0: return bld->zero; - case PIPE_SWIZZLE_ONE: + case PIPE_SWIZZLE_1: return bld->one; case LP_BLD_SWIZZLE_DONTCARE: return bld->undef; @@ -408,21 +408,21 @@ lp_build_swizzle_aos(struct lp_build_context *bld, default: assert(0); /* fall through */ - case PIPE_SWIZZLE_RED: - case PIPE_SWIZZLE_GREEN: - case PIPE_SWIZZLE_BLUE: - case PIPE_SWIZZLE_ALPHA: + case PIPE_SWIZZLE_X: + case PIPE_SWIZZLE_Y: + case PIPE_SWIZZLE_Z: + case PIPE_SWIZZLE_W: shuffle = j + swizzles[i]; shuffles[j + i] = LLVMConstInt(i32t, shuffle, 0); break; - case PIPE_SWIZZLE_ZERO: + case PIPE_SWIZZLE_0: shuffle = type.length + 0; shuffles[j + i] = LLVMConstInt(i32t, shuffle, 0); if (!aux[0]) { aux[0] = lp_build_const_elem(bld->gallivm, type, 0.0); } break; - case PIPE_SWIZZLE_ONE: + case PIPE_SWIZZLE_1: shuffle = type.length + 1; shuffles[j + i] = LLVMConstInt(i32t, shuffle, 0); if (!aux[1]) { @@ -474,7 +474,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld, * Start with a mixture of 1 and 0. */ for (chan = 0; chan < 4; ++chan) { - if (swizzles[chan] == PIPE_SWIZZLE_ONE) { + if (swizzles[chan] == PIPE_SWIZZLE_1) { cond |= 1 << chan; } } @@ -574,14 +574,14 @@ lp_build_swizzle_soa_channel(struct lp_build_context *bld, unsigned swizzle) { switch (swizzle) { - case PIPE_SWIZZLE_RED: - case PIPE_SWIZZLE_GREEN: - case PIPE_SWIZZLE_BLUE: - case PIPE_SWIZZLE_ALPHA: + case PIPE_SWIZZLE_X: + case PIPE_SWIZZLE_Y: + case PIPE_SWIZZLE_Z: + case PIPE_SWIZZLE_W: return unswizzled[swizzle]; - case PIPE_SWIZZLE_ZERO: + case PIPE_SWIZZLE_0: return bld->zero; - case PIPE_SWIZZLE_ONE: + case PIPE_SWIZZLE_1: return bld->one; default: assert(0); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 13fd877083a..e3943c7d528 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -2507,10 +2507,10 @@ emit_sample(struct lp_build_tgsi_soa_context *bld, bld->bld_base.base.gallivm, ¶ms); - 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, ¶ms); 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; |