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 | |
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')
-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 | ||||
-rw-r--r-- | src/gallium/auxiliary/translate/translate_sse.c | 110 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format.c | 74 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format.h | 30 | ||||
-rwxr-xr-x | src/gallium/auxiliary/util/u_format_table.py | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_sampler.c | 18 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.c | 6 |
14 files changed, 170 insertions, 182 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; diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index b3c3b305962..162e555a873 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -467,8 +467,8 @@ translate_attr_convert(struct translate_sse *p, unsigned i; boolean id_swizzle = TRUE; unsigned swizzle[4] = - { UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE, - UTIL_FORMAT_SWIZZLE_NONE, UTIL_FORMAT_SWIZZLE_NONE }; + { PIPE_SWIZZLE_NONE, PIPE_SWIZZLE_NONE, + PIPE_SWIZZLE_NONE, PIPE_SWIZZLE_NONE }; unsigned needed_chans = 0; unsigned imms[2] = { 0, 0x3f800000 }; @@ -510,7 +510,7 @@ translate_attr_convert(struct translate_sse *p, struct x86_reg dataXMM = x86_make_reg(file_XMM, 0); for (i = 0; i < output_desc->nr_channels; ++i) { - if (swizzle[i] == UTIL_FORMAT_SWIZZLE_0 + if (swizzle[i] == PIPE_SWIZZLE_0 && i >= input_desc->nr_channels) swizzle[i] = i; } @@ -518,7 +518,7 @@ translate_attr_convert(struct translate_sse *p, for (i = 0; i < output_desc->nr_channels; ++i) { if (swizzle[i] < 4) needed_chans = MAX2(needed_chans, swizzle[i] + 1); - if (swizzle[i] < UTIL_FORMAT_SWIZZLE_0 && swizzle[i] != i) + if (swizzle[i] < PIPE_SWIZZLE_0 && swizzle[i] != i) id_swizzle = FALSE; } @@ -630,9 +630,9 @@ translate_attr_convert(struct translate_sse *p, && input_desc->channel[0].size != 64) { return FALSE; } - if (swizzle[3] == UTIL_FORMAT_SWIZZLE_1 + if (swizzle[3] == PIPE_SWIZZLE_1 && input_desc->nr_channels <= 3) { - swizzle[3] = UTIL_FORMAT_SWIZZLE_W; + swizzle[3] = PIPE_SWIZZLE_W; needed_chans = CHANNELS_0001; } switch (input_desc->channel[0].size) { @@ -661,63 +661,63 @@ translate_attr_convert(struct translate_sse *p, } if (output_desc->nr_channels >= 4 - && swizzle[0] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[1] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[2] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) { + && swizzle[0] < PIPE_SWIZZLE_0 + && swizzle[1] < PIPE_SWIZZLE_0 + && swizzle[2] < PIPE_SWIZZLE_0 + && swizzle[3] < PIPE_SWIZZLE_0) { sse_movups(p->func, dst, dataXMM); } else { if (output_desc->nr_channels >= 2 - && swizzle[0] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[1] < UTIL_FORMAT_SWIZZLE_0) { + && swizzle[0] < PIPE_SWIZZLE_0 + && swizzle[1] < PIPE_SWIZZLE_0) { sse_movlps(p->func, dst, dataXMM); } else { - if (swizzle[0] < UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[0] < PIPE_SWIZZLE_0) { sse_movss(p->func, dst, dataXMM); } else { x86_mov_imm(p->func, dst, - imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[0] - PIPE_SWIZZLE_0]); } if (output_desc->nr_channels >= 2) { - if (swizzle[1] < UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[1] < PIPE_SWIZZLE_0) { sse_shufps(p->func, dataXMM, dataXMM, SHUF(1, 1, 2, 3)); sse_movss(p->func, x86_make_disp(dst, 4), dataXMM); } else { x86_mov_imm(p->func, x86_make_disp(dst, 4), - imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[1] - PIPE_SWIZZLE_0]); } } } if (output_desc->nr_channels >= 3) { if (output_desc->nr_channels >= 4 - && swizzle[2] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) { + && swizzle[2] < PIPE_SWIZZLE_0 + && swizzle[3] < PIPE_SWIZZLE_0) { sse_movhps(p->func, x86_make_disp(dst, 8), dataXMM); } else { - if (swizzle[2] < UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[2] < PIPE_SWIZZLE_0) { sse_shufps(p->func, dataXMM, dataXMM, SHUF(2, 2, 2, 3)); sse_movss(p->func, x86_make_disp(dst, 8), dataXMM); } else { x86_mov_imm(p->func, x86_make_disp(dst, 8), - imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[2] - PIPE_SWIZZLE_0]); } if (output_desc->nr_channels >= 4) { - if (swizzle[3] < UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[3] < PIPE_SWIZZLE_0) { sse_shufps(p->func, dataXMM, dataXMM, SHUF(3, 3, 3, 3)); sse_movss(p->func, x86_make_disp(dst, 12), dataXMM); } else { x86_mov_imm(p->func, x86_make_disp(dst, 12), - imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[3] - PIPE_SWIZZLE_0]); } } } @@ -742,7 +742,7 @@ translate_attr_convert(struct translate_sse *p, unsigned imms[2] = { 0, 1 }; for (i = 0; i < output_desc->nr_channels; ++i) { - if (swizzle[i] == UTIL_FORMAT_SWIZZLE_0 + if (swizzle[i] == PIPE_SWIZZLE_0 && i >= input_desc->nr_channels) { swizzle[i] = i; } @@ -751,7 +751,7 @@ translate_attr_convert(struct translate_sse *p, for (i = 0; i < output_desc->nr_channels; ++i) { if (swizzle[i] < 4) needed_chans = MAX2(needed_chans, swizzle[i] + 1); - if (swizzle[i] < UTIL_FORMAT_SWIZZLE_0 && swizzle[i] != i) + if (swizzle[i] < PIPE_SWIZZLE_0 && swizzle[i] != i) id_swizzle = FALSE; } @@ -806,16 +806,16 @@ translate_attr_convert(struct translate_sse *p, } if (output_desc->nr_channels >= 4 - && swizzle[0] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[1] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[2] < UTIL_FORMAT_SWIZZLE_0 - && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) { + && swizzle[0] < PIPE_SWIZZLE_0 + && swizzle[1] < PIPE_SWIZZLE_0 + && swizzle[2] < PIPE_SWIZZLE_0 + && swizzle[3] < PIPE_SWIZZLE_0) { sse2_movq(p->func, dst, dataXMM); } else { - if (swizzle[0] < UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[0] < PIPE_SWIZZLE_0) { if (output_desc->nr_channels >= 2 - && swizzle[1] < UTIL_FORMAT_SWIZZLE_0) { + && swizzle[1] < PIPE_SWIZZLE_0) { sse2_movd(p->func, dst, dataXMM); } else { @@ -823,19 +823,19 @@ translate_attr_convert(struct translate_sse *p, x86_mov16(p->func, dst, tmp); if (output_desc->nr_channels >= 2) x86_mov16_imm(p->func, x86_make_disp(dst, 2), - imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[1] - PIPE_SWIZZLE_0]); } } else { if (output_desc->nr_channels >= 2 - && swizzle[1] >= UTIL_FORMAT_SWIZZLE_0) { + && swizzle[1] >= PIPE_SWIZZLE_0) { x86_mov_imm(p->func, dst, - (imms[swizzle[1] - UTIL_FORMAT_SWIZZLE_0] << 16) | - imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]); + (imms[swizzle[1] - PIPE_SWIZZLE_0] << 16) | + imms[swizzle[0] - PIPE_SWIZZLE_0]); } else { x86_mov16_imm(p->func, dst, - imms[swizzle[0] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[0] - PIPE_SWIZZLE_0]); if (output_desc->nr_channels >= 2) { sse2_movd(p->func, tmp, dataXMM); x86_shr_imm(p->func, tmp, 16); @@ -845,9 +845,9 @@ translate_attr_convert(struct translate_sse *p, } if (output_desc->nr_channels >= 3) { - if (swizzle[2] < UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[2] < PIPE_SWIZZLE_0) { if (output_desc->nr_channels >= 4 - && swizzle[3] < UTIL_FORMAT_SWIZZLE_0) { + && swizzle[3] < PIPE_SWIZZLE_0) { sse2_psrlq_imm(p->func, dataXMM, 32); sse2_movd(p->func, x86_make_disp(dst, 4), dataXMM); } @@ -857,20 +857,20 @@ translate_attr_convert(struct translate_sse *p, x86_mov16(p->func, x86_make_disp(dst, 4), tmp); if (output_desc->nr_channels >= 4) { x86_mov16_imm(p->func, x86_make_disp(dst, 6), - imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[3] - PIPE_SWIZZLE_0]); } } } else { if (output_desc->nr_channels >= 4 - && swizzle[3] >= UTIL_FORMAT_SWIZZLE_0) { + && swizzle[3] >= PIPE_SWIZZLE_0) { x86_mov_imm(p->func, x86_make_disp(dst, 4), - (imms[swizzle[3] - UTIL_FORMAT_SWIZZLE_0] << 16) - | imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]); + (imms[swizzle[3] - PIPE_SWIZZLE_0] << 16) + | imms[swizzle[2] - PIPE_SWIZZLE_0]); } else { x86_mov16_imm(p->func, x86_make_disp(dst, 4), - imms[swizzle[2] - UTIL_FORMAT_SWIZZLE_0]); + imms[swizzle[2] - PIPE_SWIZZLE_0]); if (output_desc->nr_channels >= 4) { sse2_psrlq_imm(p->func, dataXMM, 48); @@ -890,10 +890,10 @@ translate_attr_convert(struct translate_sse *p, if (input_desc->channel[0].size == 8 && input_desc->nr_channels == 4 && output_desc->nr_channels == 4 - && swizzle[0] == UTIL_FORMAT_SWIZZLE_W - && swizzle[1] == UTIL_FORMAT_SWIZZLE_Z - && swizzle[2] == UTIL_FORMAT_SWIZZLE_Y - && swizzle[3] == UTIL_FORMAT_SWIZZLE_X) { + && swizzle[0] == PIPE_SWIZZLE_W + && swizzle[1] == PIPE_SWIZZLE_Z + && swizzle[2] == PIPE_SWIZZLE_Y + && swizzle[3] == PIPE_SWIZZLE_X) { /* TODO: support movbe */ x86_mov(p->func, tmp, src); x86_bswap(p->func, tmp); @@ -904,9 +904,9 @@ translate_attr_convert(struct translate_sse *p, for (i = 0; i < output_desc->nr_channels; ++i) { switch (output_desc->channel[0].size) { case 8: - if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[i] >= PIPE_SWIZZLE_0) { unsigned v = 0; - if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) { + if (swizzle[i] == PIPE_SWIZZLE_1) { switch (output_desc->channel[0].type) { case UTIL_FORMAT_TYPE_UNSIGNED: v = output_desc->channel[0].normalized ? 0xff : 1; @@ -926,9 +926,9 @@ translate_attr_convert(struct translate_sse *p, } break; case 16: - if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[i] >= PIPE_SWIZZLE_0) { unsigned v = 0; - if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) { + if (swizzle[i] == PIPE_SWIZZLE_1) { switch (output_desc->channel[1].type) { case UTIL_FORMAT_TYPE_UNSIGNED: v = output_desc->channel[1].normalized ? 0xffff : 1; @@ -945,7 +945,7 @@ translate_attr_convert(struct translate_sse *p, } x86_mov16_imm(p->func, x86_make_disp(dst, i * 2), v); } - else if (swizzle[i] == UTIL_FORMAT_SWIZZLE_0) { + else if (swizzle[i] == PIPE_SWIZZLE_0) { x86_mov16_imm(p->func, x86_make_disp(dst, i * 2), 0); } else { @@ -954,9 +954,9 @@ translate_attr_convert(struct translate_sse *p, } break; case 32: - if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[i] >= PIPE_SWIZZLE_0) { unsigned v = 0; - if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) { + if (swizzle[i] == PIPE_SWIZZLE_1) { switch (output_desc->channel[1].type) { case UTIL_FORMAT_TYPE_UNSIGNED: v = output_desc->channel[1].normalized ? 0xffffffff : 1; @@ -979,10 +979,10 @@ translate_attr_convert(struct translate_sse *p, } break; case 64: - if (swizzle[i] >= UTIL_FORMAT_SWIZZLE_0) { + if (swizzle[i] >= PIPE_SWIZZLE_0) { unsigned l = 0; unsigned h = 0; - if (swizzle[i] == UTIL_FORMAT_SWIZZLE_1) { + if (swizzle[i] == PIPE_SWIZZLE_1) { switch (output_desc->channel[1].type) { case UTIL_FORMAT_TYPE_UNSIGNED: h = output_desc->channel[1].normalized ? 0xffffffff : 0; diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 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); } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index b5c70451ce8..db62b44f563 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -189,7 +189,7 @@ init_zscan_buffer(struct vl_mpeg12_decoder *dec, struct vl_mpeg12_buffer *buffer memset(&sv_tmpl, 0, sizeof(sv_tmpl)); u_sampler_view_default_template(&sv_tmpl, res, res->format); - sv_tmpl.swizzle_r = sv_tmpl.swizzle_g = sv_tmpl.swizzle_b = sv_tmpl.swizzle_a = PIPE_SWIZZLE_RED; + sv_tmpl.swizzle_r = sv_tmpl.swizzle_g = sv_tmpl.swizzle_b = sv_tmpl.swizzle_a = PIPE_SWIZZLE_X; buffer->zscan_source = dec->context->create_sampler_view(dec->context, res, &sv_tmpl); pipe_resource_reference(&res, NULL); if (!buffer->zscan_source) diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 462fdcb0882..4a68ac1337f 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -297,7 +297,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer) u_sampler_view_default_template(&sv_templ, buf->resources[i], buf->resources[i]->format); if (util_format_get_nr_components(buf->resources[i]->format) == 1) - sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = sv_templ.swizzle_a = PIPE_SWIZZLE_RED; + sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = sv_templ.swizzle_a = PIPE_SWIZZLE_X; buf->sampler_view_planes[i] = pipe->create_sampler_view(pipe, buf->resources[i], &sv_templ); if (!buf->sampler_view_planes[i]) @@ -344,8 +344,8 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) memset(&sv_templ, 0, sizeof(sv_templ)); u_sampler_view_default_template(&sv_templ, res, sampler_format[plane_order[i]]); - sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_RED + j; - sv_templ.swizzle_a = PIPE_SWIZZLE_ONE; + sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_X + j; + sv_templ.swizzle_a = PIPE_SWIZZLE_1; buf->sampler_view_components[component] = pipe->create_sampler_view(pipe, res, &sv_templ); if (!buf->sampler_view_components[component]) goto error; |