Exemple #1
0
        /// <summary>
        /// Construct a ForExpr with an attribute and an unroll depth.
        /// </summary>
        /// <param name="initializer">Initializer expression.</param>
        /// <param name="test">Test expression, must evaluate to a scalar boolean.</param>
        /// <param name="update">Update expression.</param>
        /// <param name="attributes">Loop attribute.</param>
        /// <param name="unrollDepth">Depth with which to unroll the loop, used with LoopAttributes.UNROLL</param>
        public ForExpr(DeclExpr initializer, Expr test, Expr update, LoopAttributes attributes, int unrollDepth)
        {
            if (!test.HasValue())
                throw new HlslDomException("Test expression doesn't return a value!");

            if (!(test.Value.ValueType is BoolType))
                throw new HlslDomException("Test expression does not return a boolean value!");

            Initializer = initializer;
            Test = test;
            Update = update;
            Attributes = attributes;
            UnrollDepth = unrollDepth;
        }
Exemple #2
0
 /// <summary>
 /// Construct a ForExpr with an attribute.
 /// </summary>
 /// <param name="initializer">Initializer expression.</param>
 /// <param name="test">Test expression, must evaluate to a scalar boolean.</param>
 /// <param name="update">Update expression.</param>
 /// <param name="attributes">Loop attribute.</param>
 public ForExpr(DeclExpr initializer, Expr test, Expr update, LoopAttributes attributes)
     : this(initializer, test, update, attributes, 0)
 {
     if (attributes == LoopAttributes.UNROLL)
         throw new HlslDomException("Unroll attribute specified without an unroll depth!");
 }