Esempio n. 1
0
        private void button_GetAllInstInfo_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = Pusher._pusher.GetAllInstName(out JsonString);

                foreach (DataRow dr in dt.Rows)
                {
                    string name = dr[0].ToString();
                    string desc = dr[1].ToString();
                    InstName.Add(name);
                    InstDesc.Add(desc);
                }
                //从服务器获取仪器信息,并添加到仪器列表
                //comboBox_Inst.Items.Clear();
                //comboBox_Inst.Items.AddRange(InstDesc.ToArray<string>());
                //isComboxInstClear = true;
                //comboBox_Inst.SelectedIndex = 0;
                //dataGridView1.DataSource = dt;
                //dataGridView1.Refresh();
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        private static bool IsOrderDependant(InstName name)
        {
            switch (name)
            {
            case InstName.Atom:
            case InstName.AtomCas:
            case InstName.Atoms:
            case InstName.AtomsCas:
            case InstName.Ld:
            case InstName.Ldg:
            case InstName.Ldl:
            case InstName.Lds:
            case InstName.Suatom:
            case InstName.SuatomB:
            case InstName.SuatomB2:
            case InstName.SuatomCas:
            case InstName.SuatomCasB:
            case InstName.Suld:
            case InstName.SuldB:
            case InstName.SuldD:
            case InstName.SuldDB:
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 public InstOp(ulong address, ulong rawOpCode, InstName name, InstEmitter emitter, InstProps props)
 {
     Address   = address;
     RawOpCode = rawOpCode;
     Name      = name;
     Emitter   = emitter;
     Props     = props;
 }
Esempio n. 4
0
 public PatternTreeNode(InstName name, Func <T, bool> match, TreeNodeType type = TreeNodeType.Op, byte order = 0, bool isImm = false)
 {
     Name   = name;
     _match = match;
     Type   = type;
     Order  = order;
     IsImm  = isImm;
     Uses   = new List <PatternTreeNodeUse>();
 }
Esempio n. 5
0
            public bool IsImmInst(InstName name)
            {
                InstOp op = Block.OpCodes[Index];

                return(op.Name == name && op.Props.HasFlag(InstProps.Ib));
            }
Esempio n. 6
0
        private static void SetUserAttributeUses(ShaderConfig config, InstName name, ulong opCode)
        {
            int  offset;
            int  count    = 1;
            bool isStore  = false;
            bool indexed  = false;
            bool perPatch = false;

            if (name == InstName.Ast)
            {
                InstAst opAst = new InstAst(opCode);
                count    = (int)opAst.AlSize + 1;
                offset   = opAst.Imm11;
                indexed  = opAst.Phys;
                perPatch = opAst.P;
                isStore  = true;
            }
            else if (name == InstName.Ald)
            {
                InstAld opAld = new InstAld(opCode);
                count    = (int)opAld.AlSize + 1;
                offset   = opAld.Imm11;
                indexed  = opAld.Phys;
                perPatch = opAld.P;
                isStore  = opAld.O;
            }
            else /* if (name == InstName.Ipa) */
            {
                InstIpa opIpa = new InstIpa(opCode);
                offset  = opIpa.Imm10;
                indexed = opIpa.Idx;
            }

            if (indexed)
            {
                if (isStore)
                {
                    config.SetAllOutputUserAttributes();
                }
                else
                {
                    config.SetAllInputUserAttributes();
                }
            }
            else
            {
                for (int elemIndex = 0; elemIndex < count; elemIndex++)
                {
                    int attr = offset + elemIndex * 4;
                    if (attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd)
                    {
                        int index = (attr - AttributeConsts.UserAttributeBase) / 16;

                        if (isStore)
                        {
                            config.SetOutputUserAttribute(index, perPatch);
                        }
                        else
                        {
                            config.SetInputUserAttribute(index, perPatch);
                        }
                    }

                    if (!isStore &&
                        ((attr >= AttributeConsts.FrontColorDiffuseR && attr < AttributeConsts.ClipDistance0) ||
                         (attr >= AttributeConsts.TexCoordBase && attr < AttributeConsts.TexCoordEnd)))
                    {
                        config.SetUsedFeature(FeatureFlags.FixedFuncAttr);
                    }
                }
            }
        }
Esempio n. 7
0
        public Operand TryGetComparisonResult(Condition condition)
        {
            if (_optOpLastCompare == null || _optOpLastCompare != _optOpLastFlagSet)
            {
                return(null);
            }

            Operand n = _optCmpTempN;
            Operand m = _optCmpTempM;

            InstName cmpName = _optOpLastCompare.Instruction.Name;

            if (cmpName == InstName.Subs)
            {
                switch (condition)
                {
                case Condition.Eq:   return(ICompareEqual(n, m));

                case Condition.Ne:   return(ICompareNotEqual(n, m));

                case Condition.GeUn: return(ICompareGreaterOrEqualUI(n, m));

                case Condition.LtUn: return(ICompareLessUI(n, m));

                case Condition.GtUn: return(ICompareGreaterUI(n, m));

                case Condition.LeUn: return(ICompareLessOrEqualUI(n, m));

                case Condition.Ge:   return(ICompareGreaterOrEqual(n, m));

                case Condition.Lt:   return(ICompareLess(n, m));

                case Condition.Gt:   return(ICompareGreater(n, m));

                case Condition.Le:   return(ICompareLessOrEqual(n, m));
                }
            }
            else if (cmpName == InstName.Adds && _optOpLastCompare is IOpCodeAluImm op)
            {
                // There are several limitations that needs to be taken into account for CMN comparisons:
                // - The unsigned comparisons are not valid, as they depend on the
                // carry flag value, and they will have different values for addition and
                // subtraction. For addition, it's carry, and for subtraction, it's borrow.
                // So, we need to make sure we're not doing a unsigned compare for the CMN case.
                // - We can only do the optimization for the immediate variants,
                // because when the second operand value is exactly INT_MIN, we can't
                // negate the value as theres no positive counterpart.
                // Such invalid values can't be encoded on the immediate encodings.
                if (op.RegisterSize == RegisterSize.Int32)
                {
                    m = Const((int)-op.Immediate);
                }
                else
                {
                    m = Const(-op.Immediate);
                }

                switch (condition)
                {
                case Condition.Eq: return(ICompareEqual(n, m));

                case Condition.Ne: return(ICompareNotEqual(n, m));

                case Condition.Ge: return(ICompareGreaterOrEqual(n, m));

                case Condition.Lt: return(ICompareLess(n, m));

                case Condition.Gt: return(ICompareGreater(n, m));

                case Condition.Le: return(ICompareLessOrEqual(n, m));
                }
            }

            return(null);
        }
Esempio n. 8
0
 public InstDescriptor(InstName name, InstEmitter emitter)
 {
     Name    = name;
     Emitter = emitter;
 }