Lines Matching refs:mach
990 print_temp(const struct tgsi_exec_machine *mach, uint index)
992 const struct tgsi_exec_vector *tmp = &mach->Temps[index];
1008 tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
1016 mach->Consts[i] = bufs[i];
1017 mach->ConstsSize[i] = buf_sizes[i];
1028 struct tgsi_exec_machine *mach,
1045 mach->Tokens = tokens;
1046 mach->Sampler = sampler;
1047 mach->Image = image;
1048 mach->Buffer = buffer;
1052 FREE(mach->Declarations);
1053 mach->Declarations = NULL;
1054 mach->NumDeclarations = 0;
1056 FREE(mach->Instructions);
1057 mach->Instructions = NULL;
1058 mach->NumInstructions = 0;
1063 k = tgsi_parse_init (&parse, mach->Tokens);
1069 mach->ImmLimit = 0;
1070 mach->NumOutputs = 0;
1073 mach->SysSemanticToIndex[k] = -1;
1075 if (mach->ShaderType == PIPE_SHADER_GEOMETRY &&
1076 !mach->UsedGeometryShader) {
1095 align_free(mach->Inputs);
1096 align_free(mach->Outputs);
1098 mach->Inputs = inputs;
1099 mach->Outputs = outputs;
1100 mach->UsedGeometryShader = TRUE;
1134 mach->NumOutputs = MAX2(mach->NumOutputs, parse.FullToken.FullDeclaration.Range.Last + 1);
1137 mach->SysSemanticToIndex[decl->Semantic.Name] = decl->Range.First;
1150 if (mach->ImmLimit >= mach->ImmsReserved) {
1151 unsigned newReserved = mach->ImmsReserved ? 2 * mach->ImmsReserved : 128;
1152 float4 *imms = REALLOC(mach->Imms, mach->ImmsReserved, newReserved * sizeof(float4));
1154 mach->ImmsReserved = newReserved;
1155 mach->Imms = imms;
1163 mach->Imms[mach->ImmLimit][i] =
1166 mach->ImmLimit += 1;
1190 if (mach->ShaderType == PIPE_SHADER_GEOMETRY) {
1192 mach->MaxOutputVertices = parse.FullToken.FullProperty.u[0].Data;
1203 FREE(mach->Declarations);
1204 mach->Declarations = declarations;
1205 mach->NumDeclarations = numDeclarations;
1207 FREE(mach->Instructions);
1208 mach->Instructions = instructions;
1209 mach->NumInstructions = numInstructions;
1216 struct tgsi_exec_machine *mach;
1218 mach = align_malloc( sizeof *mach, 16 );
1219 if (!mach)
1222 memset(mach, 0, sizeof(*mach));
1224 mach->ShaderType = shader_type;
1227 mach->Inputs = align_malloc(sizeof(struct tgsi_exec_vector) * PIPE_MAX_SHADER_INPUTS, 16);
1228 mach->Outputs = align_malloc(sizeof(struct tgsi_exec_vector) * PIPE_MAX_SHADER_OUTPUTS, 16);
1229 if (!mach->Inputs || !mach->Outputs)
1234 mach->InputSampleOffsetApply = align_malloc(sizeof(apply_sample_offset_func) * PIPE_MAX_SHADER_INPUTS, 16);
1235 if (!mach->InputSampleOffsetApply)
1245 return mach;
1248 if (mach) {
1249 align_free(mach->InputSampleOffsetApply);
1250 align_free(mach->Inputs);
1251 align_free(mach->Outputs);
1252 align_free(mach);
1259 tgsi_exec_machine_destroy(struct tgsi_exec_machine *mach)
1261 if (mach) {
1262 FREE(mach->Instructions);
1263 FREE(mach->Declarations);
1264 FREE(mach->Imms);
1266 align_free(mach->InputSampleOffsetApply);
1267 align_free(mach->Inputs);
1268 align_free(mach->Outputs);
1270 align_free(mach);
1390 fetch_src_file_channel(const struct tgsi_exec_machine *mach,
1408 if (pos >= mach->ConstsSize[constbuf] / 4) {
1418 const uint *buf = (const uint *)mach->Consts[constbuf];
1427 if (PIPE_SHADER_GEOMETRY == mach->ShaderType) {
1435 chan->u[i] = mach->Inputs[pos].xyzw[swizzle].u[i];
1441 chan->u[i] = mach->SystemValue[index->i[i]].xyzw[swizzle].u[i];
1450 chan->u[i] = mach->Temps[index->i[i]].xyzw[swizzle].u[i];
1456 assert(index->i[i] >= 0 && index->i[i] < (int)mach->ImmLimit);
1459 chan->f[i] = mach->Imms[index->i[i]][swizzle];
1465 assert(index->i[i] >= 0 && index->i[i] < ARRAY_SIZE(mach->Addrs));
1468 chan->u[i] = mach->Addrs[index->i[i]].xyzw[swizzle].u[i];
1478 chan->u[i] = mach->Outputs[index->i[i]].xyzw[swizzle].u[i];
1491 get_index_registers(const struct tgsi_exec_machine *mach,
1519 const uint execmask = mach->ExecMask;
1522 const union tgsi_exec_channel *addr = &mach->Addrs[reg->Indirect.Index].xyzw[reg->Indirect.Swizzle];
1561 const uint execmask = mach->ExecMask;
1564 const union tgsi_exec_channel *addr = &mach->Addrs[reg->DimIndirect.Index].xyzw[reg->DimIndirect.Swizzle];
1592 fetch_source_d(const struct tgsi_exec_machine *mach,
1601 get_index_registers(mach, reg, &index, &index2D);
1605 fetch_src_file_channel(mach,
1614 fetch_source(const struct tgsi_exec_machine *mach,
1620 fetch_source_d(mach, chan, reg, chan_index);
1637 store_dest_dstret(struct tgsi_exec_machine *mach,
1673 fetch_src_file_channel(mach,
1690 index = mach->OutputVertexOffset + reg->Register.Index;
1691 dst = &mach->Outputs[offset + index].xyzw[chan_index];
1694 mach->NumOutputs, mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0],
1696 if (PIPE_SHADER_GEOMETRY == mach->ShaderType) {
1709 dst = &mach->Temps[offset + index].xyzw[chan_index];
1714 assert(index >= 0 && index < ARRAY_SIZE(mach->Addrs));
1715 dst = &mach->Addrs[index].xyzw[chan_index];
1726 store_dest_double(struct tgsi_exec_machine *mach,
1732 const uint execmask = mach->ExecMask;
1735 dst = store_dest_dstret(mach, chan, reg, chan_index);
1746 store_dest(struct tgsi_exec_machine *mach,
1753 const uint execmask = mach->ExecMask;
1756 dst = store_dest_dstret(mach, chan, reg, chan_index);
1773 fetch_source(mach, VAL, &inst->Src[INDEX], CHAN, TGSI_EXEC_DATA_FLOAT)
1776 fetch_source(mach, VAL, &inst->Src[INDEX], CHAN, TGSI_EXEC_DATA_INT)
1784 exec_kill_if(struct tgsi_exec_machine *mach,
1817 kilmask &= mach->ExecMask;
1819 mach->KillMask |= kilmask;
1826 exec_kill(struct tgsi_exec_machine *mach)
1831 mach->KillMask |= mach->ExecMask;
1835 emit_vertex(struct tgsi_exec_machine *mach,
1844 if ((mach->ExecMask & (1 << i)))
1848 prim_count = mach->OutputPrimCount[stream_id];
1849 if (mach->ExecMask) {
1850 if (mach->Primitives[stream_id][prim_count] >= mach->MaxOutputVertices)
1853 if (mach->Primitives[stream_id][prim_count] == 0)
1854 mach->PrimitiveOffsets[stream_id][prim_count] = mach->OutputVertexOffset;
1855 mach->OutputVertexOffset += mach->NumOutputs;
1856 mach->Primitives[stream_id][prim_count]++;
1861 emit_primitive(struct tgsi_exec_machine *mach,
1870 if ((mach->ExecMask & (1 << i)))
1876 prim_count = &mach->OutputPrimCount[stream_id];
1877 if (mach->ExecMask) {
1879 assert((*prim_count * mach->NumOutputs) < TGSI_MAX_TOTAL_VERTICES);
1880 mach->Primitives[stream_id][*prim_count] = 0;
1885 conditional_emit_primitive(struct tgsi_exec_machine *mach)
1887 if (PIPE_SHADER_GEOMETRY == mach->ShaderType) {
1888 int emitted_verts = mach->Primitives[0][mach->OutputPrimCount[0]];
1890 emit_primitive(mach, NULL);
1943 fetch_texel_offsets(struct tgsi_exec_machine *mach,
1951 fetch_src_file_channel(mach, inst->TexOffsets[0].File,
1953 fetch_src_file_channel(mach, inst->TexOffsets[0].File,
1955 fetch_src_file_channel(mach, inst->TexOffsets[0].File,
1972 fetch_assign_deriv_channel(struct tgsi_exec_machine *mach,
1992 fetch_sampler_unit(struct tgsi_exec_machine *mach,
2001 const uint execmask = mach->ExecMask;
2007 fetch_src_file_channel(mach,
2034 exec_tex(struct tgsi_exec_machine *mach,
2046 unit = fetch_sampler_unit(mach, inst, sampler);
2048 fetch_texel_offsets(mach, inst, offsets);
2117 fetch_texel(mach->Sampler, unit, unit,
2135 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
2141 exec_lodq(struct tgsi_exec_machine *mach,
2151 resource_unit = fetch_sampler_unit(mach, inst, 1);
2153 uint target = mach->SamplerViews[resource_unit].Resource;
2155 sampler_unit = fetch_sampler_unit(mach, inst, 2);
2169 mach->Sampler->query_lod(mach->Sampler, resource_unit, sampler_unit,
2179 store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_X);
2182 store_dest(mach, &r[1], &inst->Dst[0], inst, TGSI_CHAN_Y);
2195 store_dest(mach, &ZeroVec,
2198 store_dest(mach, &r[swizzles[chan]],
2205 store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_X);
2208 store_dest(mach, &r[1], &inst->Dst[0], inst, TGSI_CHAN_Y);
2214 exec_txd(struct tgsi_exec_machine *mach,
2223 unit = fetch_sampler_unit(mach, inst, 3);
2225 fetch_texel_offsets(mach, inst, offsets);
2231 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_X, derivs[0]);
2233 fetch_texel(mach->Sampler, unit, unit,
2247 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_X, derivs[0]);
2249 fetch_texel(mach->Sampler, unit, unit,
2260 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_X, derivs[0]);
2261 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_Y, derivs[1]);
2263 fetch_texel(mach->Sampler, unit, unit,
2280 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_X, derivs[0]);
2281 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_Y, derivs[1]);
2283 fetch_texel(mach->Sampler, unit, unit,
2299 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_X, derivs[0]);
2300 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_Y, derivs[1]);
2301 fetch_assign_deriv_channel(mach, inst, 1, TGSI_CHAN_Z, derivs[2]);
2303 fetch_texel(mach->Sampler, unit, unit,
2315 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
2322 exec_txf(struct tgsi_exec_machine *mach,
2333 unit = fetch_sampler_unit(mach, inst, 1);
2335 fetch_texel_offsets(mach, inst, offsets);
2341 target = mach->SamplerViews[unit].Resource;
2372 mach->Sampler->get_texel(mach->Sampler, unit, r[0].i, r[1].i, r[2].i, r[3].i,
2392 store_dest(mach, &r[swizzles[chan]],
2400 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
2407 exec_txq(struct tgsi_exec_machine *mach,
2416 unit = fetch_sampler_unit(mach, inst, 1);
2418 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_INT);
2421 mach->Sampler->get_dims(mach->Sampler, unit, src.i[0], result);
2431 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
2437 exec_sample(struct tgsi_exec_machine *mach,
2451 fetch_texel_offsets(mach, inst, offsets);
2477 switch (mach->SamplerViews[resource_unit].Resource) {
2481 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2487 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2500 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2506 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2520 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2526 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2539 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2545 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2564 store_dest(mach, &r[swizzles[chan]],
2571 exec_sample_d(struct tgsi_exec_machine *mach,
2583 fetch_texel_offsets(mach, inst, offsets);
2587 switch (mach->SamplerViews[resource_unit].Resource) {
2593 fetch_assign_deriv_channel(mach, inst, 3, TGSI_CHAN_X, derivs[0]);
2595 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2608 fetch_assign_deriv_channel(mach, inst, 3, TGSI_CHAN_X, derivs[0]);
2609 fetch_assign_deriv_channel(mach, inst, 3, TGSI_CHAN_Y, derivs[1]);
2611 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2625 fetch_assign_deriv_channel(mach, inst, 3, TGSI_CHAN_X, derivs[0]);
2626 fetch_assign_deriv_channel(mach, inst, 3, TGSI_CHAN_Y, derivs[1]);
2627 fetch_assign_deriv_channel(mach, inst, 3, TGSI_CHAN_Z, derivs[2]);
2629 fetch_texel(mach->Sampler, resource_unit, sampler_unit,
2646 store_dest(mach, &r[swizzles[chan]],
2659 struct tgsi_exec_machine *mach,
2666 mach->Inputs[attrib].xyzw[chan].f[i] = mach->InterpCoefs[attrib].a0[chan];
2672 UNUSED const struct tgsi_exec_machine *mach,
2687 const struct tgsi_exec_machine *mach,
2694 const float dadx = mach->InterpCoefs[attrib].dadx[chan];
2695 const float dady = mach->InterpCoefs[attrib].dady[chan];
2704 eval_linear_coef(struct tgsi_exec_machine *mach,
2708 const float x = mach->QuadPos.xyzw[0].f[0];
2709 const float y = mach->QuadPos.xyzw[1].f[0];
2710 const float dadx = mach->InterpCoefs[attrib].dadx[chan];
2711 const float dady = mach->InterpCoefs[attrib].dady[chan];
2712 const float a0 = mach->InterpCoefs[attrib].a0[chan] + dadx * x + dady * y;
2714 mach->Inputs[attrib].xyzw[chan].f[0] = a0;
2715 mach->Inputs[attrib].xyzw[chan].f[1] = a0 + dadx;
2716 mach->Inputs[attrib].xyzw[chan].f[2] = a0 + dady;
2717 mach->Inputs[attrib].xyzw[chan].f[3] = a0 + dadx + dady;
2727 const struct tgsi_exec_machine *mach,
2734 const float dadx = mach->InterpCoefs[attrib].dadx[chan];
2735 const float dady = mach->InterpCoefs[attrib].dady[chan];
2736 const float *w = mach->QuadPos.xyzw[3].f;
2746 struct tgsi_exec_machine *mach,
2750 const float x = mach->QuadPos.xyzw[0].f[0];
2751 const float y = mach->QuadPos.xyzw[1].f[0];
2752 const float dadx = mach->InterpCoefs[attrib].dadx[chan];
2753 const float dady = mach->InterpCoefs[attrib].dady[chan];
2754 const float a0 = mach->InterpCoefs[attrib].a0[chan] + dadx * x + dady * y;
2755 const float *w = mach->QuadPos.xyzw[3].f;
2757 mach->Inputs[attrib].xyzw[chan].f[0] = a0 / w[0];
2758 mach->Inputs[attrib].xyzw[chan].f[1] = (a0 + dadx) / w[1];
2759 mach->Inputs[attrib].xyzw[chan].f[2] = (a0 + dady) / w[2];
2760 mach->Inputs[attrib].xyzw[chan].f[3] = (a0 + dadx + dady) / w[3];
2765 struct tgsi_exec_machine *mach,
2770 exec_declaration(struct tgsi_exec_machine *mach,
2774 mach->SamplerViews[decl->Range.First] = decl->SamplerView;
2778 if (mach->ShaderType == PIPE_SHADER_FRAGMENT) {
2787 * mach->InterpCoefs[first].a0 should already have the
2800 mach->Inputs[first].xyzw[0].f[i] = mach->Face;
2824 eval = mach->flatshade_color ? eval_constant_coef : eval_perspective_coef;
2825 interp = mach->flatshade_color ? interp_constant_offset : interp_perspective_offset;
2834 mach->InputSampleOffsetApply[i] = interp;
2839 eval(mach, i, j);
2854 mach->Inputs[i].xyzw[0].f[j], mach->Inputs[i].xyzw[0].u[j],
2855 mach->Inputs[i].xyzw[1].f[j], mach->Inputs[i].xyzw[1].u[j],
2856 mach->Inputs[i].xyzw[2].f[j], mach->Inputs[i].xyzw[2].u[j],
2857 mach->Inputs[i].xyzw[3].f[j], mach->Inputs[i].xyzw[3].u[j]);
2870 exec_scalar_unary(struct tgsi_exec_machine *mach,
2879 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, src_datatype);
2883 store_dest(mach, &dst, &inst->Dst[0], inst, chan);
2889 exec_vector_unary(struct tgsi_exec_machine *mach,
2901 fetch_source(mach, &src, &inst->Src[0], chan, src_datatype);
2907 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan);
2917 exec_scalar_binary(struct tgsi_exec_machine *mach,
2926 fetch_source(mach, &src[0], &inst->Src[0], TGSI_CHAN_X, src_datatype);
2927 fetch_source(mach, &src[1], &inst->Src[1], TGSI_CHAN_X, src_datatype);
2931 store_dest(mach, &dst, &inst->Dst[0], inst, chan);
2937 exec_vector_binary(struct tgsi_exec_machine *mach,
2949 fetch_source(mach, &src[0], &inst->Src[0], chan, src_datatype);
2950 fetch_source(mach, &src[1], &inst->Src[1], chan, src_datatype);
2956 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan);
2967 exec_vector_trinary(struct tgsi_exec_machine *mach,
2979 fetch_source(mach, &src[0], &inst->Src[0], chan, src_datatype);
2980 fetch_source(mach, &src[1], &inst->Src[1], chan, src_datatype);
2981 fetch_source(mach, &src[2], &inst->Src[2], chan, src_datatype);
2987 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan);
2999 exec_vector_quaternary(struct tgsi_exec_machine *mach,
3011 fetch_source(mach, &src[0], &inst->Src[0], chan, src_datatype);
3012 fetch_source(mach, &src[1], &inst->Src[1], chan, src_datatype);
3013 fetch_source(mach, &src[2], &inst->Src[2], chan, src_datatype);
3014 fetch_source(mach, &src[3], &inst->Src[3], chan, src_datatype);
3020 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan);
3026 exec_dp3(struct tgsi_exec_machine *mach,
3032 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3033 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3037 fetch_source(mach, &arg[0], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
3038 fetch_source(mach, &arg[1], &inst->Src[1], chan, TGSI_EXEC_DATA_FLOAT);
3044 store_dest(mach, &arg[2], &inst->Dst[0], inst, chan);
3050 exec_dp4(struct tgsi_exec_machine *mach,
3056 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3057 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3061 fetch_source(mach, &arg[0], &inst->Src[0], chan, TGSI_EXEC_DATA_FLOAT);
3062 fetch_source(mach, &arg[1], &inst->Src[1], chan, TGSI_EXEC_DATA_FLOAT);
3068 store_dest(mach, &arg[2], &inst->Dst[0], inst, chan);
3074 exec_dp2(struct tgsi_exec_machine *mach,
3080 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3081 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3084 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3085 fetch_source(mach, &arg[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3090 store_dest(mach, &arg[2], &inst->Dst[0], inst, chan);
3096 exec_pk2h(struct tgsi_exec_machine *mach,
3102 fetch_source(mach, &arg[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3103 fetch_source(mach, &arg[1], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3110 store_dest(mach, &dst, &inst->Dst[0], inst, chan);
3116 exec_up2h(struct tgsi_exec_machine *mach,
3122 fetch_source(mach, &arg, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
3129 store_dest(mach, &dst[chan & 1], &inst->Dst[0], inst, chan);
3147 exec_ucmp(struct tgsi_exec_machine *mach,
3157 fetch_source(mach, &src[0], &inst->Src[0], chan,
3159 fetch_source(mach, &src[1], &inst->Src[1], chan,
3161 fetch_source(mach, &src[2], &inst->Src[2], chan,
3168 store_dest(mach, &dst.xyzw[chan], &inst->Dst[0], inst, chan);
3174 exec_dst(struct tgsi_exec_machine *mach,
3181 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3182 fetch_source(mach, &r[1], &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3186 fetch_source(mach, &d[TGSI_CHAN_Z], &inst->Src[0], TGSI_CHAN_Z, TGSI_EXEC_DATA_FLOAT);
3189 fetch_source(mach, &d[TGSI_CHAN_W], &inst->Src[1], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
3193 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_X);
3196 store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y);
3199 store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z);
3202 store_dest(mach, &d[TGSI_CHAN_W], &inst->Dst[0], inst, TGSI_CHAN_W);
3207 exec_log(struct tgsi_exec_machine *mach,
3212 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3217 store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_X);
3222 store_dest(mach, &r[0], &inst->Dst[0], inst, TGSI_CHAN_Y);
3225 store_dest(mach, &r[1], &inst->Dst[0], inst, TGSI_CHAN_Z);
3228 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W);
3233 exec_exp(struct tgsi_exec_machine *mach,
3238 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3242 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_X);
3246 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_Y);
3250 store_dest(mach, &r[2], &inst->Dst[0], inst, TGSI_CHAN_Z);
3253 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W);
3258 exec_lit(struct tgsi_exec_machine *mach,
3265 fetch_source(mach, &r[0], &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
3267 fetch_source(mach, &r[1], &inst->Src[0], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
3270 fetch_source(mach, &r[2], &inst->Src[0], TGSI_CHAN_W, TGSI_EXEC_DATA_FLOAT);
3275 store_dest(mach, &d[TGSI_CHAN_Z], &inst->Dst[0], inst, TGSI_CHAN_Z);
3279 store_dest(mach, &d[TGSI_CHAN_Y], &inst->Dst[0], inst, TGSI_CHAN_Y);
3283 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_X);
3287 store_dest(mach, &OneVec, &inst->Dst[0], inst, TGSI_CHAN_W);
3292 exec_break(struct tgsi_exec_machine *mach)
3294 if (mach->BreakType == TGSI_EXEC_BREAK_INSIDE_LOOP) {
3296 mach->LoopMask &= ~mach->ExecMask;
3297 /* Todo: if mach->LoopMask == 0, jump to end of loop */
3298 UPDATE_EXEC_MASK(mach);
3300 assert(mach->BreakType == TGSI_EXEC_BREAK_INSIDE_SWITCH);
3302 mach->Switch.mask = 0x0;
3304 UPDATE_EXEC_MASK(mach);
3309 exec_switch(struct tgsi_exec_machine *mach,
3312 assert(mach->SwitchStackTop < TGSI_EXEC_MAX_SWITCH_NESTING);
3313 assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
3315 mach->SwitchStack[mach->SwitchStackTop++] = mach->Switch;
3316 fetch_source(mach, &mach->Switch.selector, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
3317 mach->Switch.mask = 0x0;
3318 mach->Switch.defaultMask = 0x0;
3320 mach->BreakStack[mach->BreakStackTop++] = mach->BreakType;
3321 mach->BreakType = TGSI_EXEC_BREAK_INSIDE_SWITCH;
3323 UPDATE_EXEC_MASK(mach);
3327 exec_case(struct tgsi_exec_machine *mach,
3330 uint prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
3334 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_UINT);
3336 if (mach->Switch.selector.u[0] == src.u[0]) {
3339 if (mach->Switch.selector.u[1] == src.u[1]) {
3342 if (mach->Switch.selector.u[2] == src.u[2]) {
3345 if (mach->Switch.selector.u[3] == src.u[3]) {
3349 mach->Switch.defaultMask |= mask;
3351 mach->Switch.mask |= mask & prevMask;
3353 UPDATE_EXEC_MASK(mach);
3358 exec_default(struct tgsi_exec_machine *mach)
3360 uint prevMask = mach->SwitchStack[mach->SwitchStackTop - 1].mask;
3362 mach->Switch.mask |= ~mach->Switch.defaultMask & prevMask;
3364 UPDATE_EXEC_MASK(mach);
3368 exec_endswitch(struct tgsi_exec_machine *mach)
3370 mach->Switch = mach->SwitchStack[--mach->SwitchStackTop];
3371 mach->BreakType = mach->BreakStack[--mach->BreakStackTop];
3373 UPDATE_EXEC_MASK(mach);
3390 fetch_double_channel(struct tgsi_exec_machine *mach,
3399 fetch_source_d(mach, &src[0], reg, chan_0);
3400 fetch_source_d(mach, &src[1], reg, chan_1);
3411 store_double_channel(struct tgsi_exec_machine *mach,
3421 const uint execmask = mach->ExecMask;
3445 store_dest_double(mach, &dst[0], reg, chan_0);
3447 store_dest_double(mach, &dst[1], reg, chan_1);
3451 exec_double_unary(struct tgsi_exec_machine *mach,
3459 fetch_double_channel(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
3461 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
3464 fetch_double_channel(mach, &src, &inst->Src[0], TGSI_CHAN_Z, TGSI_CHAN_W);
3466 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
3471 exec_double_binary(struct tgsi_exec_machine *mach,
3491 fetch_double_channel(mach, &src[0], &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
3492 fetch_double_channel(mach, &src[1], &inst->Src[1], TGSI_CHAN_X, TGSI_CHAN_Y);
3494 store_double_channel(mach, &dst, &inst->Dst[0], inst, first_dest_chan, second_dest_chan);
3505 fetch_double_channel(mach, &src[0], &inst->Src[0], TGSI_CHAN_Z, TGSI_CHAN_W);
3506 fetch_double_channel(mach, &src[1], &inst->Src[1], TGSI_CHAN_Z, TGSI_CHAN_W);
3508 store_double_channel(mach, &dst, &inst->Dst[0], inst, first_dest_chan, second_dest_chan);
3513 exec_double_trinary(struct tgsi_exec_machine *mach,
3521 fetch_double_channel(mach, &src[0], &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
3522 fetch_double_channel(mach, &src[1], &inst->Src[1], TGSI_CHAN_X, TGSI_CHAN_Y);
3523 fetch_double_channel(mach, &src[2], &inst->Src[2], TGSI_CHAN_X, TGSI_CHAN_Y);
3525 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
3528 fetch_double_channel(mach, &src[0], &inst->Src[0], TGSI_CHAN_Z, TGSI_CHAN_W);
3529 fetch_double_channel(mach, &src[1], &inst->Src[1], TGSI_CHAN_Z, TGSI_CHAN_W);
3530 fetch_double_channel(mach, &src[2], &inst->Src[2], TGSI_CHAN_Z, TGSI_CHAN_W);
3532 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
3537 exec_dldexp(struct tgsi_exec_machine *mach,
3547 fetch_double_channel(mach, &src0, &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
3548 fetch_source(mach, &src1, &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_INT);
3550 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
3554 fetch_double_channel(mach, &src0, &inst->Src[0], TGSI_CHAN_Z, TGSI_CHAN_W);
3555 fetch_source(mach, &src1, &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_INT);
3557 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
3562 exec_dfracexp(struct tgsi_exec_machine *mach,
3569 fetch_double_channel(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
3572 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
3574 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
3577 store_dest(mach, &dst_exp, &inst->Dst[1], inst, chan);
3582 exec_arg0_64_arg1_32(struct tgsi_exec_machine *mach,
3593 fetch_double_channel(mach, &src0, &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
3594 fetch_source(mach, &src1, &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_INT);
3596 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
3600 fetch_double_channel(mach, &src0, &inst->Src[0], TGSI_CHAN_Z, TGSI_CHAN_W);
3601 fetch_source(mach, &src1, &inst->Src[1], TGSI_CHAN_Z, TGSI_EXEC_DATA_INT);
3603 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
3656 exec_load_img(struct tgsi_exec_machine *mach,
3668 unit = fetch_sampler_unit(mach, inst, 0);
3673 params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
3685 mach->Image->load(mach->Image, ¶ms,
3696 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
3702 exec_load_membuf(struct tgsi_exec_machine *mach,
3705 uint32_t unit = fetch_sampler_unit(mach, inst, 0);
3711 ptr = mach->LocalMem;
3712 size = mach->LocalMemSize;
3716 ptr = mach->Buffer->lookup(mach->Buffer, unit, &size);
3720 if (unit < ARRAY_SIZE(mach->Consts)) {
3721 ptr = mach->Consts[unit];
3722 size = mach->ConstsSize[unit];
3750 store_dest(mach, &rgba[chan], &inst->Dst[0], inst, chan);
3756 exec_load(struct tgsi_exec_machine *mach,
3760 exec_load_img(mach, inst);
3762 exec_load_membuf(mach, inst);
3766 fetch_store_img_unit(struct tgsi_exec_machine *mach,
3773 const uint execmask = mach->ExecMask;
3779 fetch_src_file_channel(mach,
3798 exec_store_img(struct tgsi_exec_machine *mach,
3809 unit = fetch_store_img_unit(mach, &inst->Dst[0]);
3814 params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
3836 mach->Image->store(mach->Image, ¶ms,
3843 exec_store_membuf(struct tgsi_exec_machine *mach,
3846 uint32_t unit = fetch_store_img_unit(mach, &inst->Dst[0]);
3849 int execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
3854 ptr = mach->LocalMem;
3855 size = mach->LocalMemSize;
3859 ptr = mach->Buffer->lookup(mach->Buffer, unit, &size);
3890 exec_store(struct tgsi_exec_machine *mach,
3894 exec_store_img(mach, inst);
3896 exec_store_membuf(mach, inst);
3900 exec_atomop_img(struct tgsi_exec_machine *mach,
3912 unit = fetch_sampler_unit(mach, inst, 0);
3917 params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
3949 mach->Image->op(mach->Image, ¶ms, inst->Instruction.Opcode,
3961 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
3967 exec_atomop_membuf(struct tgsi_exec_machine *mach,
3972 int execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
3980 uint32_t unit = fetch_sampler_unit(mach, inst, 0);
3982 char *buffer = mach->Buffer->lookup(mach->Buffer, unit, &size);
3993 if (likely(mach->LocalMemSize >= 4 && offset.u[i] <= mach->LocalMemSize - 4))
3994 ptr[i] = (char *)mach->LocalMem + offset.u[i];
4063 store_dest(mach, &r0, &inst->Dst[0], inst, chan);
4067 exec_atomop(struct tgsi_exec_machine *mach,
4071 exec_atomop_img(mach, inst);
4073 exec_atomop_membuf(mach, inst);
4077 exec_resq_img(struct tgsi_exec_machine *mach,
4086 unit = fetch_sampler_unit(mach, inst, 0);
4088 params.execmask = mach->ExecMask & mach->NonHelperMask & ~mach->KillMask;
4093 mach->Image->get_dims(mach->Image, ¶ms, result);
4103 store_dest(mach, &r[chan], &inst->Dst[0], inst, chan);
4109 exec_resq_buf(struct tgsi_exec_machine *mach,
4112 uint32_t unit = fetch_sampler_unit(mach, inst, 0);
4114 (void)mach->Buffer->lookup(mach->Buffer, unit, &size);
4122 store_dest(mach, &r, &inst->Dst[0], inst, TGSI_CHAN_X);
4128 exec_resq(struct tgsi_exec_machine *mach,
4132 exec_resq_img(mach, inst);
4134 exec_resq_buf(mach, inst);
4238 exec_t_2_64(struct tgsi_exec_machine *mach,
4247 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, src_datatype);
4249 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
4252 fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_Y, src_datatype);
4254 store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
4259 exec_64_2_t(struct tgsi_exec_machine *mach,
4273 fetch_double_channel(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
4275 fetch_double_channel(mach, &src, &inst->Src[0], TGSI_CHAN_Z, TGSI_CHAN_W);
4277 store_dest(mach, &dst, &inst->Dst[0], inst, bit - 1);
4810 exec_interp_at_sample(struct tgsi_exec_machine *mach,
4821 get_index_registers(mach, reg, &index, &index2D);
4822 float sample = mach->Imms[inst->Src[1].Register.Index][inst->Src[1].Register.SwizzleX];
4829 fetch_src_file_channel(mach, TGSI_FILE_INPUT, chan, &index, &index2D,
4840 mach->InputSampleOffsetApply[pos](mach, pos, chan, x, y, &result[chan]);
4842 store_dest(mach, &result[chan], &inst->Dst[0], inst, chan);
4848 exec_interp_at_offset(struct tgsi_exec_machine *mach,
4859 get_index_registers(mach, reg, &index, &index2D);
4862 fetch_source(mach, &ofsx, &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
4863 fetch_source(mach, &ofsy, &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
4869 fetch_src_file_channel(mach, TGSI_FILE_INPUT, chan, &index, &index2D, &result);
4870 mach->InputSampleOffsetApply[pos](mach, pos, chan, ofsx.f[chan], ofsy.f[chan], &result);
4871 store_dest(mach, &result, &inst->Dst[0], inst, chan);
4877 exec_interp_at_centroid(struct tgsi_exec_machine *mach,
4886 get_index_registers(mach, reg, &index, &index2D);
4905 fetch_src_file_channel(mach, TGSI_FILE_INPUT, chan, &index, &index2D,
4907 store_dest(mach, &result[chan], &inst->Dst[0], inst, chan);
4920 struct tgsi_exec_machine *mach,
4930 exec_vector_unary(mach, inst, micro_arl, TGSI_EXEC_DATA_FLOAT);
4934 exec_vector_unary(mach, inst, micro_mov, TGSI_EXEC_DATA_FLOAT);
4938 exec_lit(mach, inst);
4942 exec_scalar_unary(mach, inst, micro_rcp, TGSI_EXEC_DATA_FLOAT);
4946 exec_scalar_unary(mach, inst, micro_rsq, TGSI_EXEC_DATA_FLOAT);
4950 exec_exp(mach, inst);
4954 exec_log(mach, inst);
4958 exec_vector_binary(mach, inst, micro_mul, TGSI_EXEC_DATA_FLOAT);
4962 exec_vector_binary(mach, inst, micro_add, TGSI_EXEC_DATA_FLOAT);
4966 exec_dp3(mach, inst);
4970 exec_dp4(mach, inst);
4974 exec_dst(mach, inst);
4978 exec_vector_binary(mach, inst, micro_min, TGSI_EXEC_DATA_FLOAT);
4982 exec_vector_binary(mach, inst, micro_max, TGSI_EXEC_DATA_FLOAT);
4986 exec_vector_binary(mach, inst, micro_slt, TGSI_EXEC_DATA_FLOAT);
4990 exec_vector_binary(mach, inst, micro_sge, TGSI_EXEC_DATA_FLOAT);
4994 exec_vector_trinary(mach, inst, micro_mad, TGSI_EXEC_DATA_FLOAT);
4998 exec_vector_trinary(mach, inst, micro_lrp, TGSI_EXEC_DATA_FLOAT);
5002 exec_scalar_unary(mach, inst, micro_sqrt, TGSI_EXEC_DATA_FLOAT);
5006 exec_vector_unary(mach, inst, micro_frc, TGSI_EXEC_DATA_FLOAT);
5010 exec_vector_unary(mach, inst, micro_flr, TGSI_EXEC_DATA_FLOAT);
5014 exec_vector_unary(mach, inst, micro_rnd, TGSI_EXEC_DATA_FLOAT);
5018 exec_scalar_unary(mach, inst, micro_exp2, TGSI_EXEC_DATA_FLOAT);
5022 exec_scalar_unary(mach, inst, micro_lg2, TGSI_EXEC_DATA_FLOAT);
5026 exec_scalar_binary(mach, inst, micro_pow, TGSI_EXEC_DATA_FLOAT);
5030 exec_vector_binary(mach, inst, micro_ldexp, TGSI_EXEC_DATA_FLOAT);
5034 exec_scalar_unary(mach, inst, micro_cos, TGSI_EXEC_DATA_FLOAT);
5038 exec_vector_unary(mach, inst, micro_ddx_fine, TGSI_EXEC_DATA_FLOAT);
5042 exec_vector_unary(mach, inst, micro_ddx, TGSI_EXEC_DATA_FLOAT);
5046 exec_vector_unary(mach, inst, micro_ddy_fine, TGSI_EXEC_DATA_FLOAT);
5050 exec_vector_unary(mach, inst, micro_ddy, TGSI_EXEC_DATA_FLOAT);
5054 exec_kill (mach);
5058 exec_kill_if (mach, inst);
5062 exec_pk2h(mach, inst);
5078 exec_vector_binary(mach, inst, micro_seq, TGSI_EXEC_DATA_FLOAT);
5082 exec_vector_binary(mach, inst, micro_sgt, TGSI_EXEC_DATA_FLOAT);
5086 exec_scalar_unary(mach, inst, micro_sin, TGSI_EXEC_DATA_FLOAT);
5090 exec_vector_binary(mach, inst, micro_sle, TGSI_EXEC_DATA_FLOAT);
5094 exec_vector_binary(mach, inst, micro_sne, TGSI_EXEC_DATA_FLOAT);
5101 exec_tex(mach, inst, TEX_MODIFIER_NONE, 1);
5108 exec_tex(mach, inst, TEX_MODIFIER_LOD_BIAS, 1);
5117 exec_txd(mach, inst);
5124 exec_tex(mach, inst, TEX_MODIFIER_EXPLICIT_LOD, 1);
5131 exec_tex(mach, inst, TEX_MODIFIER_PROJECTED, 1);
5138 exec_tex(mach, inst, TEX_MODIFIER_GATHER, 2);
5144 exec_lodq(mach, inst);
5148 exec_up2h(mach, inst);
5164 exec_vector_unary(mach, inst, micro_arr, TGSI_EXEC_DATA_FLOAT);
5169 if (mach->ExecMask) {
5179 mach->CallStack[mach->CallStackTop].CondStackTop = mach->CondStackTop;
5180 mach->CallStack[mach->CallStackTop].LoopStackTop = mach->LoopStackTop;
5181 mach->CallStack[mach->CallStackTop].ContStackTop = mach->ContStackTop;
5182 mach->CallStack[mach->CallStackTop].SwitchStackTop = mach->SwitchStackTop;
5183 mach->CallStack[mach->CallStackTop].BreakStackTop = mach->BreakStackTop;
5185 mach->CallStack[mach->CallStackTop].ReturnAddr = *pc;
5187 mach->CallStackTop++;
5190 assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
5191 assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
5192 assert(mach->ContStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
5193 assert(mach->SwitchStackTop < TGSI_EXEC_MAX_SWITCH_NESTING);
5194 assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
5195 assert(mach->FuncStackTop < TGSI_EXEC_MAX_CALL_NESTING);
5197 mach->CondStack[mach->CondStackTop++] = mach->CondMask;
5198 mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask;
5199 mach->ContStack[mach->ContStackTop++] = mach->ContMask;
5200 mach->SwitchStack[mach->SwitchStackTop++] = mach->Switch;
5201 mach->BreakStack[mach->BreakStackTop++] = mach->BreakType;
5202 mach->FuncStack[mach->FuncStackTop++] = mach->FuncMask;
5208 assert(mach->Instructions[*pc].Instruction.Opcode
5214 mach->FuncMask &= ~mach->ExecMask;
5215 UPDATE_EXEC_MASK(mach);
5217 if (mach->FuncMask == 0x0) {
5220 if (mach->CallStackTop == 0) {
5222 mach->CondStackTop = 0;
5223 mach->LoopStackTop = 0;
5224 mach->ContStackTop = 0;
5225 mach->LoopLabelStackTop = 0;
5226 mach->SwitchStackTop = 0;
5227 mach->BreakStackTop = 0;
5232 assert(mach->CallStackTop > 0);
5233 mach->CallStackTop--;
5235 mach->CondStackTop = mach->CallStack[mach->CallStackTop].CondStackTop;
5236 mach->CondMask = mach->CondStack[mach->CondStackTop];
5238 mach->LoopStackTop = mach->CallStack[mach->CallStackTop].LoopStackTop;
5239 mach->LoopMask = mach->LoopStack[mach->LoopStackTop];
5241 mach->ContStackTop = mach->CallStack[mach->CallStackTop].ContStackTop;
5242 mach->ContMask = mach->ContStack[mach->ContStackTop];
5244 mach->SwitchStackTop = mach->CallStack[mach->CallStackTop].SwitchStackTop;
5245 mach->Switch = mach->SwitchStack[mach->SwitchStackTop];
5247 mach->BreakStackTop = mach->CallStack[mach->CallStackTop].BreakStackTop;
5248 mach->BreakType = mach->BreakStack[mach->BreakStackTop];
5250 assert(mach->FuncStackTop > 0);
5251 mach->FuncMask = mach->FuncStack[--mach->FuncStackTop];
5253 *pc = mach->CallStack[mach->CallStackTop].ReturnAddr;
5255 UPDATE_EXEC_MASK(mach);
5260 exec_vector_unary(mach, inst, micro_sgn, TGSI_EXEC_DATA_FLOAT);
5264 exec_vector_trinary(mach, inst, micro_cmp, TGSI_EXEC_DATA_FLOAT);
5268 exec_vector_binary(mach, inst, micro_div, TGSI_EXEC_DATA_FLOAT);
5272 exec_dp2(mach, inst);
5277 assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
5278 mach->CondStack[mach->CondStackTop++] = mach->CondMask;
5282 mach->CondMask &= ~(1 << i);
5284 UPDATE_EXEC_MASK(mach);
5286 if (!mach->CondMask)
5292 assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING);
5293 mach->CondStack[mach->CondStackTop++] = mach->CondMask;
5297 mach->CondMask &= ~(1 << i);
5299 UPDATE_EXEC_MASK(mach);
5301 if (!mach->CondMask)
5309 assert(mach->CondStackTop > 0);
5310 prevMask = mach->CondStack[mach->CondStackTop - 1];
5311 mach->CondMask = ~mach->CondMask & prevMask;
5312 UPDATE_EXEC_MASK(mach);
5315 if (!mach->CondMask)
5322 assert(mach->CondStackTop > 0);
5323 mach->CondMask = mach->CondStack[--mach->CondStackTop];
5324 UPDATE_EXEC_MASK(mach);
5330 conditional_emit_primitive(mach);
5336 exec_vector_unary(mach, inst, micro_ceil, TGSI_EXEC_DATA_FLOAT);
5340 exec_vector_unary(mach, inst, micro_i2f, TGSI_EXEC_DATA_INT);
5344 exec_vector_unary(mach, inst, micro_not, TGSI_EXEC_DATA_UINT);
5348 exec_vector_unary(mach, inst, micro_trunc, TGSI_EXEC_DATA_FLOAT);
5352 exec_vector_binary(mach, inst, micro_shl, TGSI_EXEC_DATA_UINT);
5356 exec_vector_binary(mach, inst, micro_and, TGSI_EXEC_DATA_UINT);
5360 exec_vector_binary(mach, inst, micro_or, TGSI_EXEC_DATA_UINT);
5364 exec_vector_binary(mach, inst, micro_mod, TGSI_EXEC_DATA_INT);
5368 exec_vector_binary(mach, inst, micro_xor, TGSI_EXEC_DATA_UINT);
5372 exec_txf(mach, inst);
5376 exec_txq(mach, inst);
5380 emit_vertex(mach, inst);
5384 emit_primitive(mach, inst);
5389 assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
5390 assert(mach->ContStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
5391 assert(mach->LoopLabelStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
5392 assert(mach->BreakStackTop < TGSI_EXEC_MAX_BREAK_STACK);
5394 mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask;
5395 mach->ContStack[mach->ContStackTop++] = mach->ContMask;
5396 mach->LoopLabelStack[mach->LoopLabelStackTop++] = *pc - 1;
5397 mach->BreakStack[mach->BreakStackTop++] = mach->BreakType;
5398 mach->BreakType = TGSI_EXEC_BREAK_INSIDE_LOOP;
5403 assert(mach->ContStackTop > 0);
5404 mach->ContMask = mach->ContStack[mach->ContStackTop - 1];
5405 UPDATE_EXEC_MASK(mach);
5406 if (mach->ExecMask) {
5408 assert(mach->LoopLabelStackTop > 0);
5409 *pc = mach->LoopLabelStack[mach->LoopLabelStackTop - 1] + 1;
5413 assert(mach->LoopStackTop > 0);
5414 mach->LoopMask = mach->LoopStack[--mach->LoopStackTop];
5416 assert(mach->ContStackTop > 0);
5417 mach->ContMask = mach->ContStack[--mach->ContStackTop];
5418 assert(mach->LoopLabelStackTop > 0);
5419 --mach->LoopLabelStackTop;
5421 mach->BreakType = mach->BreakStack[--mach->BreakStackTop];
5423 UPDATE_EXEC_MASK(mach);
5427 exec_break(mach);
5432 mach->ContMask &= ~mach->ExecMask;
5433 /* Todo: if mach->LoopMask == 0, jump to end of loop */
5434 UPDATE_EXEC_MASK(mach);
5446 assert(mach->CallStackTop > 0);
5447 mach->CallStackTop--;
5449 mach->CondStackTop = mach->CallStack[mach->CallStackTop].CondStackTop;
5450 mach->CondMask = mach->CondStack[mach->CondStackTop];
5452 mach->LoopStackTop = mach->CallStack[mach->CallStackTop].LoopStackTop;
5453 mach->LoopMask = mach->LoopStack[mach->LoopStackTop];
5455 mach->ContStackTop = mach->CallStack[mach->CallStackTop].ContStackTop;
5456 mach->ContMask = mach->ContStack[mach->ContStackTop];
5458 mach->SwitchStackTop = mach->CallStack[mach->CallStackTop].SwitchStackTop;
5459 mach->Switch = mach->SwitchStack[mach->SwitchStackTop];
5461 mach->BreakStackTop = mach->CallStack[mach->CallStackTop].BreakStackTop;
5462 mach->BreakType = mach->BreakStack[mach->BreakStackTop];
5464 assert(mach->FuncStackTop > 0);
5465 mach->FuncMask = mach->FuncStack[--mach->FuncStackTop];
5467 *pc = mach->CallStack[mach->CallStackTop].ReturnAddr;
5469 UPDATE_EXEC_MASK(mach);
5476 exec_vector_unary(mach, inst, micro_f2i, TGSI_EXEC_DATA_FLOAT);
5480 exec_vector_binary(mach, inst, micro_fseq, TGSI_EXEC_DATA_FLOAT);
5484 exec_vector_binary(mach, inst, micro_fsge, TGSI_EXEC_DATA_FLOAT);
5488 exec_vector_binary(mach, inst, micro_fslt, TGSI_EXEC_DATA_FLOAT);
5492 exec_vector_binary(mach, inst, micro_fsne, TGSI_EXEC_DATA_FLOAT);
5496 exec_vector_binary(mach, inst, micro_idiv, TGSI_EXEC_DATA_INT);
5500 exec_vector_binary(mach, inst, micro_imax, TGSI_EXEC_DATA_INT);
5504 exec_vector_binary(mach, inst, micro_imin, TGSI_EXEC_DATA_INT);
5508 exec_vector_unary(mach, inst, micro_ineg, TGSI_EXEC_DATA_INT);
5512 exec_vector_binary(mach, inst, micro_isge, TGSI_EXEC_DATA_INT);
5516 exec_vector_binary(mach, inst, micro_ishr, TGSI_EXEC_DATA_INT);
5520 exec_vector_binary(mach, inst, micro_islt, TGSI_EXEC_DATA_INT);
5524 exec_vector_unary(mach, inst, micro_f2u, TGSI_EXEC_DATA_FLOAT);
5528 exec_vector_unary(mach, inst, micro_u2f, TGSI_EXEC_DATA_UINT);
5532 exec_vector_binary(mach, inst, micro_uadd, TGSI_EXEC_DATA_INT);
5536 exec_vector_binary(mach, inst, micro_udiv, TGSI_EXEC_DATA_UINT);
5540 exec_vector_trinary(mach, inst, micro_umad, TGSI_EXEC_DATA_UINT);
5544 exec_vector_binary(mach, inst, micro_umax, TGSI_EXEC_DATA_UINT);
5548 exec_vector_binary(mach, inst, micro_umin, TGSI_EXEC_DATA_UINT);
5552 exec_vector_binary(mach, inst, micro_umod, TGSI_EXEC_DATA_UINT);
5556 exec_vector_binary(mach, inst, micro_umul, TGSI_EXEC_DATA_UINT);
5560 exec_vector_binary(mach, inst, micro_imul_hi, TGSI_EXEC_DATA_INT);
5564 exec_vector_binary(mach, inst, micro_umul_hi, TGSI_EXEC_DATA_UINT);
5568 exec_vector_binary(mach, inst, micro_useq, TGSI_EXEC_DATA_UINT);
5572 exec_vector_binary(mach, inst, micro_usge, TGSI_EXEC_DATA_UINT);
5576 exec_vector_binary(mach, inst, micro_ushr, TGSI_EXEC_DATA_UINT);
5580 exec_vector_binary(mach, inst, micro_uslt, TGSI_EXEC_DATA_UINT);
5584 exec_vector_binary(mach, inst, micro_usne, TGSI_EXEC_DATA_UINT);
5588 exec_switch(mach, inst);
5592 exec_case(mach, inst);
5596 exec_default(mach);
5600 exec_endswitch(mach);
5604 exec_txf(mach, inst);
5608 exec_txf(mach, inst);
5612 exec_sample(mach, inst, TEX_MODIFIER_NONE, FALSE);
5616 exec_sample(mach, inst, TEX_MODIFIER_LOD_BIAS, FALSE);
5620 exec_sample(mach, inst, TEX_MODIFIER_NONE, TRUE);
5624 exec_sample(mach, inst, TEX_MODIFIER_LEVEL_ZERO, TRUE);
5628 exec_sample_d(mach, inst);
5632 exec_sample(mach, inst, TEX_MODIFIER_EXPLICIT_LOD, FALSE);
5636 exec_sample(mach, inst, TEX_MODIFIER_GATHER, FALSE);
5640 exec_txq(mach, inst);
5652 exec_lodq(mach, inst);
5656 exec_vector_unary(mach, inst, micro_uarl, TGSI_EXEC_DATA_UINT);
5660 exec_ucmp(mach, inst);
5664 exec_vector_unary(mach, inst, micro_iabs, TGSI_EXEC_DATA_INT);
5668 exec_vector_unary(mach, inst, micro_isgn, TGSI_EXEC_DATA_INT);
5676 exec_tex(mach, inst, TEX_MODIFIER_NONE, 2);
5683 exec_tex(mach, inst, TEX_MODIFIER_LOD_BIAS, 2);
5690 exec_tex(mach, inst, TEX_MODIFIER_EXPLICIT_LOD, 2);
5694 exec_vector_trinary(mach, inst, micro_ibfe, TGSI_EXEC_DATA_INT);
5697 exec_vector_trinary(mach, inst, micro_ubfe, TGSI_EXEC_DATA_UINT);
5700 exec_vector_quaternary(mach, inst, micro_bfi, TGSI_EXEC_DATA_UINT);
5703 exec_vector_unary(mach, inst, micro_brev, TGSI_EXEC_DATA_UINT);
5706 exec_vector_unary(mach, inst, micro_popc, TGSI_EXEC_DATA_UINT);
5709 exec_vector_unary(mach, inst, micro_lsb, TGSI_EXEC_DATA_UINT);
5712 exec_vector_unary(mach, inst, micro_imsb, TGSI_EXEC_DATA_INT);
5715 exec_vector_unary(mach, inst, micro_umsb, TGSI_EXEC_DATA_UINT);
5719 exec_t_2_64(mach, inst, micro_f2d, TGSI_EXEC_DATA_FLOAT);
5723 exec_64_2_t(mach, inst, micro_d2f);
5727 exec_double_unary(mach, inst, micro_dabs);
5731 exec_double_unary(mach, inst, micro_dneg);
5735 exec_double_binary(mach, inst, micro_dadd, TGSI_EXEC_DATA_DOUBLE);
5739 exec_double_binary(mach, inst, micro_ddiv, TGSI_EXEC_DATA_DOUBLE);
5743 exec_double_binary(mach, inst, micro_dmul, TGSI_EXEC_DATA_DOUBLE);
5747 exec_double_binary(mach, inst, micro_dmax, TGSI_EXEC_DATA_DOUBLE);
5751 exec_double_binary(mach, inst, micro_dmin, TGSI_EXEC_DATA_DOUBLE);
5755 exec_double_binary(mach, inst, micro_dslt, TGSI_EXEC_DATA_UINT);
5759 exec_double_binary(mach, inst, micro_dsge, TGSI_EXEC_DATA_UINT);
5763 exec_double_binary(mach, inst, micro_dseq, TGSI_EXEC_DATA_UINT);
5767 exec_double_binary(mach, inst, micro_dsne, TGSI_EXEC_DATA_UINT);
5771 exec_double_unary(mach, inst, micro_drcp);
5775 exec_double_unary(mach, inst, micro_dsqrt);
5779 exec_double_unary(mach, inst, micro_drsq);
5783 exec_double_trinary(mach, inst, micro_dmad);
5787 exec_double_unary(mach, inst, micro_dfrac);
5791 exec_double_unary(mach, inst, micro_dflr);
5795 exec_dldexp(mach, inst);
5799 exec_dfracexp(mach, inst);
5803 exec_t_2_64(mach, inst, micro_i2d, TGSI_EXEC_DATA_FLOAT);
5807 exec_64_2_t(mach, inst, micro_d2i);
5811 exec_t_2_64(mach, inst, micro_u2d, TGSI_EXEC_DATA_FLOAT);
5815 exec_64_2_t(mach, inst, micro_d2u);
5819 exec_load(mach, inst);
5823 exec_store(mach, inst);
5837 exec_atomop(mach, inst);
5841 exec_resq(mach, inst);
5849 exec_double_unary(mach, inst, micro_i64abs);
5853 exec_double_unary(mach, inst, micro_i64sgn);
5857 exec_double_unary(mach, inst, micro_i64neg);
5861 exec_double_binary(mach, inst, micro_u64seq, TGSI_EXEC_DATA_UINT);
5865 exec_double_binary(mach, inst, micro_u64sne, TGSI_EXEC_DATA_UINT);
5869 exec_double_binary(mach, inst, micro_i64slt, TGSI_EXEC_DATA_UINT);
5872 exec_double_binary(mach, inst, micro_u64slt, TGSI_EXEC_DATA_UINT);
5876 exec_double_binary(mach, inst, micro_i64sge, TGSI_EXEC_DATA_UINT);
5879 exec_double_binary(mach, inst, micro_u64sge, TGSI_EXEC_DATA_UINT);
5883 exec_double_binary(mach, inst, micro_i64min, TGSI_EXEC_DATA_INT64);
5886 exec_double_binary(mach, inst, micro_u64min, TGSI_EXEC_DATA_UINT64);
5889 exec_double_binary(mach, inst, micro_i64max, TGSI_EXEC_DATA_INT64);
5892 exec_double_binary(mach, inst, micro_u64max, TGSI_EXEC_DATA_UINT64);
5895 exec_double_binary(mach, inst, micro_u64add, TGSI_EXEC_DATA_UINT64);
5898 exec_double_binary(mach, inst, micro_u64mul, TGSI_EXEC_DATA_UINT64);
5901 exec_arg0_64_arg1_32(mach, inst, micro_u64shl);
5904 exec_arg0_64_arg1_32(mach, inst, micro_i64shr);
5907 exec_arg0_64_arg1_32(mach, inst, micro_u64shr);
5910 exec_double_binary(mach, inst, micro_u64div, TGSI_EXEC_DATA_UINT64);
5913 exec_double_binary(mach, inst, micro_i64div, TGSI_EXEC_DATA_INT64);
5916 exec_double_binary(mach, inst, micro_u64mod, TGSI_EXEC_DATA_UINT64);
5919 exec_double_binary(mach, inst, micro_i64mod, TGSI_EXEC_DATA_INT64);
5923 exec_t_2_64(mach, inst, micro_f2u64, TGSI_EXEC_DATA_FLOAT);
5927 exec_t_2_64(mach, inst, micro_f2i64, TGSI_EXEC_DATA_FLOAT);
5931 exec_t_2_64(mach, inst, micro_u2i64, TGSI_EXEC_DATA_INT);
5934 exec_t_2_64(mach, inst, micro_i2i64, TGSI_EXEC_DATA_INT);
5938 exec_double_unary(mach, inst, micro_d2u64);
5942 exec_double_unary(mach, inst, micro_d2i64);
5946 exec_64_2_t(mach, inst, micro_u642f);
5949 exec_64_2_t(mach, inst, micro_i642f);
5953 exec_double_unary(mach, inst, micro_u642d);
5956 exec_double_unary(mach, inst, micro_i642d);
5959 exec_interp_at_sample(mach, inst);
5962 exec_interp_at_offset(mach, inst);
5965 exec_interp_at_centroid(mach, inst);
5974 tgsi_exec_machine_setup_masks(struct tgsi_exec_machine *mach)
5978 mach->KillMask = 0;
5979 mach->OutputVertexOffset = 0;
5981 if (mach->ShaderType == PIPE_SHADER_GEOMETRY) {
5983 mach->OutputPrimCount[i] = 0;
5984 mach->Primitives[i][0] = 0;
5990 if (mach->NonHelperMask == 0)
5991 mach->NonHelperMask = default_mask;
5992 mach->CondMask = default_mask;
5993 mach->LoopMask = default_mask;
5994 mach->ContMask = default_mask;
5995 mach->FuncMask = default_mask;
5996 mach->ExecMask = default_mask;
5998 mach->Switch.mask = default_mask;
6000 assert(mach->CondStackTop == 0);
6001 assert(mach->LoopStackTop == 0);
6002 assert(mach->ContStackTop == 0);
6003 assert(mach->SwitchStackTop == 0);
6004 assert(mach->BreakStackTop == 0);
6005 assert(mach->CallStackTop == 0);
6013 tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
6017 mach->pc = start_pc;
6020 tgsi_exec_machine_setup_masks(mach);
6023 for (i = 0; i < mach->NumDeclarations; i++) {
6024 exec_declaration( mach, mach->Declarations+i );
6035 memset(mach->Temps, 0, sizeof(temps));
6036 if (mach->Outputs)
6037 memset(mach->Outputs, 0, sizeof(outputs));
6044 while (mach->pc != -1) {
6049 tgsi_dump_instruction(&mach->Instructions[mach->pc], inst++);
6052 assert(mach->pc < (int) mach->NumInstructions);
6053 barrier_hit = exec_instruction(mach, mach->Instructions + mach->pc, &mach->pc);
6056 if (barrier_hit && mach->ShaderType == PIPE_SHADER_COMPUTE)
6061 if (memcmp(&temps[i], &mach->Temps[i], sizeof(temps[i]))) {
6064 memcpy(&temps[i], &mach->Temps[i], sizeof(temps[i]));
6078 if (mach->Outputs) {
6080 if (memcmp(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]))) {
6083 memcpy(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]));
6104 if (mach->ShaderType == PIPE_SHADER_FRAGMENT) {
6109 mach->Outputs[0].xyzw[2].f[i] *= ctx->DrawBuffer->_DepthMaxF;
6116 assert(mach->CondStackTop == 0);
6117 assert(mach->LoopStackTop == 0);
6118 assert(mach->ContStackTop == 0);
6119 assert(mach->SwitchStackTop == 0);
6120 assert(mach->BreakStackTop == 0);
6121 assert(mach->CallStackTop == 0);
6123 return ~mach->KillMask;