Home | History | Annotate | Download | only in tgsi

Lines Matching refs:MACH

488 #define UPDATE_EXEC_MASK(MACH) \
489 MACH->ExecMask = MACH->CondMask & MACH->LoopMask & MACH->ContMask & MACH->Switch.mask & MACH->FuncMask
536 print_temp(const struct tgsi_exec_machine *mach, uint index)
538 const struct tgsi_exec_vector *tmp = &mach->Temps[index];
554 tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
562 mach->Consts[i] = bufs[i];
563 mach->ConstsSize[i] = buf_sizes[i];
629 struct tgsi_exec_machine *mach,
651 mach->Tokens = tokens;
652 mach->Samplers = samplers;
656 if (mach->Declarations) {
657 FREE( mach->Declarations );
659 mach->Declarations = NULL;
660 mach->NumDeclarations = 0;
662 if (mach->Instructions) {
663 FREE( mach->Instructions );
665 mach->Instructions = NULL;
666 mach->NumInstructions = 0;
671 k = tgsi_parse_init (&parse, mach->Tokens);
677 mach->Processor = parse.FullHeader.Processor.Processor;
678 mach->ImmLimit = 0;
680 if (mach->Processor == TGSI_PROCESSOR_GEOMETRY &&
681 !mach->UsedGeometryShader) {
700 align_free(mach->Inputs);
701 align_free(mach->Outputs);
703 mach->Inputs = inputs;
704 mach->Outputs = outputs;
705 mach->UsedGeometryShader = TRUE;
743 ++mach->NumOutputs;
755 mach->ImmArray[reg][i] = decl->ImmediateData.u[idx].Float;
769 assert( mach->ImmLimit + 1 <= TGSI_EXEC_NUM_IMMEDIATES );
772 mach->Imms[mach->ImmLimit][i] =
775 mach->ImmLimit += 1;
807 if (mach->Declarations) {
808 FREE( mach->Declarations );
810 mach->Declarations = declarations;
811 mach->NumDeclarations = numDeclarations;
813 if (mach->Instructions) {
814 FREE( mach->Instructions );
816 mach->Instructions = instructions;
817 mach->NumInstructions = numInstructions;
824 struct tgsi_exec_machine *mach;
827 mach = align_malloc( sizeof *mach, 16 );
828 if (!mach)
831 memset(mach, 0, sizeof(*mach));
833 mach->Addrs = &mach->Temps[TGSI_EXEC_TEMP_ADDR];
834 mach->MaxGeometryShaderOutputs = TGSI_MAX_TOTAL_VERTICES;
835 mach->Predicates = &mach->Temps[TGSI_EXEC_TEMP_P0];
837 mach->Inputs = align_malloc(sizeof(struct tgsi_exec_vector) * PIPE_MAX_ATTRIBS, 16);
838 mach->Outputs = align_malloc(sizeof(struct tgsi_exec_vector) * PIPE_MAX_ATTRIBS, 16);
839 if (!mach->Inputs || !mach->Outputs)
844 mach->Temps[TGSI_EXEC_TEMP_00000000_I].xyzw[TGSI_EXEC_TEMP_00000000_C].u[i] = 0x00000000;
845 mach->Temps[TGSI_EXEC_TEMP_7FFFFFFF_I].xyzw[TGSI_EXEC_TEMP_7FFFFFFF_C].u[i] = 0x7FFFFFFF;
846 mach->Temps[TGSI_EXEC_TEMP_80000000_I].xyzw[TGSI_EXEC_TEMP_80000000_C].u[i] = 0x80000000;
847 mach->Temps[TGSI_EXEC_TEMP_FFFFFFFF_I].xyzw[TGSI_EXEC_TEMP_FFFFFFFF_C].u[i] = 0xFFFFFFFF; /* not used */
848 mach->Temps[TGSI_EXEC_TEMP_ONE_I].xyzw[TGSI_EXEC_TEMP_ONE_C].f[i] = 1.0f;
849 mach->Temps[TGSI_EXEC_TEMP_TWO_I].xyzw[TGSI_EXEC_TEMP_TWO_C].f[i] = 2.0f; /* not used */
850 mach->Temps[TGSI_EXEC_TEMP_128_I].xyzw[TGSI_EXEC_TEMP_128_C].f[i] = 128.0f;
851 mach->Temps[TGSI_EXEC_TEMP_MINUS_128_I].xyzw[TGSI_EXEC_TEMP_MINUS_128_C].f[i] = -128.0f;
852 mach->Temps[TGSI_EXEC_TEMP_THREE_I].xyzw[TGSI_EXEC_TEMP_THREE_C].f[i] = 3.0f;
853 mach->Temps[TGSI_EXEC_TEMP_HALF_I].xyzw[TGSI_EXEC_TEMP_HALF_C].f[i] = 0.5f;
862 return mach;
865 if (mach) {
866 align_free(mach->Inputs);
867 align_free(mach->Outputs);
868 align_free(mach);
875 tgsi_exec_machine_destroy(struct tgsi_exec_machine *mach)
877 if (mach) {
878 if (mach->Instructions)
879 FREE(mach->Instructions);
880 if (mach->Declarations)
881 FREE(mach->Declarations);
883 align_free(mach->Inputs);
884 align_free(mach->Outputs);
886 align_free(mach);
1044 fetch_src_file_channel(const struct tgsi_exec_machine *mach,
1060 assert(mach->Consts[index2D->i[i]]);
1067 const uint *buf = (const uint *)mach->Consts[constbuf];
1070 if (pos < 0 || pos >= mach->ConstsSize[constbuf]) {
1089 if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
1097 chan->u[i] = mach->Inputs[pos].xyzw[swizzle].u[i];
1106 chan->u[i] = mach->SystemValue[index->i[i]].u[i];
1115 chan->u[i] = mach->Temps[index->i[i]].xyzw[swizzle].u[i];
1125 mach->TempArray[index2D->i[i]][index->i[i]].xyzw[swizzle].u[i];
1131 assert(index->i[i] >= 0 && index->i[i] < (int)mach->ImmLimit);
1134 chan->f[i] = mach->Imms[index->i[i]][swizzle];
1142 chan->f[i] = mach->ImmArray[index->i[i]][swizzle];
1151 chan->u[i] = mach->Addrs[index->i[i]].xyzw[swizzle].u[i];
1160 chan->u[i] = mach->Predicates[0].xyzw[swizzle].u[i];
1170 chan->u[i] = mach->Outputs[index->i[i]].xyzw[swizzle].u[i];
1183 fetch_source(const struct tgsi_exec_machine *mach,
1218 const uint execmask = mach->ExecMask;
1229 fetch_src_file_channel(mach,
1280 const uint execmask = mach->ExecMask;
1289 fetch_src_file_channel(mach,
1324 fetch_src_file_channel(mach,
1350 store_dest(struct tgsi_exec_machine *mach,
1361 uint execmask = mach->ExecMask;
1395 fetch_src_file_channel(mach,
1435 const uint execmask = mach->ExecMask;
1445 fetch_src_file_channel(mach,
1485 index = mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0]
1487 dst = &mach->Outputs[offset + index].xyzw[chan_index];
1489 if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
1502 dst = &mach->Temps[offset + index].xyzw[chan_index];
1512 dst = &mach->TempArray[index2D.i[0]][offset + index].xyzw[chan_index];
1517 dst = &mach->Addrs[index].xyzw[chan_index];
1523 dst = &mach->Predicates[index].xyzw[chan_index];
1555 pred = &mach->Predicates[inst->Predicate.Index].xyzw[swizzle];
1609 fetch_source(mach, VAL, &inst->Src[INDEX], CHAN, TGSI_EXEC_DATA_FLOAT)
1612 fetch_source(mach, VAL, &inst->Src[INDEX], CHAN, TGSI_EXEC_DATA_INT)
1620 exec_kil(struct tgsi_exec_machine *mach,
1652 mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
1660 mach,
1666 kilmask = mach->ExecMask;
1667 mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask;
1671 emit_vertex(struct tgsi_exec_machine *mach)
1676 if ((mach->ExecMask & (1 << i)))
1678 if (mach->ExecMask) {
1679 mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] += mach->NumOutputs;
1680 mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]]++;
1685 emit_primitive(struct tgsi_exec_machine *mach)
1687 unsigned *prim_count = &mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0];
1691 if ((mach->ExecMask & (1 << i)))
1693 if (mach->ExecMask) {
1695 debug_assert((*prim_count * mach->NumOutputs) < mach->MaxGeometryShaderOutputs);
1696 mach->Primitives[*prim_count] = 0;
1701 conditional_emit_primitive(struct tgsi_exec_machine *mach)
1703 if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
1705 mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]];
1707 emit_primitive(mach);
1749 exec_tex(struct tgsi_exec_machine *mach,
1780 fetch_texel(mach->Samplers[unit],
1793 fetch_texel(mach->Samplers[unit],
1813 fetch_texel(mach->Samplers[unit],
1827 fetch_texel(mach->Samplers[unit],
1841 fetch_texel(mach->Samplers[unit],
1857 fetch_texel(mach->Samplers[unit],
1869 fetch_texel(mach->Samplers[unit],
1886 fetch_texel(mach->Samplers[unit],
1909 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
1915 exec_txd(struct tgsi_exec_machine *mach,
1932 fetch_texel(mach->Samplers[unit],
1949 fetch_texel(mach->Samplers[unit],
1963 fetch_texel(mach->Samplers[unit],
1976 fetch_texel(mach->Samplers[unit],
1988 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
1995 exec_txf(struct tgsi_exec_machine *mach,
2010 fetch_src_file_channel(mach, 0, inst->TexOffsets[0].File,
2012 fetch_src_file_channel(mach, 0, inst->TexOffsets[0].File,
2014 fetch_src_file_channel(mach, 0, inst->TexOffsets[0].File,
2047 sampler = mach->Samplers[unit];
2060 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2066 exec_txq(struct tgsi_exec_machine *mach,
2076 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_INT);
2077 sampler = mach->Samplers[unit];
2089 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan,
2096 exec_sample(struct tgsi_exec_machine *mach,
2124 switch (mach->SamplerViews[resource_unit].Resource) {
2133 fetch_texel(mach->Samplers[sampler_unit],
2155 fetch_texel(mach->Samplers[sampler_unit],
2174 fetch_texel(mach->Samplers[sampler_unit],
2189 fetch_texel(mach->Samplers[sampler_unit],
2201 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2207 exec_sample_d(struct tgsi_exec_machine *mach,
2218 switch (mach->SamplerViews[resource_unit].Resource) {
2224 fetch_texel(mach->Samplers[sampler_unit],
2239 fetch_texel(mach->Samplers[sampler_unit],
2252 fetch_texel(mach->Samplers[sampler_unit],
2264 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2276 struct tgsi_exec_machine *mach,
2283 mach->Inputs[attrib].xyzw[chan].f[i] = mach->InterpCoefs[attrib].a0[chan];
2293 struct tgsi_exec_machine *mach,
2297 const float x = mach->QuadPos.xyzw[0].f[0];
2298 const float y = mach->QuadPos.xyzw[1].f[0];
2299 const float dadx = mach->InterpCoefs[attrib].dadx[chan];
2300 const float dady = mach->InterpCoefs[attrib].dady[chan];
2301 const float a0 = mach->InterpCoefs[attrib].a0[chan] + dadx * x + dady * y;
2302 mach->Inputs[attrib].xyzw[chan].f[0] = a0;
2303 mach->Inputs[attrib].xyzw[chan].f[1] = a0 + dadx;
2304 mach->Inputs[attrib].xyzw[chan].f[2] = a0 + dady;
2305 mach->Inputs[attrib].xyzw[chan].f[3] = a0 + dadx + dady;
2314 struct tgsi_exec_machine *mach,
2318 const float x = mach->QuadPos.xyzw[0].f[0];
2319 const float y = mach->QuadPos.xyzw[1].f[0];
2320 const float dadx = mach->InterpCoefs[attrib].dadx[chan];
2321 const float dady = mach->InterpCoefs[attrib].dady[chan];
2322 const float a0 = mach->InterpCoefs[attrib].a0[chan] + dadx * x + dady * y;
2323 const float *w = mach->QuadPos.xyzw[3].f;
2325 mach->Inputs[attrib].xyzw[chan].f[0] = a0 / w[0];
2326 mach->Inputs[attrib].xyzw[chan].f[1] = (a0 + dadx) / w[1];
2327 mach->Inputs[attrib].xyzw[chan].f[2] = (a0 + dady) / w[2];
2328 mach->Inputs[attrib].xyzw[chan].f[3] = (a0 + dadx + dady) / w[3];
2333 struct tgsi_exec_machine *mach,
2338 exec_declaration(struct tgsi_exec_machine *mach,
2342 mach->SamplerViews[decl->Range.First] = decl->SamplerView;
2346 if (mach->Processor == TGSI_PROCESSOR_FRAGMENT) {
2355 * mach->InterpCoefs[first].a0 should already have the
2368 mach->Inputs[first].xyzw[0].f[i] = mach->Face;
2388 eval = mach->flatshade_color ? eval_constant_coef : eval_perspective_coef;
2399 eval(mach, i, j);
2408 mach->SysSemanticToIndex[decl->Declaration.Semantic] = decl->Range.First;
2416 exec_vector(struct tgsi_exec_machine *mach,
2428 store_dest(mach, &dst, &inst->Dst[0], inst, chan, dst_datatype);
2437 exec_scalar_unary(struct tgsi_exec_machine *mach,
2447 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, src_datatype);
2451 store_dest(mach, &dst, &inst->Dst[0], inst, chan, dst_datatype);
2457 exec_vector_unary(struct tgsi_exec_machine *mach,
2470 fetch_source(mach, &src, &inst->Src[0], chan, src_datatype);
2476 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan, dst_datatype);
2486 exec_scalar_binary(struct tgsi_exec_machine *mach,
2496 fetch_source(mach, &src[0], &inst->Src[0], TGSI_CHAN_X, src_datatype);
2497 fetch_source(mach, &src[1], &inst->Src[1], TGSI_CHAN_Y, src_datatype);
2501 store_dest(mach, &dst, &inst->Dst[0], inst, chan, dst_datatype);
2507 exec_vector_binary(struct tgsi_exec_machine *mach,
2520 fetch_source(mach, &src[0], &inst->Src[0], chan, src_datatype);
2521 fetch_source(mach, &src[1], &inst->Src[1], chan, src_datatype);
2527 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan, dst_datatype);
2538 exec_vector_trinary(struct tgsi_exec_machine *mach,
2551 fetch_source(mach, &src[0], &inst->Src[0], chan, src_datatype);
2552 fetch_source(mach, &src[1], &inst->Src[1], chan, src_datatype);
2553 fetch_source(mach, &src[2], &inst->Src[2], chan, src_datatype);
2559 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan, dst_datatype);
2565 exec_dp3(struct tgsi_exec_machine *mach,
2571 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2572 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2576 fetch_source(mach, &arg[0], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
2577 fetch_source(mach, &arg[1], &inst->Src[1], chan, TGSI_EXEC_DATA_FLOAT);
2583 store_dest(mach, &arg[2], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2589 exec_dp4(struct tgsi_exec_machine *mach,
2595 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2596 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2600 fetch_source(mach, &arg[0], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
2601 fetch_source(mach, &arg[1], &inst->Src[1], chan, TGSI_EXEC_DATA_FLOAT);
2607 store_dest(mach, &arg[2], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2613 exec_dp2a(struct tgsi_exec_machine *mach,
2619 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2620 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2623 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2624 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2627 fetch_source(mach, &arg[1], &inst->Src[2], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2632 store_dest(mach, &arg[0], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2638 exec_dph(struct tgsi_exec_machine *mach,
2644 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2645 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2648 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2649 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2652 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2653 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2656 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2661 store_dest(mach, &arg[0], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2667 exec_dp2(struct tgsi_exec_machine *mach,
2673 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2674 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2677 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2678 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2683 store_dest(mach, &arg[2], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2689 exec_nrm4(struct tgsi_exec_machine *mach,
2696 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2702 fetch_source(mach, &arg[chan], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
2712 store_dest(mach
2718 exec_nrm3(struct tgsi_exec_machine *mach,
2726 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2732 fetch_source(mach, &arg[chan], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
2742 store_dest(mach, &arg[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
2748 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2753 exec_scs(struct tgsi_exec_machine *mach,
2760 fetch_source(mach, &arg, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2764 store_dest(mach, &result, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2768 store_dest(mach, &result, &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2772 store_dest(mach, &ZeroVec, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2775 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2780 exec_x2d(struct tgsi_exec_machine *mach,
2786 fetch_source(mach, &r[0], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2787 fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2789 fetch_source(mach, &r[2], &inst->Src[2], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2791 fetch_source(mach, &r[3], &inst->Src[2], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2794 fetch_source(mach, &r[3], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2798 fetch_source(mach, &r[2], &inst->Src[2], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2800 fetch_source(mach, &r[3], &inst->Src[2], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2803 fetch_source(mach, &r[3], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2807 store_dest(mach, &d[0], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2810 store_dest(mach, &d[1], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2813 store_dest(mach, &d[0], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2816 store_dest(mach, &d[1], &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2821 exec_rfl(struct tgsi_exec_machine *mach,
2828 fetch_source(mach, &r[2], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2830 fetch_source(mach, &r[4], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2833 fetch_source(mach, &r[6], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2838 fetch_source(mach, &r[3], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2840 fetch_source(mach, &r[5], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2843 fetch_source(mach, &r[7], &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2854 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2859 store_dest(mach, &r[4], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2864 store_dest(mach, &r[6], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2868 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2873 exec_xpd(struct tgsi_exec_machine *mach,
2879 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2880 fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2884 fetch_source(mach, &r[3], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2885 fetch_source(mach, &r[4], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2890 fetch_source(mach, &r[2], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2894 fetch_source(mach, &r[5], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2904 store_dest(mach, &d[TGSI_CHAN_X], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2907 store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2910 store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2913 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2918 exec_dst(struct tgsi_exec_machine *mach,
2925 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2926 fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2930 fetch_source(mach, &d[TGSI_CHAN_Z], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2933 fetch_source(mach, &d[TGSI_CHAN_W], &inst->Src[1], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2937 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2940 store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2943 store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2946 store_dest(mach, &d[TGSI_CHAN_W], &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2951 exec_log(struct tgsi_exec_machine *mach,
2956 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2961 store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2966 store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2969 store_dest(mach, &r[1], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2972 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
2977 exec_exp(struct tgsi_exec_machine *mach,
2982 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2986 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
2990 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
2994 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
2997 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
3002 exec_lit(struct tgsi_exec_machine *mach,
3009 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3011 fetch_source(mach, &r[1], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3014 fetch_source(mach, &r[2], &inst->Src[0], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
3019 store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
3023 store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3027 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3031 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
3036 exec_break(struct tgsi_exec_machine *mach)
3038 if (mach->BreakType == TGSI_EXEC_BREAK_INSIDE_LOOP) {
3040 mach->LoopMask &= ~mach->ExecMask;
3041 /* Todo: if mach->LoopMask == 0, jump to end of loop */
3042 UPDATE_EXEC_MASK(mach);
3044 assert(mach->BreakType == TGSI_EXEC_BREAK_INSIDE_SWITCH);
3046 mach->Switch.mask = 0x0;
3048 UPDATE_EXEC_MASK(mach);
3053 exec_switch(struct tgsi_exec_machine *mach,
3056 assert(mach->SwitchStackTop < TGSI_EXEC_MAX_SWITCH_NESTING);
3057 assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
3059 mach->SwitchStack[mach->SwitchStackTop++] = mach->Switch;
3060 fetch_source(mach, &mach->Switch.selector, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
3061 mach->Switch.mask = 0x0;
3062 mach->Switch.defaultMask = 0x0;
3064 mach->BreakStack[mach->BreakStackTop++] = mach->BreakType;
3065 mach->BreakType = TGSI_EXEC_BREAK_INSIDE_SWITCH;
3067 UPDATE_EXEC_MASK(mach);
3071 exec_case(struct tgsi_exec_machine *mach,
3074 uint prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
3078 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
3080 if (mach->Switch.selector.u[0] == src.u[0]) {
3083 if (mach->Switch.selector.u[1] == src.u[1]) {
3086 if (mach->Switch.selector.u[2] == src.u[2]) {
3089 if (mach->Switch.selector.u[3] == src.u[3]) {
3093 mach->Switch.defaultMask |= mask;
3095 mach->Switch.mask |= mask & prevMask;
3097 UPDATE_EXEC_MASK(mach);
3101 exec_default(struct tgsi_exec_machine *mach)
3103 uint prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
3105 mach->Switch.mask |= ~mach->Switch.defaultMask & prevMask;
3107 UPDATE_EXEC_MASK(mach);
3111 exec_endswitch(struct tgsi_exec_machine *mach)
3113 mach->Switch = mach->SwitchStack[--mach->SwitchStackTop];
3114 mach->BreakType = mach->BreakStack[--mach->BreakStackTop];
3116 UPDATE_EXEC_MASK(mach);
3447 struct tgsi_exec_machine *mach,
3457 exec_vector_unary(mach, inst, micro_arl, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_FLOAT);
3461 exec_vector_unary(mach, inst, micro_mov, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_FLOAT);
3465 exec_lit(mach, inst);
3469 exec_scalar_unary(mach, inst, micro_rcp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3473 exec_scalar_unary(mach, inst, micro_rsq, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3477 exec_exp(mach, inst);
3481 exec_log(mach, inst);
3485 exec_vector_binary(mach, inst, micro_mul, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3489 exec_vector_binary(mach, inst, micro_add, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3493 exec_dp3(mach, inst);
3497 exec_dp4(mach, inst);
3501 exec_dst(mach, inst);
3505 exec_vector_binary(mach, inst, micro_min, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3509 exec_vector_binary(mach, inst, micro_max, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3513 exec_vector_binary(mach, inst, micro_slt, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3517 exec_vector_binary(mach, inst, micro_sge, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3521 exec_vector_trinary(mach, inst, micro_mad, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3525 exec_vector_binary(mach, inst, micro_sub, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3529 exec_vector_trinary(mach, inst, micro_lrp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3533 exec_vector_trinary(mach, inst, micro_cnd, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3537 exec_dp2a(mach, inst);
3541 exec_vector_unary(mach, inst, micro_frc, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3545 exec_vector_trinary(mach, inst, micro_clamp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3549 exec_vector_unary(mach, inst, micro_flr, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3553 exec_vector_unary(mach, inst, micro_rnd, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3557 exec_scalar_unary(mach, inst, micro_exp2, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3561 exec_scalar_unary(mach, inst, micro_lg2, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3565 exec_scalar_binary(mach, inst, micro_pow, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3569 exec_xpd(mach, inst);
3573 exec_vector_unary(mach, inst, micro_abs, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3577 exec_scalar_unary(mach, inst, micro_rcc, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3581 exec_dph(mach, inst);
3585 exec_scalar_unary(mach, inst, micro_cos, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3589 exec_vector_unary(mach, inst, micro_ddx, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3593 exec_vector_unary(mach, inst, micro_ddy, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3597 exec_kilp (mach, inst);
3601 exec_kil (mach, inst);
3621 exec_rfl(mach, inst);
3625 exec_vector_binary(mach, inst, micro_seq, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3629 exec_vector(mach, inst, micro_sfl, TGSI_EXEC_DATA_FLOAT);
3633 exec_vector_binary(mach, inst, micro_sgt, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3637 exec_scalar_unary(mach, inst, micro_sin, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3641 exec_vector_binary(mach, inst, micro_sle, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3645 exec_vector_binary(mach, inst, micro_sne, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3649 exec_vector(mach, inst, micro_str, TGSI_EXEC_DATA_FLOAT);
3656 exec_tex(mach, inst, TEX_MODIFIER_NONE);
3663 exec_tex(mach, inst, TEX_MODIFIER_LOD_BIAS);
3672 exec_txd(mach, inst);
3679 exec_tex(mach, inst, TEX_MODIFIER_EXPLICIT_LOD);
3686 exec_tex(mach, inst, TEX_MODIFIER_PROJECTED);
3706 exec_x2d(mach, inst);
3714 exec_vector_unary(mach, inst, micro_arr, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_FLOAT);
3723 if (mach->ExecMask) {
3733 mach->CallStack[mach->CallStackTop].CondStackTop = mach->CondStackTop;
3734 mach->CallStack[mach->CallStackTop].LoopStackTop = mach->LoopStackTop;
3735 mach->CallStack[mach->CallStackTop].ContStackTop = mach->ContStackTop;
3736 mach->CallStack[mach->CallStackTop].SwitchStackTop = mach->SwitchStackTop;
3737 mach->CallStack[mach->CallStackTop].BreakStackTop = mach->BreakStackTop;
3739 mach->CallStack[mach->CallStackTop].ReturnAddr = *pc;
3741 mach->CallStackTop++;
3744 assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
3745 assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
3746 assert(mach->ContStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
3747 assert(mach->SwitchStackTop < TGSI_EXEC_MAX_SWITCH_NESTING);
3748 assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
3749 assert(mach->FuncStackTop < TGSI_EXEC_MAX_CALL_NESTING);
3751 mach->CondStack[mach->CondStackTop++] = mach->CondMask;
3752 mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask;
3753 mach->ContStack[mach->ContStackTop++] = mach->ContMask;
3754 mach->SwitchStack[mach->SwitchStackTop++] = mach->Switch;
3755 mach->BreakStack[mach->BreakStackTop++] = mach->BreakType;
3756 mach->FuncStack[mach->FuncStackTop++] = mach->FuncMask;
3764 mach->FuncMask &= ~mach->ExecMask;
3765 UPDATE_EXEC_MASK(mach);
3767 if (mach->FuncMask == 0x0) {
3770 if (mach->CallStackTop == 0) {
3772 mach->CondStackTop = 0;
3773 mach->LoopStackTop = 0;
3778 assert(mach->CallStackTop > 0);
3779 mach->CallStackTop--;
3781 mach->CondStackTop = mach->CallStack[mach->CallStackTop].CondStackTop;
3782 mach->CondMask = mach->CondStack[mach->CondStackTop];
3784 mach->LoopStackTop = mach->CallStack[mach->CallStackTop].LoopStackTop;
3785 mach->LoopMask = mach->LoopStack[mach->LoopStackTop];
3787 mach->ContStackTop = mach->CallStack[mach->CallStackTop].ContStackTop;
3788 mach->ContMask = mach->ContStack[mach->ContStackTop];
3790 mach->SwitchStackTop = mach->CallStack[mach->CallStackTop].SwitchStackTop;
3791 mach->Switch = mach->SwitchStack[mach->SwitchStackTop];
3793 mach->BreakStackTop = mach->CallStack[mach->CallStackTop].BreakStackTop;
3794 mach->BreakType = mach->BreakStack[mach->BreakStackTop];
3796 assert(mach->FuncStackTop > 0);
3797 mach->FuncMask = mach->FuncStack[--mach->FuncStackTop];
3799 *pc = mach->CallStack[mach->CallStackTop].ReturnAddr;
3801 UPDATE_EXEC_MASK(mach);
3806 exec_vector_unary(mach, inst, micro_sgn, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3810 exec_vector_trinary(mach, inst, micro_cmp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3814 exec_scs(mach, inst);
3818 exec_nrm3(mach, inst);
3822 exec_nrm4(mach, inst);
3826 exec_vector_binary(mach, inst, micro_div, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3830 exec_dp2(mach, inst);
3835 assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
3836 mach->CondStack[mach->CondStackTop++] = mach->CondMask;
3840 mach->CondMask &= ~0x1;
3843 mach->CondMask &= ~0x2;
3846 mach->CondMask &= ~0x4;
3849 mach->CondMask &= ~0x8;
3851 UPDATE_EXEC_MASK(mach);
3859 assert(mach->CondStackTop > 0);
3860 prevMask = mach->CondStack[mach->CondStackTop - 1];
3861 mach->CondMask = ~mach->CondMask & prevMask;
3862 UPDATE_EXEC_MASK(mach);
3869 assert(mach->CondStackTop > 0);
3870 mach->CondMask = mach->CondStack[--mach->CondStackTop];
3871 UPDATE_EXEC_MASK(mach);
3877 conditional_emit_primitive(mach);
3891 exec_vector_unary(mach, inst, micro_ceil, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3895 exec_vector_unary(mach, inst, micro_i2f, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_INT);
3899 exec_vector_unary(mach, inst, micro_not, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
3903 exec_vector_unary(mach, inst, micro_trunc, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
3907 exec_vector_binary(mach, inst, micro_shl, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
3911 exec_vector_binary(mach, inst, micro_and, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
3915 exec_vector_binary(mach, inst, micro_or, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
3919 exec_vector_binary(mach, inst, micro_mod, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
3923 exec_vector_binary(mach, inst, micro_xor, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
3931 exec_txf(mach, inst);
3935 exec_txq(mach, inst);
3939 emit_vertex(mach);
3943 emit_primitive(mach);
3948 assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
3949 assert(mach->ContStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
3950 assert(mach->LoopLabelStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
3951 assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
3953 mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask;
3954 mach->ContStack[mach->ContStackTop++] = mach->ContMask;
3955 mach->LoopLabelStack[mach->LoopLabelStackTop++] = *pc - 1;
3956 mach->BreakStack[mach->BreakStackTop++] = mach->BreakType;
3957 mach->BreakType = TGSI_EXEC_BREAK_INSIDE_LOOP;
3962 assert(mach->ContStackTop > 0);
3963 mach->ContMask = mach->ContStack[mach->ContStackTop - 1];
3964 UPDATE_EXEC_MASK(mach);
3965 if (mach->ExecMask) {
3967 assert(mach->LoopLabelStackTop > 0);
3968 *pc = mach->LoopLabelStack[mach->LoopLabelStackTop - 1] + 1;
3972 assert(mach->LoopStackTop > 0);
3973 mach->LoopMask = mach->LoopStack[--mach->LoopStackTop];
3975 assert(mach->ContStackTop > 0);
3976 mach->ContMask = mach->ContStack[--mach->ContStackTop];
3977 assert(mach->LoopLabelStackTop > 0);
3978 --mach->LoopLabelStackTop;
3980 mach->BreakType = mach->BreakStack[--mach->BreakStackTop];
3982 UPDATE_EXEC_MASK(mach);
3986 exec_break(mach);
3991 mach->ContMask &= ~mach->ExecMask;
3992 /* Todo: if mach->LoopMask == 0, jump to end of loop */
3993 UPDATE_EXEC_MASK(mach);
4005 assert(mach->CallStackTop > 0);
4006 mach->CallStackTop--;
4008 mach->CondStackTop = mach->CallStack[mach->CallStackTop].CondStackTop;
4009 mach->CondMask = mach->CondStack[mach->CondStackTop];
4011 mach->LoopStackTop = mach->CallStack[mach->CallStackTop].LoopStackTop;
4012 mach->LoopMask = mach->LoopStack[mach->LoopStackTop];
4014 mach->ContStackTop = mach->CallStack[mach->CallStackTop].ContStackTop;
4015 mach->ContMask = mach->ContStack[mach->ContStackTop];
4017 mach->SwitchStackTop = mach->CallStack[mach->CallStackTop].SwitchStackTop;
4018 mach->Switch = mach->SwitchStack[mach->SwitchStackTop];
4020 mach->BreakStackTop = mach->CallStack[mach->CallStackTop].BreakStackTop;
4021 mach->BreakType = mach->BreakStack[mach->BreakStackTop];
4023 assert(mach->FuncStackTop > 0);
4024 mach->FuncMask = mach->FuncStack[--mach->FuncStackTop];
4026 *pc = mach->CallStack[mach->CallStackTop].ReturnAddr;
4028 UPDATE_EXEC_MASK(mach);
4037 if (r[0].u[0] && (mach->ExecMask & 0x1)) {
4038 mach->LoopMask &= ~0x1;
4040 if (r[0].u[1] && (mach->ExecMask & 0x2)) {
4041 mach->LoopMask &= ~0x2;
4043 if (r[0].u[2] && (mach->ExecMask & 0x4)) {
4044 mach->LoopMask &= ~0x4;
4046 if (r[0].u[3] && (mach->ExecMask & 0x8)) {
4047 mach->LoopMask &= ~0x8;
4049 /* Todo: if mach->LoopMask == 0, jump to end of loop */
4050 UPDATE_EXEC_MASK(mach);
4054 exec_vector_unary(mach, inst, micro_f2i, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_FLOAT);
4058 exec_vector_binary(mach, inst, micro_idiv, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4062 exec_vector_binary(mach, inst, micro_imax, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4066 exec_vector_binary(mach, inst, micro_imin, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4070 exec_vector_unary(mach, inst, micro_ineg, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4074 exec_vector_binary(mach, inst, micro_isge, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4078 exec_vector_binary(mach, inst, micro_ishr, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4082 exec_vector_binary(mach, inst, micro_islt, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4086 exec_vector_unary(mach, inst, micro_f2u, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_FLOAT);
4090 exec_vector_unary(mach, inst, micro_u2f, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_UINT);
4094 exec_vector_binary(mach, inst, micro_uadd, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4098 exec_vector_binary(mach, inst, micro_udiv, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4102 exec_vector_trinary(mach, inst, micro_umad, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4106 exec_vector_binary(mach, inst, micro_umax, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4110 exec_vector_binary(mach, inst, micro_umin, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4114 exec_vector_binary(mach, inst, micro_umod, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4118 exec_vector_binary(mach, inst, micro_umul, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4122 exec_vector_binary(mach, inst, micro_useq, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4126 exec_vector_binary(mach, inst, micro_usge, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4130 exec_vector_binary(mach, inst, micro_ushr, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4134 exec_vector_binary(mach, inst, micro_uslt, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4138 exec_vector_binary(mach, inst, micro_usne, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4142 exec_switch(mach, inst);
4146 exec_case(mach, inst);
4150 exec_default(mach);
4154 exec_endswitch(mach);
4166 exec_sample(mach, inst, TEX_MODIFIER_NONE);
4170 exec_sample(mach, inst, TEX_MODIFIER_LOD_BIAS);
4174 exec_sample(mach, inst, TEX_MODIFIER_NONE);
4178 exec_sample(mach, inst, TEX_MODIFIER_LOD_BIAS);
4182 exec_sample_d(mach, inst);
4186 exec_sample(mach, inst, TEX_MODIFIER_EXPLICIT_LOD);
4206 exec_vector_unary(mach, inst, micro_uarl, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_UINT);
4210 exec_vector_trinary(mach, inst, micro_ucmp, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
4214 exec_vector_unary(mach, inst, micro_iabs, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4218 exec_vector_unary(mach, inst, micro_isgn, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
4235 tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
4240 mach->CondMask = 0xf;
4241 mach->LoopMask = 0xf;
4242 mach->ContMask = 0xf;
4243 mach->FuncMask = 0xf;
4244 mach->ExecMask = 0xf;
4246 mach->Switch.mask = 0xf;
4248 assert(mach->CondStackTop == 0);
4249 assert(mach->LoopStackTop == 0);
4250 assert(mach->ContStackTop == 0);
4251 assert(mach->SwitchStackTop == 0);
4252 assert(mach->BreakStackTop == 0);
4253 assert(mach->CallStackTop == 0);
4255 mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] = 0;
4256 mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] = 0;
4258 if( mach->Processor == TGSI_PROCESSOR_GEOMETRY ) {
4259 mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0] = 0;
4260 mach->Primitives[0] = 0;
4264 for (i = 0; i < mach->NumDeclarations; i++) {
4265 exec_declaration( mach, mach->Declarations+i );
4274 memcpy(temps, mach->Temps, sizeof(temps));
4275 memcpy(outputs, mach->Outputs, sizeof(outputs));
4284 tgsi_dump_instruction(&mach->Instructions[pc], inst++);
4287 assert(pc < (int) mach->NumInstructions);
4288 mach, mach->Instructions + pc, &pc);
4292 if (memcmp(&temps[i], &mach->Temps[i], sizeof(temps[i]))) {
4295 memcpy(&temps[i], &mach->Temps[i], sizeof(temps[i]));
4310 if (memcmp(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]))) {
4313 memcpy(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]));
4333 if (mach->Processor == TGSI_PROCESSOR_FRAGMENT) {
4338 mach->Outputs[0].xyzw[2].f[i] *= ctx->DrawBuffer->_DepthMaxF;
4345 assert(mach->CondStackTop == 0);
4346 assert(mach->LoopStackTop == 0);
4347 assert(mach->ContStackTop == 0);
4348 assert(mach->SwitchStackTop == 0);
4349 assert(mach->BreakStackTop == 0);
4350 assert(mach->CallStackTop == 0);
4352 return ~mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];