예제 #1
0
        public static void Ald(EmitterContext context)
        {
            OpCodeAttribute op = (OpCodeAttribute)context.CurrOp;

            Operand[] elems = new Operand[op.Count];

            for (int index = 0; index < op.Count; index++)
            {
                Operand src = Attribute(op.AttributeOffset + index * 4);

                context.Copy(elems[index] = Local(), src);
            }

            for (int index = 0; index < op.Count; index++)
            {
                Register rd = new Register(op.Rd.Index + index, RegisterType.Gpr);

                if (rd.IsRZ)
                {
                    break;
                }

                context.Copy(Register(rd), elems[index]);
            }
        }
예제 #2
0
        public static void Ast(EmitterContext context)
        {
            OpCodeAttribute op = (OpCodeAttribute)context.CurrOp;

            for (int index = 0; index < op.Count; index++)
            {
                if (op.Rd.Index + index > RegisterConsts.RegisterZeroIndex)
                {
                    break;
                }

                Register rd = new Register(op.Rd.Index + index, RegisterType.Gpr);

                if (op.Phys)
                {
                    Operand userAttrOffset = context.ISubtract(GetSrcA(context), Const(AttributeConsts.UserAttributeBase));
                    Operand userAttrIndex  = context.ShiftRightU32(userAttrOffset, Const(2));

                    context.StoreAttribute(Const(AttributeConsts.UserAttributeBase), userAttrIndex, Register(rd));

                    context.Config.SetUsedFeature(FeatureFlags.OaIndexing);
                }
                else
                {
                    Operand dest = Attribute(op.AttributeOffset + index * 4);

                    context.FlagAttributeWritten(dest.Value);

                    context.Copy(dest, Register(rd));
                }
            }
        }
예제 #3
0
    private void loadHandler(System.Type type, BaseHandler handler)
    {
        object[] objs = type.GetCustomAttributes(typeof(OpCodeAttribute), true);
        foreach (object obj in objs)
        {
            OpCodeAttribute attr = obj as OpCodeAttribute;
            if (attr != null)
            {
                int[] opcodes = attr.opCodes;
                for (int i = 0; i < opcodes.Length; i++)
                {
                    int curOpcode = opcodes[i];
                    List <BaseHandler> handlerList = null;

                    if (!_handlers.ContainsKey(curOpcode))
                    {
                        handlerList          = new List <BaseHandler>();
                        _handlers[curOpcode] = handlerList;
                    }
                    else
                    {
                        handlerList = _handlers[curOpcode];
                    }

                    handlerList.Add(handler);
                }
            }
        }
    }
예제 #4
0
        public static void Ast(EmitterContext context)
        {
            OpCodeAttribute op = (OpCodeAttribute)context.CurrOp;

            for (int index = 0; index < op.Count; index++)
            {
                if (op.Rd.Index + index > RegisterConsts.RegisterZeroIndex)
                {
                    break;
                }

                Register rd = new Register(op.Rd.Index + index, RegisterType.Gpr);

                Operand dest = Attribute(op.AttributeOffset + index * 4);

                context.Copy(dest, Register(rd));
            }
        }
예제 #5
0
        public static void Ald(EmitterContext context)
        {
            OpCodeAttribute op = (OpCodeAttribute)context.CurrOp;

            Operand primVertex = context.Copy(GetSrcC(context));

            for (int index = 0; index < op.Count; index++)
            {
                Register rd = new Register(op.Rd.Index + index, RegisterType.Gpr);

                if (rd.IsRZ)
                {
                    break;
                }

                if (op.Phys)
                {
                    Operand userAttrOffset = context.ISubtract(GetSrcA(context), Const(AttributeConsts.UserAttributeBase));
                    Operand userAttrIndex  = context.ShiftRightU32(userAttrOffset, Const(2));

                    context.Copy(Register(rd), context.LoadAttribute(Const(AttributeConsts.UserAttributeBase), userAttrIndex, primVertex));

                    context.Config.SetUsedFeature(FeatureFlags.IaIndexing);
                }
                else if (op.Rc.IsRZ)
                {
                    Operand src = Attribute(op.AttributeOffset + index * 4);

                    context.FlagAttributeRead(src.Value);

                    context.Copy(Register(rd), src);
                }
                else
                {
                    Operand src = Const(op.AttributeOffset + index * 4);

                    context.FlagAttributeRead(src.Value);

                    context.Copy(Register(rd), context.LoadAttribute(src, Const(0), primVertex));
                }
            }
        }
예제 #6
0
        public static void Ald(EmitterContext context)
        {
            OpCodeAttribute op = (OpCodeAttribute)context.CurrOp;

            Operand primVertex = context.Copy(GetSrcC(context));

            for (int index = 0; index < op.Count; index++)
            {
                Register rd = new Register(op.Rd.Index + index, RegisterType.Gpr);

                if (rd.IsRZ)
                {
                    break;
                }

                Operand src = Attribute(op.AttributeOffset + index * 4);

                context.Copy(Register(rd), context.LoadAttribute(src, primVertex));
            }
        }