diff options
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 291 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 345 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ppc.c | 140 |
4 files changed, 385 insertions, 395 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 40744e3bc91..84a26761dbd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -42,6 +42,7 @@ #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" @@ -75,10 +76,6 @@ 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 @@ -1432,33 +1429,33 @@ emit_instruction( 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; @@ -1467,7 +1464,7 @@ emit_instruction( 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 ) { @@ -1476,71 +1473,71 @@ emit_instruction( 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; @@ -1562,15 +1559,15 @@ emit_instruction( 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 ) { @@ -1580,19 +1577,19 @@ emit_instruction( 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 ) { @@ -1601,19 +1598,19 @@ emit_instruction( 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; @@ -1696,14 +1693,14 @@ emit_instruction( 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 */ @@ -1745,7 +1742,7 @@ emit_instruction( 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; @@ -1754,7 +1751,7 @@ emit_instruction( } 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; @@ -1762,8 +1759,8 @@ emit_instruction( 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; @@ -1771,43 +1768,43 @@ emit_instruction( 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; @@ -1824,18 +1821,18 @@ emit_instruction( 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; @@ -1843,7 +1840,7 @@ emit_instruction( 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; @@ -1917,7 +1914,7 @@ emit_instruction( 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; @@ -2044,19 +2041,19 @@ emit_instruction( 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; @@ -2071,25 +2068,25 @@ emit_instruction( { 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); @@ -2097,8 +2094,8 @@ emit_instruction( /* 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); @@ -2107,8 +2104,8 @@ emit_instruction( 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); @@ -2119,29 +2116,29 @@ emit_instruction( 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; @@ -2153,11 +2150,11 @@ emit_instruction( 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 ) { @@ -2178,7 +2175,7 @@ emit_instruction( 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); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index c0bd2d04cd7..3774b610aec 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -467,11 +467,6 @@ micro_trunc(union tgsi_exec_channel *dst, } -#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, @@ -1230,7 +1225,7 @@ fetch_source(const struct tgsi_exec_machine *mach, 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, @@ -1290,7 +1285,7 @@ fetch_source(const struct tgsi_exec_machine *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, @@ -1394,7 +1389,7 @@ store_dest(struct tgsi_exec_machine *mach, 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, @@ -1446,7 +1441,7 @@ store_dest(struct tgsi_exec_machine *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, @@ -1538,16 +1533,16 @@ store_dest(struct tgsi_exec_machine *mach, 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: @@ -1762,7 +1757,7 @@ exec_tex(struct tgsi_exec_machine *mach, 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]; } @@ -1776,7 +1771,7 @@ exec_tex(struct tgsi_exec_machine *mach, 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]); @@ -1788,8 +1783,8 @@ exec_tex(struct tgsi_exec_machine *mach, &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]); @@ -1805,9 +1800,9 @@ exec_tex(struct tgsi_exec_machine *mach, 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]); @@ -1822,8 +1817,8 @@ exec_tex(struct tgsi_exec_machine *mach, 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]); @@ -1835,9 +1830,9 @@ exec_tex(struct tgsi_exec_machine *mach, &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]); @@ -1850,9 +1845,9 @@ exec_tex(struct tgsi_exec_machine *mach, 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]); @@ -1866,10 +1861,10 @@ exec_tex(struct tgsi_exec_machine *mach, 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 */ @@ -1878,9 +1873,9 @@ exec_tex(struct tgsi_exec_machine *mach, 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]); @@ -1932,7 +1927,7 @@ exec_txd(struct tgsi_exec_machine *mach, 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 */ @@ -1947,9 +1942,9 @@ exec_txd(struct tgsi_exec_machine *mach, 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 */ @@ -1961,9 +1956,9 @@ exec_txd(struct tgsi_exec_machine *mach, 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, @@ -1973,10 +1968,10 @@ exec_txd(struct tgsi_exec_machine *mach, 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], @@ -2024,13 +2019,13 @@ exec_txf(struct tgsi_exec_machine *mach, } 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: @@ -2038,11 +2033,11 @@ exec_txf(struct tgsi_exec_machine *mach, 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); @@ -2078,7 +2073,7 @@ exec_txq(struct tgsi_exec_machine *mach, 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); @@ -2111,9 +2106,9 @@ exec_sample(struct tgsi_exec_machine *mach, 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]; @@ -2129,7 +2124,7 @@ exec_sample(struct tgsi_exec_machine *mach, 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]); @@ -2147,9 +2142,9 @@ exec_sample(struct tgsi_exec_machine *mach, 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]); @@ -2166,9 +2161,9 @@ exec_sample(struct tgsi_exec_machine *mach, 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]); @@ -2184,10 +2179,10 @@ exec_sample(struct tgsi_exec_machine *mach, 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); @@ -2224,7 +2219,7 @@ exec_sample_d(struct tgsi_exec_machine *mach, 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 */ @@ -2237,9 +2232,9 @@ exec_sample_d(struct tgsi_exec_machine *mach, 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 */ @@ -2250,9 +2245,9 @@ exec_sample_d(struct tgsi_exec_machine *mach, 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, @@ -2449,7 +2444,7 @@ exec_scalar_unary(struct tgsi_exec_machine *mach, 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)) { @@ -2498,8 +2493,8 @@ exec_scalar_binary(struct tgsi_exec_machine *mach, 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)) { @@ -2573,11 +2568,11 @@ exec_dp3(struct tgsi_exec_machine *mach, 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]); @@ -2597,11 +2592,11 @@ exec_dp4(struct tgsi_exec_machine *mach, 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]); @@ -2621,15 +2616,15 @@ exec_dp2a(struct tgsi_exec_machine *mach, 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++) { @@ -2646,19 +2641,19 @@ exec_dph(struct tgsi_exec_machine *mach, 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++) { @@ -2675,12 +2670,12 @@ exec_dp2(struct tgsi_exec_machine *mach, 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++) { @@ -2698,10 +2693,10 @@ exec_nrm4(struct tgsi_exec_machine *mach, 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); @@ -2711,7 +2706,7 @@ exec_nrm4(struct tgsi_exec_machine *mach, 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); @@ -2728,10 +2723,10 @@ exec_nrm3(struct tgsi_exec_machine *mach, 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); @@ -2741,7 +2736,7 @@ exec_nrm3(struct tgsi_exec_machine *mach, 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); @@ -2750,7 +2745,7 @@ exec_nrm3(struct tgsi_exec_machine *mach, } 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); } } @@ -2762,22 +2757,22 @@ exec_scs(struct tgsi_exec_machine *mach, 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); } } @@ -2788,37 +2783,37 @@ exec_x2d(struct tgsi_exec_machine *mach, 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); } } @@ -2830,22 +2825,22 @@ exec_rfl(struct tgsi_exec_machine *mach, 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]); @@ -2856,21 +2851,21 @@ exec_rfl(struct tgsi_exec_machine *mach, 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); } } @@ -2881,41 +2876,41 @@ exec_xpd(struct tgsi_exec_machine *mach, 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); } } @@ -2927,28 +2922,28 @@ exec_dst(struct tgsi_exec_machine *mach, 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); } } @@ -2958,23 +2953,23 @@ exec_log(struct tgsi_exec_machine *mach, { 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); } } @@ -2984,22 +2979,22 @@ exec_exp(struct tgsi_exec_machine *mach, { 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); } } @@ -3011,29 +3006,29 @@ exec_lit(struct tgsi_exec_machine *mach, 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); } } @@ -3062,7 +3057,7 @@ exec_switch(struct tgsi_exec_machine *mach, 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; @@ -3080,7 +3075,7 @@ exec_case(struct tgsi_exec_machine *mach, 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; @@ -3839,7 +3834,7 @@ exec_instruction( /* 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; @@ -4037,7 +4032,7 @@ exec_instruction( 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; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 2fd1f97d06f..63c7087856b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -37,6 +37,10 @@ extern "C" { #endif +#define TGSI_CHAN_X 0 +#define TGSI_CHAN_Y 1 +#define TGSI_CHAN_Z 2 +#define TGSI_CHAN_W 3 #define NUM_CHANNELS 4 /* R,G,B,A */ #define QUAD_SIZE 4 /* 4 pixel/quad */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index 537a0f6c5e4..36400c7fe68 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -70,12 +70,6 @@ ppc_builtin_constants[] = { 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. @@ -573,7 +567,7 @@ emit_scalar_unaryop(struct gen_context *gen, struct tgsi_full_instruction *inst) 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) { @@ -790,25 +784,25 @@ emit_dotprod(struct gen_context *gen, struct tgsi_full_instruction *inst) 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 */ } @@ -847,26 +841,26 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) 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); @@ -874,10 +868,10 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) 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); @@ -894,7 +888,7 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) 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); @@ -907,8 +901,8 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) } /* 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); @@ -922,38 +916,38 @@ emit_exp(struct gen_context *gen, struct tgsi_full_instruction *inst) 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); @@ -968,14 +962,14 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) 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); @@ -983,19 +977,19 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) 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); } @@ -1003,15 +997,15 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) } /* 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); @@ -1022,8 +1016,8 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) 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; @@ -1053,42 +1047,42 @@ emit_xpd(struct gen_context *gen, struct tgsi_full_instruction *inst) 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 */ |