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>
/**
* 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}.
*/
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];
}
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) &&
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);
}
}
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;
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,
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;
}
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) {
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;
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;
}
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;
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]) {
* 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;
}
}
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);
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;
¶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;
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 };
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;
}
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;
}
&& 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) {
}
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]);
}
}
}
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;
}
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;
}
}
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 {
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);
}
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);
}
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);
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);
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;
}
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;
}
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 {
}
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;
}
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;
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,
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;
}
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;
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;
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;
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;
}
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) {
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];
}
}
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;
}
}
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;
}
};
-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,
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
{
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;
}
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;
/* 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,
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",
}
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.
* 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.
*/
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;
}
}
default_template(view,
texture,
format,
- PIPE_SWIZZLE_ZERO);
+ PIPE_SWIZZLE_0);
}
void
default_template(view,
texture,
format,
- PIPE_SWIZZLE_ONE);
+ PIPE_SWIZZLE_1);
}
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)
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])
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;
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);
{
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;
}
}
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]])) |
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));
{
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;
}
}
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) |
{
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;
}
}
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);
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,
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;
}
/*
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;
}
}
}
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:
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;
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;
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);
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);
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,
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;
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 */
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);
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;
}
}
* 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) &&
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
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])
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;
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])
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;
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));
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;
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;
}
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);
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;
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;
}
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];
/* 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
/* 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];
}
}
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);
/* 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];
}
}
{
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;
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)) {
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;
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;
}
}
/* 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) {
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);
/* 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];
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);
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;
}
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;
}
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;
}
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;
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);
}
/* 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);
}
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;
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;
}
/* 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 ?
}
/* 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 ?
};
#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) \
&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);
{
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];
}
}
#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
};
/**
- * 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
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,
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.
* 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:
* 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;
}
}
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);
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);
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
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) {
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);
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);
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);
{
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;
}
}
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]);
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. */
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;
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;
}
/* 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);
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;
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;
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;
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;
{
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;
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++)
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)