示例#1
0
        public static string LoadConstant(CodeGenContext context, AstOperation operation)
        {
            IAstNode src1 = operation.GetSource(1);

            string offsetExpr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 1));

            offsetExpr = Enclose(offsetExpr, src1, Instruction.ShiftRightS32, isLhs: true);

            return(OperandManager.GetConstantBufferName(operation.GetSource(0), offsetExpr, context.Config.Type));
        }
示例#2
0
        public static string LoadConstant(CodeGenContext context, AstOperation operation)
        {
            IAstNode src1 = operation.GetSource(0);
            IAstNode src2 = operation.GetSource(1);

            string offsetExpr = GetSoureExpr(context, src2, GetSrcVarType(operation.Inst, 1));

            offsetExpr = Enclose(offsetExpr, src2, Instruction.ShiftRightS32, isLhs: true);

            if (src1 is AstOperand oper && oper.Type == OperandType.Constant)
            {
                return(OperandManager.GetConstantBufferName(oper.Value, offsetExpr, context.Config.Stage, context.CbIndexable));
            }