#include "util/u_math.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_info.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
FOR_EACH_CHANNEL( CHAN )\
IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )
-#define CHAN_X 0
-#define CHAN_Y 1
-#define CHAN_Z 2
-#define CHAN_W 3
#define NUM_CHANNELS 4
#define LP_MAX_INSTRUCTIONS 256
break;
case TGSI_OPCODE_LIT:
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ) {
- dst0[CHAN_X] = bld->base.one;
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ) {
+ dst0[TGSI_CHAN_X] = bld->base.one;
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ) {
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
- dst0[CHAN_Y] = lp_build_max( &bld->base, src0, bld->base.zero);
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ) {
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ dst0[TGSI_CHAN_Y] = lp_build_max( &bld->base, src0, bld->base.zero);
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) ) {
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) {
/* XMM[1] = SrcReg[0].yyyy */
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
/* XMM[1] = max(XMM[1], 0) */
tmp1 = lp_build_max( &bld->base, tmp1, bld->base.zero);
/* XMM[2] = SrcReg[0].wwww */
- tmp2 = emit_fetch( bld, inst, 0, CHAN_W );
+ tmp2 = emit_fetch( bld, inst, 0, TGSI_CHAN_W );
tmp1 = lp_build_pow( &bld->base, tmp1, tmp2);
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp2 = lp_build_cmp(&bld->base, PIPE_FUNC_GREATER, tmp0, bld->base.zero);
- dst0[CHAN_Z] = lp_build_select(&bld->base, tmp2, tmp1, bld->base.zero);
+ dst0[TGSI_CHAN_Z] = lp_build_select(&bld->base, tmp2, tmp1, bld->base.zero);
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) ) {
- dst0[CHAN_W] = bld->base.one;
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) ) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
case TGSI_OPCODE_RCP:
/* TGSI_OPCODE_RECIP */
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
res = lp_build_rcp(&bld->base, src0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = res;
case TGSI_OPCODE_RSQ:
/* TGSI_OPCODE_RECIPSQRT */
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
src0 = lp_build_abs(&bld->base, src0);
res = lp_build_rsqrt(&bld->base, src0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
break;
case TGSI_OPCODE_EXP:
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z )) {
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) {
LLVMValueRef *p_exp2_int_part = NULL;
LLVMValueRef *p_frac_part = NULL;
LLVMValueRef *p_exp2 = NULL;
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
p_exp2_int_part = &tmp0;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ))
p_frac_part = &tmp1;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
p_exp2 = &tmp2;
lp_build_exp2_approx(&bld->base, src0, p_exp2_int_part, p_frac_part, p_exp2);
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
- dst0[CHAN_X] = tmp0;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ))
- dst0[CHAN_Y] = tmp1;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
- dst0[CHAN_Z] = tmp2;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
+ dst0[TGSI_CHAN_X] = tmp0;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ))
+ dst0[TGSI_CHAN_Y] = tmp1;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
+ dst0[TGSI_CHAN_Z] = tmp2;
}
/* dst.w = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_W )) {
- dst0[CHAN_W] = bld->base.one;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
case TGSI_OPCODE_LOG:
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z )) {
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) {
LLVMValueRef *p_floor_log2 = NULL;
LLVMValueRef *p_exp = NULL;
LLVMValueRef *p_log2 = NULL;
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
src0 = lp_build_abs( &bld->base, src0 );
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
p_floor_log2 = &tmp0;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ))
p_exp = &tmp1;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
p_log2 = &tmp2;
lp_build_log2_approx(&bld->base, src0, p_exp, p_floor_log2, p_log2);
/* dst.x = floor(lg2(abs(src.x))) */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
- dst0[CHAN_X] = tmp0;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
+ dst0[TGSI_CHAN_X] = tmp0;
/* dst.y = abs(src)/ex2(floor(lg2(abs(src.x)))) */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y )) {
- dst0[CHAN_Y] = lp_build_div( &bld->base, src0, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) {
+ dst0[TGSI_CHAN_Y] = lp_build_div( &bld->base, src0, tmp1);
}
/* dst.z = lg2(abs(src.x)) */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
- dst0[CHAN_Z] = tmp2;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
+ dst0[TGSI_CHAN_Z] = tmp2;
}
/* dst.w = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_W )) {
- dst0[CHAN_W] = bld->base.one;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
case TGSI_OPCODE_DP3:
/* TGSI_OPCODE_DOT3 */
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Z );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Z );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
case TGSI_OPCODE_DP4:
/* TGSI_OPCODE_DOT4 */
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Z );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Z );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_W );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_W );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_W );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_W );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
break;
case TGSI_OPCODE_DST:
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) {
- dst0[CHAN_X] = bld->base.one;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) {
+ dst0[TGSI_CHAN_X] = bld->base.one;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_Y );
- dst0[CHAN_Y] = lp_build_mul( &bld->base, tmp0, tmp1);
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
+ dst0[TGSI_CHAN_Y] = lp_build_mul( &bld->base, tmp0, tmp1);
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) {
- dst0[CHAN_Z] = emit_fetch( bld, inst, 0, CHAN_Z );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) {
+ dst0[TGSI_CHAN_Z] = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) {
- dst0[CHAN_W] = emit_fetch( bld, inst, 1, CHAN_W );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) {
+ dst0[TGSI_CHAN_W] = emit_fetch( bld, inst, 1, TGSI_CHAN_W );
}
break;
break;
case TGSI_OPCODE_DP2A:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X ); /* xmm0 = src[0].x */
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X ); /* xmm1 = src[1].x */
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); /* xmm0 = src[0].x */
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X ); /* xmm1 = src[1].x */
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 * xmm1 */
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y ); /* xmm1 = src[0].y */
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y ); /* xmm2 = src[1].y */
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y ); /* xmm1 = src[0].y */
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y ); /* xmm2 = src[1].y */
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2); /* xmm1 = xmm1 * xmm2 */
tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */
- tmp1 = emit_fetch( bld, inst, 2, CHAN_X ); /* xmm1 = src[2].x */
+ tmp1 = emit_fetch( bld, inst, 2, TGSI_CHAN_X ); /* xmm1 = src[2].x */
tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0; /* dest[ch] = xmm0 */
break;
case TGSI_OPCODE_EX2: {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_exp2( &bld->base, tmp0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
}
case TGSI_OPCODE_LG2:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_log2( &bld->base, tmp0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
break;
case TGSI_OPCODE_POW:
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
- src1 = emit_fetch( bld, inst, 1, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ src1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
res = lp_build_pow( &bld->base, src0, src1 );
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = res;
break;
case TGSI_OPCODE_XPD:
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ) {
- tmp1 = emit_fetch( bld, inst, 1, CHAN_Z );
- tmp3 = emit_fetch( bld, inst, 0, CHAN_Z );
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ) {
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
+ tmp3 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp4 = emit_fetch( bld, inst, 1, CHAN_Y );
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp4 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) {
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) {
tmp2 = tmp0;
tmp2 = lp_build_mul( &bld->base, tmp2, tmp1);
tmp5 = tmp3;
tmp5 = lp_build_mul( &bld->base, tmp5, tmp4);
tmp2 = lp_build_sub( &bld->base, tmp2, tmp5);
- dst0[CHAN_X] = tmp2;
+ dst0[TGSI_CHAN_X] = tmp2;
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) ) {
- tmp2 = emit_fetch( bld, inst, 1, CHAN_X );
- tmp5 = emit_fetch( bld, inst, 0, CHAN_X );
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) {
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
+ tmp5 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) {
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) {
tmp3 = lp_build_mul( &bld->base, tmp3, tmp2);
tmp1 = lp_build_mul( &bld->base, tmp1, tmp5);
tmp3 = lp_build_sub( &bld->base, tmp3, tmp1);
- dst0[CHAN_Y] = tmp3;
+ dst0[TGSI_CHAN_Y] = tmp3;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) {
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) {
tmp5 = lp_build_mul( &bld->base, tmp5, tmp4);
tmp0 = lp_build_mul( &bld->base, tmp0, tmp2);
tmp5 = lp_build_sub( &bld->base, tmp5, tmp0);
- dst0[CHAN_Z] = tmp5;
+ dst0[TGSI_CHAN_Z] = tmp5;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) {
- dst0[CHAN_W] = bld->base.one;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
return FALSE;
case TGSI_OPCODE_DPH:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Z );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Z );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 1, CHAN_W );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_W );
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
break;
case TGSI_OPCODE_COS:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_cos( &bld->base, tmp0 );
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
break;
case TGSI_OPCODE_SIN:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_sin( &bld->base, tmp0 );
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
break;
case TGSI_OPCODE_SCS:
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- dst0[CHAN_X] = lp_build_cos( &bld->base, tmp0 );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ dst0[TGSI_CHAN_X] = lp_build_cos( &bld->base, tmp0 );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- dst0[CHAN_Y] = lp_build_sin( &bld->base, tmp0 );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ dst0[TGSI_CHAN_Y] = lp_build_sin( &bld->base, tmp0 );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) {
- dst0[CHAN_Z] = bld->base.zero;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) {
+ dst0[TGSI_CHAN_Z] = bld->base.zero;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) {
- dst0[CHAN_W] = bld->base.one;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
{
uint dims = (inst->Instruction.Opcode == TGSI_OPCODE_NRM) ? 3 : 4;
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X) ||
- IS_DST0_CHANNEL_ENABLED(inst, CHAN_Y) ||
- IS_DST0_CHANNEL_ENABLED(inst, CHAN_Z) ||
- (IS_DST0_CHANNEL_ENABLED(inst, CHAN_W) && dims == 4)) {
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) ||
+ IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y) ||
+ IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z) ||
+ (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W) && dims == 4)) {
/* NOTE: Cannot use xmm regs 2/3 here (see emit_rsqrt() above). */
/* xmm4 = src.x */
/* xmm0 = src.x * src.x */
- tmp0 = emit_fetch(bld, inst, 0, CHAN_X);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X)) {
+ tmp0 = emit_fetch(bld, inst, 0, TGSI_CHAN_X);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) {
tmp4 = tmp0;
}
tmp0 = lp_build_mul( &bld->base, tmp0, tmp0);
/* xmm5 = src.y */
/* xmm0 = xmm0 + src.y * src.y */
- tmp1 = emit_fetch(bld, inst, 0, CHAN_Y);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Y)) {
+ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_Y);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) {
tmp5 = tmp1;
}
tmp1 = lp_build_mul( &bld->base, tmp1, tmp1);
/* xmm6 = src.z */
/* xmm0 = xmm0 + src.z * src.z */
- tmp1 = emit_fetch(bld, inst, 0, CHAN_Z);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Z)) {
+ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_Z);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) {
tmp6 = tmp1;
}
tmp1 = lp_build_mul( &bld->base, tmp1, tmp1);
if (dims == 4) {
/* xmm7 = src.w */
/* xmm0 = xmm0 + src.w * src.w */
- tmp1 = emit_fetch(bld, inst, 0, CHAN_W);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_W)) {
+ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_W);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) {
tmp7 = tmp1;
}
tmp1 = lp_build_mul( &bld->base, tmp1, tmp1);
tmp1 = lp_build_rsqrt( &bld->base, tmp0);
/* dst.x = xmm1 * src.x */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X)) {
- dst0[CHAN_X] = lp_build_mul( &bld->base, tmp4, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) {
+ dst0[TGSI_CHAN_X] = lp_build_mul( &bld->base, tmp4, tmp1);
}
/* dst.y = xmm1 * src.y */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Y)) {
- dst0[CHAN_Y] = lp_build_mul( &bld->base, tmp5, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) {
+ dst0[TGSI_CHAN_Y] = lp_build_mul( &bld->base, tmp5, tmp1);
}
/* dst.z = xmm1 * src.z */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Z)) {
- dst0[CHAN_Z] = lp_build_mul( &bld->base, tmp6, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) {
+ dst0[TGSI_CHAN_Z] = lp_build_mul( &bld->base, tmp6, tmp1);
}
/* dst.w = xmm1 * src.w */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X) && dims == 4) {
- dst0[CHAN_W] = lp_build_mul( &bld->base, tmp7, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) && dims == 4) {
+ dst0[TGSI_CHAN_W] = lp_build_mul( &bld->base, tmp7, tmp1);
}
}
/* dst.w = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_W) && dims == 3) {
- dst0[CHAN_W] = bld->base.one;
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W) && dims == 3) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
}
break;
break;
case TGSI_OPCODE_DP2:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X ); /* xmm0 = src[0].x */
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X ); /* xmm1 = src[1].x */
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); /* xmm0 = src[0].x */
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X ); /* xmm1 = src[1].x */
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 * xmm1 */
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y ); /* xmm1 = src[0].y */
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y ); /* xmm2 = src[1].y */
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y ); /* xmm1 = src[0].y */
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y ); /* xmm2 = src[1].y */
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2); /* xmm1 = xmm1 * xmm2 */
tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
break;
case TGSI_OPCODE_IF:
- tmp0 = emit_fetch(bld, inst, 0, CHAN_X);
+ tmp0 = emit_fetch(bld, inst, 0, TGSI_CHAN_X);
tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_NOTEQUAL,
tmp0, bld->base.zero);
lp_exec_mask_cond_push(&bld->exec_mask, tmp0);
}
-#define CHAN_X 0
-#define CHAN_Y 1
-#define CHAN_Z 2
-#define CHAN_W 3
-
enum tgsi_exec_datatype {
TGSI_EXEC_DATA_FLOAT,
TGSI_EXEC_DATA_INT,
index2.i[3] = reg->Indirect.Index;
assert(reg->Indirect.File == TGSI_FILE_ADDRESS);
/* get current value of address register[swizzle] */
- swizzle = tgsi_util_get_src_register_swizzle( ®->Indirect, CHAN_X );
+ swizzle = tgsi_util_get_src_register_swizzle( ®->Indirect, TGSI_CHAN_X );
fetch_src_file_channel(mach,
chan_index,
reg->Indirect.File,
index2.i[2] =
index2.i[3] = reg->DimIndirect.Index;
- swizzle = tgsi_util_get_src_register_swizzle( ®->DimIndirect, CHAN_X );
+ swizzle = tgsi_util_get_src_register_swizzle( ®->DimIndirect, TGSI_CHAN_X );
fetch_src_file_channel(mach,
chan_index,
reg->DimIndirect.File,
index.i[3] = reg->Indirect.Index;
/* get current value of address register[swizzle] */
- swizzle = tgsi_util_get_src_register_swizzle( ®->Indirect, CHAN_X );
+ swizzle = tgsi_util_get_src_register_swizzle( ®->Indirect, TGSI_CHAN_X );
/* fetch values from the address/indirection register */
fetch_src_file_channel(mach,
index2.i[2] =
index2.i[3] = reg->DimIndirect.Index;
- swizzle = tgsi_util_get_src_register_swizzle( ®->DimIndirect, CHAN_X );
+ swizzle = tgsi_util_get_src_register_swizzle( ®->DimIndirect, TGSI_CHAN_X );
fetch_src_file_channel(mach,
chan_index,
reg->DimIndirect.File,
union tgsi_exec_channel *pred;
switch (chan_index) {
- case CHAN_X:
+ case TGSI_CHAN_X:
swizzle = inst->Predicate.SwizzleX;
break;
- case CHAN_Y:
+ case TGSI_CHAN_Y:
swizzle = inst->Predicate.SwizzleY;
break;
- case CHAN_Z:
+ case TGSI_CHAN_Z:
swizzle = inst->Predicate.SwizzleZ;
break;
- case CHAN_W:
+ case TGSI_CHAN_W:
swizzle = inst->Predicate.SwizzleW;
break;
default:
uint chan;
if (modifier != TEX_MODIFIER_NONE) {
- FETCH(&r[3], 0, CHAN_W);
+ FETCH(&r[3], 0, TGSI_CHAN_W);
if (modifier != TEX_MODIFIER_PROJECTED) {
lod = &r[3];
}
switch (inst->Texture.Texture) {
case TGSI_TEXTURE_1D:
- FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
&r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
break;
case TGSI_TEXTURE_SHADOW1D:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
break;
case TGSI_TEXTURE_1D_ARRAY:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
&r[0], &r[1], &r[2], &r[3]); /* outputs */
break;
case TGSI_TEXTURE_SHADOW1D_ARRAY:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
break;
case TGSI_TEXTURE_2D_ARRAY:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
break;
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
- FETCH(&r[3], 0, CHAN_W);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
+ FETCH(&r[3], 0, TGSI_CHAN_W);
fetch_texel(mach->Samplers[unit],
&r[0], &r[1], &r[2], &r[3], /* S, T, P, LOD */
break;
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
- FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
fetch_texel(mach->Samplers[unit],
&r[0], &ZeroVec, &ZeroVec, &ZeroVec, /* S, T, P, BIAS */
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
fetch_texel(mach->Samplers[unit],
&r[0], &r[1], &r[2], &ZeroVec, /* inputs */
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
fetch_texel(mach->Samplers[unit],
&r[0], &r[1], &r[2], &ZeroVec,
case TGSI_TEXTURE_SHADOW2D_ARRAY:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
- FETCH(&r[3], 0, CHAN_W);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
+ FETCH(&r[3], 0, TGSI_CHAN_W);
fetch_texel(mach->Samplers[unit],
&r[0], &r[1], &r[2], &r[3],
} else
offsets[0] = offsets[1] = offsets[2] = 0;
- IFETCH(&r[3], 0, CHAN_W);
+ IFETCH(&r[3], 0, TGSI_CHAN_W);
switch(inst->Texture.Texture) {
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
- IFETCH(&r[2], 0, CHAN_Z);
+ IFETCH(&r[2], 0, TGSI_CHAN_Z);
/* fallthrough */
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_1D_ARRAY:
- IFETCH(&r[1], 0, CHAN_Y);
+ IFETCH(&r[1], 0, TGSI_CHAN_Y);
/* fallthrough */
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
- IFETCH(&r[0], 0, CHAN_X);
+ IFETCH(&r[0], 0, TGSI_CHAN_X);
break;
default:
assert(0);
uint chan;
int i,j;
- fetch_source(mach, &src, &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_INT);
+ fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_INT);
sampler = mach->Samplers[unit];
sampler->get_dims(sampler, src.i[0], result);
if (modifier != TEX_MODIFIER_NONE) {
if (modifier == TEX_MODIFIER_LOD_BIAS)
- FETCH(&r[3], 3, CHAN_X);
+ FETCH(&r[3], 3, TGSI_CHAN_X);
else /*TEX_MODIFIER_LOD*/
- FETCH(&r[3], 0, CHAN_W);
+ FETCH(&r[3], 0, TGSI_CHAN_W);
if (modifier != TEX_MODIFIER_PROJECTED) {
lod = &r[3];
switch (mach->Resources[resource_unit].Resource) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
- FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
if (modifier == TEX_MODIFIER_PROJECTED) {
micro_div(&r[0], &r[0], &r[3]);
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
- FETCH(&r[3], 0, CHAN_W);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
+ FETCH(&r[3], 0, TGSI_CHAN_W);
assert(modifier != TEX_MODIFIER_PROJECTED);
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
- FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
fetch_texel(mach->Samplers[sampler_unit],
&r[0], &ZeroVec, &ZeroVec, &ZeroVec, /* S, T, P, BIAS */
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
fetch_texel(mach->Samplers[sampler_unit],
&r[0], &r[1], &r[2], &ZeroVec, /* inputs */
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
- FETCH(&r[0], 0, CHAN_X);
- FETCH(&r[1], 0, CHAN_Y);
- FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
+ FETCH(&r[1], 0, TGSI_CHAN_Y);
+ FETCH(&r[2], 0, TGSI_CHAN_Z);
fetch_texel(mach->Samplers[sampler_unit],
&r[0], &r[1], &r[2], &ZeroVec,
union tgsi_exec_channel src;
union tgsi_exec_channel dst;
- fetch_source(mach, &src, &inst->Src[0], CHAN_X, src_datatype);
+ fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, src_datatype);
op(&dst, &src);
for (chan = 0; chan < NUM_CHANNELS; chan++) {
if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
union tgsi_exec_channel src[2];
union tgsi_exec_channel dst;
- fetch_source(mach, &src[0], &inst->Src[0], CHAN_X, src_datatype);
- fetch_source(mach, &src[1], &inst->Src[1], CHAN_Y, src_datatype);
+ fetch_source(mach, &src[0], &inst->Src[0], TGSI_CHAN_X, src_datatype);
+ fetch_source(mach, &src[1], &inst->Src[1], TGSI_CHAN_Y, src_datatype);
op(&dst, &src[0], &src[1]);
for (chan = 0; chan < NUM_CHANNELS; chan++) {
if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
unsigned int chan;
union tgsi_exec_channel arg[3];
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&arg[2], &arg[0], &arg[1]);
- for (chan = CHAN_Y; chan <= CHAN_Z; chan++) {
+ for (chan = TGSI_CHAN_Y; chan <= TGSI_CHAN_Z; chan++) {
fetch_source(mach, &arg[0], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
fetch_source(mach, &arg[1], &inst->Src[1], chan, TGSI_EXEC_DATA_FLOAT);
micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
unsigned int chan;
union tgsi_exec_channel arg[3];
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&arg[2], &arg[0], &arg[1]);
- for (chan = CHAN_Y; chan <= CHAN_W; chan++) {
+ for (chan = TGSI_CHAN_Y; chan <= TGSI_CHAN_W; chan++) {
fetch_source(mach, &arg[0], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
fetch_source(mach, &arg[1], &inst->Src[1], chan, TGSI_EXEC_DATA_FLOAT);
micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
unsigned int chan;
union tgsi_exec_channel arg[3];
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&arg[2], &arg[0], &arg[1]);
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mad(&arg[0], &arg[0], &arg[1], &arg[2]);
- fetch_source(mach, &arg[1], &inst->Src[2], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[2], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_add(&arg[0], &arg[0], &arg[1]);
for (chan = 0; chan < NUM_CHANNELS; chan++) {
unsigned int chan;
union tgsi_exec_channel arg[3];
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&arg[2], &arg[0], &arg[1]);
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
micro_mad(&arg[0], &arg[0], &arg[1], &arg[2]);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
micro_add(&arg[0], &arg[0], &arg[1]);
for (chan = 0; chan < NUM_CHANNELS; chan++) {
unsigned int chan;
union tgsi_exec_channel arg[3];
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&arg[2], &arg[0], &arg[1]);
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &arg[1], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mad(&arg[2], &arg[0], &arg[1], &arg[2]);
for (chan = 0; chan < NUM_CHANNELS; chan++) {
union tgsi_exec_channel arg[4];
union tgsi_exec_channel scale;
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&scale, &arg[0], &arg[0]);
- for (chan = CHAN_Y; chan <= CHAN_W; chan++) {
+ for (chan = TGSI_CHAN_Y; chan <= TGSI_CHAN_W; chan++) {
union tgsi_exec_channel product;
fetch_source(mach, &arg[chan], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
micro_rsq(&scale, &scale);
- for (chan = CHAN_X; chan <= CHAN_W; chan++) {
+ for (chan = TGSI_CHAN_X; chan <= TGSI_CHAN_W; chan++) {
if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
micro_mul(&arg[chan], &arg[chan], &scale);
store_dest(mach, &arg[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
union tgsi_exec_channel arg[3];
union tgsi_exec_channel scale;
- fetch_source(mach, &arg[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&scale, &arg[0], &arg[0]);
- for (chan = CHAN_Y; chan <= CHAN_Z; chan++) {
+ for (chan = TGSI_CHAN_Y; chan <= TGSI_CHAN_Z; chan++) {
union tgsi_exec_channel product;
fetch_source(mach, &arg[chan], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
micro_rsq(&scale, &scale);
- for (chan = CHAN_X; chan <= CHAN_Z; chan++) {
+ for (chan = TGSI_CHAN_X; chan <= TGSI_CHAN_Z; chan++) {
if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
micro_mul(&arg[chan], &arg[chan], &scale);
store_dest(mach, &arg[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
union tgsi_exec_channel arg;
union tgsi_exec_channel result;
- fetch_source(mach, &arg, &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &arg, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
micro_cos(&result, &arg);
- store_dest(mach, &result, &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &result, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
micro_sin(&result, &arg);
- store_dest(mach, &result, &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &result, &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- store_dest(mach, &ZeroVec, &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &ZeroVec, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
union tgsi_exec_channel r[4];
union tgsi_exec_channel d[2];
- fetch_source(mach, &r[0], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &r[1], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[0], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_XZ) {
- fetch_source(mach, &r[2], &inst->Src[2], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[2], &inst->Src[2], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[2], &r[2], &r[0]);
- fetch_source(mach, &r[3], &inst->Src[2], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[3], &inst->Src[2], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[3], &r[3], &r[1]);
micro_add(&r[2], &r[2], &r[3]);
- fetch_source(mach, &r[3], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[3], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_add(&d[0], &r[2], &r[3]);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_YW) {
- fetch_source(mach, &r[2], &inst->Src[2], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[2], &inst->Src[2], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[2], &r[2], &r[0]);
- fetch_source(mach, &r[3], &inst->Src[2], CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[3], &inst->Src[2], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[3], &r[3], &r[1]);
micro_add(&r[2], &r[2], &r[3]);
- fetch_source(mach, &r[3], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[3], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_add(&d[1], &r[2], &r[3]);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
- store_dest(mach, &d[0], &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[0], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
- store_dest(mach, &d[1], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[1], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- store_dest(mach, &d[0], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[0], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &d[1], &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[1], &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_XYZ) {
/* r0 = dp3(src0, src0) */
- fetch_source(mach, &r[2], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[2], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[0], &r[2], &r[2]);
- fetch_source(mach, &r[4], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[4], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[8], &r[4], &r[4]);
micro_add(&r[0], &r[0], &r[8]);
- fetch_source(mach, &r[6], &inst->Src[0], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[6], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[8], &r[6], &r[6]);
micro_add(&r[0], &r[0], &r[8]);
/* r1 = dp3(src0, src1) */
- fetch_source(mach, &r[3], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[3], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[1], &r[2], &r[3]);
- fetch_source(mach, &r[5], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[5], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[8], &r[4], &r[5]);
micro_add(&r[1], &r[1], &r[8]);
- fetch_source(mach, &r[7], &inst->Src[1], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[7], &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[8], &r[6], &r[7]);
micro_add(&r[1], &r[1], &r[8]);
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
micro_mul(&r[2], &r[2], &r[1]);
micro_sub(&r[2], &r[2], &r[3]);
- store_dest(mach, &r[2], &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
micro_mul(&r[4], &r[4], &r[1]);
micro_sub(&r[4], &r[4], &r[5]);
- store_dest(mach, &r[4], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[4], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
micro_mul(&r[6], &r[6], &r[1]);
micro_sub(&r[6], &r[6], &r[7]);
- store_dest(mach, &r[6], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[6], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
union tgsi_exec_channel r[6];
union tgsi_exec_channel d[3];
- fetch_source(mach, &r[0], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &r[1], &inst->Src[1], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[2], &r[0], &r[1]);
- fetch_source(mach, &r[3], &inst->Src[0], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &r[4], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[3], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[4], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[5], &r[3], &r[4] );
- micro_sub(&d[CHAN_X], &r[2], &r[5]);
+ micro_sub(&d[TGSI_CHAN_X], &r[2], &r[5]);
- fetch_source(mach, &r[2], &inst->Src[1], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[2], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[3], &r[3], &r[2]);
- fetch_source(mach, &r[5], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[5], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_mul(&r[1], &r[1], &r[5]);
- micro_sub(&d[CHAN_Y], &r[3], &r[1]);
+ micro_sub(&d[TGSI_CHAN_Y], &r[3], &r[1]);
micro_mul(&r[5], &r[5], &r[4]);
micro_mul(&r[0], &r[0], &r[2]);
- micro_sub(&d[CHAN_Z], &r[5], &r[0]);
+ micro_sub(&d[TGSI_CHAN_Z], &r[5], &r[0]);
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
- store_dest(mach, &d[CHAN_X], &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[TGSI_CHAN_X], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
- store_dest(mach, &d[CHAN_Y], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- store_dest(mach, &d[CHAN_Z], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
union tgsi_exec_channel d[4];
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
- fetch_source(mach, &r[0], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
- fetch_source(mach, &r[1], &inst->Src[1], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
- micro_mul(&d[CHAN_Y], &r[0], &r[1]);
+ fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ micro_mul(&d[TGSI_CHAN_Y], &r[0], &r[1]);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- fetch_source(mach, &d[CHAN_Z], &inst->Src[0], CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &d[TGSI_CHAN_Z], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- fetch_source(mach, &d[CHAN_W], &inst->Src[1], CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &d[TGSI_CHAN_W], &inst->Src[1], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
- store_dest(mach, &d[CHAN_Y], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- store_dest(mach, &d[CHAN_Z], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &d[CHAN_W], &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &d[TGSI_CHAN_W], &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
{
union tgsi_exec_channel r[3];
- fetch_source(mach, &r[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_abs(&r[2], &r[0]); /* r2 = abs(r0) */
micro_lg2(&r[1], &r[2]); /* r1 = lg2(r2) */
micro_flr(&r[0], &r[1]); /* r0 = floor(r1) */
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
- store_dest(mach, &r[0], &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
micro_exp2(&r[0], &r[0]); /* r0 = 2 ^ r0 */
micro_div(&r[0], &r[2], &r[0]); /* r0 = r2 / r0 */
- store_dest(mach, &r[0], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- store_dest(mach, &r[1], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[1], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
{
union tgsi_exec_channel r[3];
- fetch_source(mach, &r[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
micro_flr(&r[1], &r[0]); /* r1 = floor(r0) */
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
micro_exp2(&r[2], &r[1]); /* r2 = 2 ^ r1 */
- store_dest(mach, &r[2], &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
micro_sub(&r[2], &r[0], &r[1]); /* r2 = r0 - r1 */
- store_dest(mach, &r[2], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
micro_exp2(&r[2], &r[0]); /* r2 = 2 ^ r0 */
- store_dest(mach, &r[2], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
union tgsi_exec_channel d[3];
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_YZ) {
- fetch_source(mach, &r[0], &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
- fetch_source(mach, &r[1], &inst->Src[0], CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[1], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
micro_max(&r[1], &r[1], &ZeroVec);
- fetch_source(mach, &r[2], &inst->Src[0], CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &r[2], &inst->Src[0], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
micro_min(&r[2], &r[2], &P128Vec);
micro_max(&r[2], &r[2], &M128Vec);
micro_pow(&r[1], &r[1], &r[2]);
- micro_lt(&d[CHAN_Z], &ZeroVec, &r[0], &r[1], &ZeroVec);
- store_dest(mach, &d[CHAN_Z], &inst->Dst[0], inst, CHAN_Z, TGSI_EXEC_DATA_FLOAT);
+ micro_lt(&d[TGSI_CHAN_Z], &ZeroVec, &r[0], &r[1], &ZeroVec);
+ store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) {
- micro_max(&d[CHAN_Y], &r[0], &ZeroVec);
- store_dest(mach, &d[CHAN_Y], &inst->Dst[0], inst, CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+ micro_max(&d[TGSI_CHAN_Y], &r[0], &ZeroVec);
+ store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
}
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
}
if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
- store_dest(mach, &OneVec, &inst->Dst[0], inst, CHAN_W, TGSI_EXEC_DATA_FLOAT);
+ store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
}
}
assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
mach->SwitchStack[mach->SwitchStackTop++] = mach->Switch;
- fetch_source(mach, &mach->Switch.selector, &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_UINT);
+ fetch_source(mach, &mach->Switch.selector, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
mach->Switch.mask = 0x0;
mach->Switch.defaultMask = 0x0;
union tgsi_exec_channel src;
uint mask = 0;
- fetch_source(mach, &src, &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_UINT);
+ fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
if (mach->Switch.selector.u[0] == src.u[0]) {
mask |= 0x1;
/* push CondMask */
assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
mach->CondStack[mach->CondStackTop++] = mach->CondMask;
- FETCH( &r[0], 0, CHAN_X );
+ FETCH( &r[0], 0, TGSI_CHAN_X );
/* update CondMask */
if( ! r[0].u[0] ) {
mach->CondMask &= ~0x1;
break;
case TGSI_OPCODE_BREAKC:
- FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[0], 0, TGSI_CHAN_X);
/* update CondMask */
if (r[0].u[0] && (mach->ExecMask & 0x1)) {
mach->LoopMask &= ~0x1;
FOR_EACH_CHANNEL( CHAN )\
IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )
-#define CHAN_X 0
-#define CHAN_Y 1
-#define CHAN_Z 2
-#define CHAN_W 3
-
-
/**
* How many TGSI temps should be implemented with real PPC vector registers
* rather than memory.
int v0, v1;
uint chan_index;
- v0 = get_src_vec(gen, inst, 0, CHAN_X);
+ v0 = get_src_vec(gen, inst, 0, TGSI_CHAN_X);
v1 = ppc_allocate_vec_register(gen->f);
switch (inst->Instruction.Opcode) {
ppc_vzero(gen->f, v2); /* v2 = {0, 0, 0, 0} */
- v0 = get_src_vec(gen, inst, 0, CHAN_X); /* v0 = src0.XXXX */
- v1 = get_src_vec(gen, inst, 1, CHAN_X); /* v1 = src1.XXXX */
+ v0 = get_src_vec(gen, inst, 0, TGSI_CHAN_X); /* v0 = src0.XXXX */
+ v1 = get_src_vec(gen, inst, 1, TGSI_CHAN_X); /* v1 = src1.XXXX */
ppc_vmaddfp(gen->f, v2, v0, v1, v2); /* v2 = v0 * v1 + v2 */
- v0 = get_src_vec(gen, inst, 0, CHAN_Y); /* v0 = src0.YYYY */
- v1 = get_src_vec(gen, inst, 1, CHAN_Y); /* v1 = src1.YYYY */
+ v0 = get_src_vec(gen, inst, 0, TGSI_CHAN_Y); /* v0 = src0.YYYY */
+ v1 = get_src_vec(gen, inst, 1, TGSI_CHAN_Y); /* v1 = src1.YYYY */
ppc_vmaddfp(gen->f, v2, v0, v1, v2); /* v2 = v0 * v1 + v2 */
- v0 = get_src_vec(gen, inst, 0, CHAN_Z); /* v0 = src0.ZZZZ */
- v1 = get_src_vec(gen, inst, 1, CHAN_Z); /* v1 = src1.ZZZZ */
+ v0 = get_src_vec(gen, inst, 0, TGSI_CHAN_Z); /* v0 = src0.ZZZZ */
+ v1 = get_src_vec(gen, inst, 1, TGSI_CHAN_Z); /* v1 = src1.ZZZZ */
ppc_vmaddfp(gen->f, v2, v0, v1, v2); /* v2 = v0 * v1 + v2 */
if (inst->Instruction.Opcode == TGSI_OPCODE_DP4) {
- v0 = get_src_vec(gen, inst, 0, CHAN_W); /* v0 = src0.WWWW */
- v1 = get_src_vec(gen, inst, 1, CHAN_W); /* v1 = src1.WWWW */
+ v0 = get_src_vec(gen, inst, 0, TGSI_CHAN_W); /* v0 = src0.WWWW */
+ v1 = get_src_vec(gen, inst, 1, TGSI_CHAN_W); /* v1 = src1.WWWW */
ppc_vmaddfp(gen->f, v2, v0, v1, v2); /* v2 = v0 * v1 + v2 */
}
else if (inst->Instruction.Opcode == TGSI_OPCODE_DPH) {
- v1 = get_src_vec(gen, inst, 1, CHAN_W); /* v1 = src1.WWWW */
+ v1 = get_src_vec(gen, inst, 1, TGSI_CHAN_W); /* v1 = src1.WWWW */
ppc_vaddfp(gen->f, v2, v2, v1); /* v2 = v2 + v1 */
}
int one_vec = gen_one_vec(gen);
/* Compute X */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X)) {
- emit_store(gen, one_vec, inst, CHAN_X, FALSE);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X)) {
+ emit_store(gen, one_vec, inst, TGSI_CHAN_X, FALSE);
}
/* Compute Y, Z */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y) ||
- IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y) ||
+ IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) {
int x_vec;
int zero_vec = ppc_allocate_vec_register(gen->f);
- x_vec = get_src_vec(gen, inst, 0, CHAN_X); /* x_vec = src[0].x */
+ x_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X); /* x_vec = src[0].x */
ppc_vzero(gen->f, zero_vec); /* zero = {0,0,0,0} */
ppc_vmaxfp(gen->f, x_vec, x_vec, zero_vec); /* x_vec = max(x_vec, 0) */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) {
- emit_store(gen, x_vec, inst, CHAN_Y, FALSE);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) {
+ emit_store(gen, x_vec, inst, TGSI_CHAN_Y, FALSE);
}
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) {
int y_vec, w_vec;
int z_vec = ppc_allocate_vec_register(gen->f);
int pow_vec = ppc_allocate_vec_register(gen->f);
int p128_vec = ppc_allocate_vec_register(gen->f);
int n128_vec = ppc_allocate_vec_register(gen->f);
- y_vec = get_src_vec(gen, inst, 0, CHAN_Y); /* y_vec = src[0].y */
+ y_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_Y); /* y_vec = src[0].y */
ppc_vmaxfp(gen->f, y_vec, y_vec, zero_vec); /* y_vec = max(y_vec, 0) */
- w_vec = get_src_vec(gen, inst, 0, CHAN_W); /* w_vec = src[0].w */
+ w_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_W); /* w_vec = src[0].w */
/* clamp W to [-128, 128] */
load_constant_vec(gen, p128_vec, 128.0f);
ppc_vcmpgtfpx(gen->f, pos_vec, x_vec, zero_vec); /* pos = x > 0 */
ppc_vand(gen->f, z_vec, pow_vec, pos_vec); /* z = pow & pos */
- emit_store(gen, z_vec, inst, CHAN_Z, FALSE);
+ emit_store(gen, z_vec, inst, TGSI_CHAN_Z, FALSE);
ppc_release_vec_register(gen->f, z_vec);
ppc_release_vec_register(gen->f, pow_vec);
}
/* Compute W */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_W)) {
- emit_store(gen, one_vec, inst, CHAN_W, FALSE);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_W)) {
+ emit_store(gen, one_vec, inst, TGSI_CHAN_W, FALSE);
}
release_src_vecs(gen);
int src_vec;
/* get src arg */
- src_vec = get_src_vec(gen, inst, 0, CHAN_X);
+ src_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X);
/* Compute X = 2^floor(src) */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X)) {
- int dst_vec = get_dst_vec(gen, inst, CHAN_X);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X)) {
+ int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_X);
int tmp_vec = ppc_allocate_vec_register(gen->f);
ppc_vrfim(gen->f, tmp_vec, src_vec); /* tmp = floor(src); */
ppc_vexptefp(gen->f, dst_vec, tmp_vec); /* dst = 2 ^ tmp */
- emit_store(gen, dst_vec, inst, CHAN_X, TRUE);
+ emit_store(gen, dst_vec, inst, TGSI_CHAN_X, TRUE);
ppc_release_vec_register(gen->f, tmp_vec);
}
/* Compute Y = src - floor(src) */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) {
- int dst_vec = get_dst_vec(gen, inst, CHAN_Y);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) {
+ int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_Y);
int tmp_vec = ppc_allocate_vec_register(gen->f);
ppc_vrfim(gen->f, tmp_vec, src_vec); /* tmp = floor(src); */
ppc_vsubfp(gen->f, dst_vec, src_vec, tmp_vec); /* dst = src - tmp */
- emit_store(gen, dst_vec, inst, CHAN_Y, TRUE);
+ emit_store(gen, dst_vec, inst, TGSI_CHAN_Y, TRUE);
ppc_release_vec_register(gen->f, tmp_vec);
}
/* Compute Z = RoughApprox2ToX(src) */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) {
- int dst_vec = get_dst_vec(gen, inst, CHAN_Z);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) {
+ int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_Z);
ppc_vexptefp(gen->f, dst_vec, src_vec); /* dst = 2 ^ src */
- emit_store(gen, dst_vec, inst, CHAN_Z, TRUE);
+ emit_store(gen, dst_vec, inst, TGSI_CHAN_Z, TRUE);
}
/* Compute W = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_W)) {
- emit_store(gen, one_vec, inst, CHAN_W, FALSE);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_W)) {
+ emit_store(gen, one_vec, inst, TGSI_CHAN_W, FALSE);
}
release_src_vecs(gen);
int src_vec, abs_vec;
/* get src arg */
- src_vec = get_src_vec(gen, inst, 0, CHAN_X);
+ src_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X);
/* compute abs(src) */
abs_vec = ppc_allocate_vec_register(gen->f);
ppc_vandc(gen->f, abs_vec, src_vec, bit31_vec); /* abs = src & ~bit31 */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X) &&
- IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) &&
+ IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) {
/* compute tmp = floor(log2(abs)) */
int tmp_vec = ppc_allocate_vec_register(gen->f);
ppc_vrfim(gen->f, tmp_vec, tmp_vec); /* tmp = floor(tmp); */
/* Compute X = tmp */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X)) {
- emit_store(gen, tmp_vec, inst, CHAN_X, FALSE);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X)) {
+ emit_store(gen, tmp_vec, inst, TGSI_CHAN_X, FALSE);
}
/* Compute Y = abs / 2^tmp */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) {
const int zero_vec = ppc_allocate_vec_register(gen->f);
ppc_vzero(gen->f, zero_vec);
ppc_vexptefp(gen->f, tmp_vec, tmp_vec); /* tmp = 2 ^ tmp */
ppc_vrefp(gen->f, tmp_vec, tmp_vec); /* tmp = 1 / tmp */
/* tmp = abs * tmp + zero */
ppc_vmaddfp(gen->f, tmp_vec, abs_vec, tmp_vec, zero_vec);
- emit_store(gen, tmp_vec, inst, CHAN_Y, FALSE);
+ emit_store(gen, tmp_vec, inst, TGSI_CHAN_Y, FALSE);
ppc_release_vec_register(gen->f, zero_vec);
}
}
/* Compute Z = RoughApproxLog2(abs) */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) {
- int dst_vec = get_dst_vec(gen, inst, CHAN_Z);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) {
+ int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_Z);
ppc_vlogefp(gen->f, dst_vec, abs_vec); /* dst = log2(abs) */
- emit_store(gen, dst_vec, inst, CHAN_Z, TRUE);
+ emit_store(gen, dst_vec, inst, TGSI_CHAN_Z, TRUE);
}
/* Compute W = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_W)) {
- emit_store(gen, one_vec, inst, CHAN_W, FALSE);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_W)) {
+ emit_store(gen, one_vec, inst, TGSI_CHAN_W, FALSE);
}
ppc_release_vec_register(gen->f, abs_vec);
static void
emit_pow(struct gen_context *gen, struct tgsi_full_instruction *inst)
{
- int s0_vec = get_src_vec(gen, inst, 0, CHAN_X);
- int s1_vec = get_src_vec(gen, inst, 1, CHAN_X);
+ int s0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X);
+ int s1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_X);
int pow_vec = ppc_allocate_vec_register(gen->f);
int chan;
tmp_vec = ppc_allocate_vec_register(gen->f);
tmp2_vec = ppc_allocate_vec_register(gen->f);
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y) ||
- IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) {
- x0_vec = get_src_vec(gen, inst, 0, CHAN_X);
- x1_vec = get_src_vec(gen, inst, 1, CHAN_X);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y) ||
+ IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) {
+ x0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X);
+ x1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_X);
}
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X) ||
- IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) {
- y0_vec = get_src_vec(gen, inst, 0, CHAN_Y);
- y1_vec = get_src_vec(gen, inst, 1, CHAN_Y);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) ||
+ IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) {
+ y0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_Y);
+ y1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_Y);
}
- if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X) ||
- IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) {
- z0_vec = get_src_vec(gen, inst, 0, CHAN_Z);
- z1_vec = get_src_vec(gen, inst, 1, CHAN_Z);
+ if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) ||
+ IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) {
+ z0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_Z);
+ z1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_Z);
}
- IF_IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X) {
+ IF_IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) {
/* tmp = y0 * z1 */
ppc_vmaddfp(gen->f, tmp_vec, y0_vec, z1_vec, zero_vec);
/* tmp = tmp - z0 * y1*/
ppc_vnmsubfp(gen->f, tmp_vec, tmp_vec, z0_vec, y1_vec);
- emit_store(gen, tmp_vec, inst, CHAN_X, FALSE);
+ emit_store(gen, tmp_vec, inst, TGSI_CHAN_X, FALSE);
}
- IF_IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y) {
+ IF_IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y) {
/* tmp = z0 * x1 */
ppc_vmaddfp(gen->f, tmp_vec, z0_vec, x1_vec, zero_vec);
/* tmp = tmp - x0 * z1 */
ppc_vnmsubfp(gen->f, tmp_vec, tmp_vec, x0_vec, z1_vec);
- emit_store(gen, tmp_vec, inst, CHAN_Y, FALSE);
+ emit_store(gen, tmp_vec, inst, TGSI_CHAN_Y, FALSE);
}
- IF_IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z) {
+ IF_IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z) {
/* tmp = x0 * y1 */
ppc_vmaddfp(gen->f, tmp_vec, x0_vec, y1_vec, zero_vec);
/* tmp = tmp - y0 * x1 */
ppc_vnmsubfp(gen->f, tmp_vec, tmp_vec, y0_vec, x1_vec);
- emit_store(gen, tmp_vec, inst, CHAN_Z, FALSE);
+ emit_store(gen, tmp_vec, inst, TGSI_CHAN_Z, FALSE);
}
/* W is undefined */