Пример #1
0
        D3D11_BLEND GetTermBlendDescImpl(
            TermInfo info,
            AttrCase channel,
            TermFlavor flavor)
        {
            // Need to look for a match on our target type
            var left  = info._left;
            var right = info._right;

            AttrInfo factor = null;

            if (left.IsFactor(flavor, channel))
            {
                factor = right;
            }
            else if (right.IsFactor(flavor, channel))
            {
                factor = left;
            }
            else
            {
                throw OperationTooComplexError(info.Range);
            }

            return(GetFactorBlendDesc(
                       factor,
                       channel));
        }
Пример #2
0
 D3D11_BLEND GetTermBlendDesc(
     AttrInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     return(GetTermBlendDescImpl((dynamic)info, channel, flavor));
 }
Пример #3
0
        ChannelBlendDesc GetChannelBlendDescImpl(
            OpInfo info,
            AttrCase channel)
        {
            // \todo: Need to pick whether left or right is src/dest
            ChannelBlendDesc result;

            var left  = info._left;
            var right = info._right;

            if (CanUseAs(left, channel, TermFlavor.Src) && CanUseAs(right, channel, TermFlavor.Dest))
            {
                result.srcBlend  = GetTermBlendDesc(info._left, channel, TermFlavor.Src);
                result.destBlend = GetTermBlendDesc(info._right, channel, TermFlavor.Dest);
            }
            else if (CanUseAs(left, channel, TermFlavor.Dest) && CanUseAs(right, channel, TermFlavor.Src))
            {
                result.destBlend = GetTermBlendDesc(info._left, channel, TermFlavor.Dest);
                result.srcBlend  = GetTermBlendDesc(info._right, channel, TermFlavor.Src);
            }
            else
            {
                throw OperationTooComplexError(info.Range);
            }
            result.op = info._op;
            return(result);
        }
Пример #4
0
 bool CanUseAsImpl(
     AttrInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     return(info.IsFactor(flavor, channel));
 }
Пример #5
0
 public override bool IsFactor(
     TermFlavor flavor,
     AttrCase channel)
 {
     if (flavor == TermFlavor.Dest)
     {
         if (channel == AttrCase.Color)
         {
             return(_color == D3D11_BLEND.D3D11_BLEND_DEST_COLOR);
         }
         else if (channel == AttrCase.Alpha)
         {
             return(_alpha == D3D11_BLEND.D3D11_BLEND_DEST_ALPHA);
         }
     }
     else if (flavor == TermFlavor.Src)
     {
         if (channel == AttrCase.Color)
         {
             return(_color == D3D11_BLEND.D3D11_BLEND_SRC_COLOR);
         }
         else if (channel == AttrCase.Alpha)
         {
             return(_alpha == D3D11_BLEND.D3D11_BLEND_SRC_ALPHA);
         }
     }
     return(false);
 }
Пример #6
0
 D3D11_BLEND GetSubFactorBlendDescImpl(
     AttrInfo left,
     AttrInfo right,
     AttrCase channel)
 {
     throw OperationTooComplexError(right.Range);
 }
Пример #7
0
 D3D11_BLEND GetFactorBlendDescImpl(
     SubInfo info,
     AttrCase channel)
 {
     return(GetSubFactorBlendDescImpl(
                (dynamic)info._left,
                (dynamic)info._right,
                channel));
 }
Пример #8
0
 public override bool IsFactor(
     TermFlavor flavor,
     AttrCase channel)
 {
     if (flavor == TermFlavor.Dest)
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
 bool CanUseAs(
     AttrInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     if (info.IsFactor(flavor, channel))
     {
         return(true);
     }
     return(CanUseAsImpl((dynamic)info, channel, flavor));
 }
Пример #10
0
        D3D11_BLEND GetTermBlendDescImpl(
            AttrInfo info,
            AttrCase channel,
            TermFlavor flavor)
        {
            if (info.IsFactor(flavor, channel))
            {
                return(D3D11_BLEND.D3D11_BLEND_ONE);
            }

            throw OperationTooComplexError(info.Range);
        }
Пример #11
0
        bool CanUseAsImpl(
            TermInfo info,
            AttrCase channel,
            TermFlavor flavor)
        {
            var  left        = info._left;
            var  right       = info._right;
            bool canUseLeft  = CanUseAs(left, channel, flavor);
            bool canUseRight = CanUseAs(right, channel, flavor);

            return(canUseLeft || canUseRight);
        }
Пример #12
0
        D3D11_BLEND GetFactorBlendDescImpl(
            FactorInfo info,
            AttrCase channel)
        {
            switch (channel)
            {
            case AttrCase.Color:
                return(info._color);

            case AttrCase.Alpha:
                return(info._alpha);

            default:
                throw OperationTooComplexError(info.Range);
            }
        }
Пример #13
0
        D3D11_BLEND GetSubFactorBlendDescImpl(
            LitInfo left,
            AttrInfo right,
            AttrCase channel)
        {
            var value = left._value;

            if (value != 1.0f)
            {
                throw OperationTooComplexError(right.Range);
            }

            var factor = GetFactorBlendDesc(right, channel);

            switch (factor)
            {
            case D3D11_BLEND.D3D11_BLEND_SRC_COLOR:
                return(D3D11_BLEND.D3D11_BLEND_INV_SRC_COLOR);

            case D3D11_BLEND.D3D11_BLEND_SRC_ALPHA:
                return(D3D11_BLEND.D3D11_BLEND_INV_SRC_ALPHA);

            case D3D11_BLEND.D3D11_BLEND_DEST_ALPHA:
                return(D3D11_BLEND.D3D11_BLEND_INV_DEST_ALPHA);

            case D3D11_BLEND.D3D11_BLEND_DEST_COLOR:
                return(D3D11_BLEND.D3D11_BLEND_INV_DEST_COLOR);

            case D3D11_BLEND.D3D11_BLEND_BLEND_FACTOR:
                return(D3D11_BLEND.D3D11_BLEND_INV_BLEND_FACTOR);

            case D3D11_BLEND.D3D11_BLEND_SRC1_COLOR:
                return(D3D11_BLEND.D3D11_BLEND_INV_SRC1_COLOR);

            case D3D11_BLEND.D3D11_BLEND_SRC1_ALPHA:
                return(D3D11_BLEND.D3D11_BLEND_INV_SRC1_ALPHA);

            default:
                throw OperationTooComplexError(right.Range);
            }
        }
 D3D11_BLEND GetFactorBlendDescImpl(
     AttrInfo info,
     AttrCase channel)
 {
     throw OperationTooComplexError(info.Range);
 }
 D3D11_BLEND GetFactorBlendDescImpl(
     DestInfo info,
     AttrCase channel)
 {
     return D3D11_BLEND.D3D11_BLEND_ONE;
 }
        ChannelBlendDesc GetChannelBlendDescImpl(
            OpInfo info,
            AttrCase channel)
        {
            // \todo: Need to pick whether left or right is src/dest
            ChannelBlendDesc result;

            var left = info._left;
            var right = info._right;
            if (CanUseAs(left, channel, TermFlavor.Src) && CanUseAs(right, channel, TermFlavor.Dest))
            {
                result.srcBlend = GetTermBlendDesc(info._left, channel, TermFlavor.Src);
                result.destBlend = GetTermBlendDesc(info._right, channel, TermFlavor.Dest);
            }
            else if (CanUseAs(left, channel, TermFlavor.Dest) && CanUseAs(right, channel, TermFlavor.Src))
            {
                result.destBlend = GetTermBlendDesc(info._left, channel, TermFlavor.Dest);
                result.srcBlend = GetTermBlendDesc(info._right, channel, TermFlavor.Src);
            }
            else
            {
                throw OperationTooComplexError(info.Range);
            }
            result.op = info._op;
            return result;
        }
 D3D11_BLEND GetFactorBlendDesc(
     AttrInfo info,
     AttrCase channel )
 {
     return GetFactorBlendDescImpl((dynamic)info, channel);
 }
 D3D11_BLEND GetTermBlendDesc(
     AttrInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     return GetTermBlendDescImpl((dynamic)info, channel, flavor);
 }
Пример #19
0
 D3D11_BLEND GetFactorBlendDescImpl(
     DestInfo info,
     AttrCase channel)
 {
     return(D3D11_BLEND.D3D11_BLEND_ONE);
 }
 bool CanUseAsImpl(
     TermInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     var left = info._left;
     var right = info._right;
     bool canUseLeft = CanUseAs(left, channel, flavor);
     bool canUseRight = CanUseAs(right, channel, flavor);
     return canUseLeft || canUseRight;
 }
        D3D11_BLEND GetSubFactorBlendDescImpl(
            LitInfo left,
            AttrInfo right,
            AttrCase channel)
        {
            var value = left._value;
            if (value != 1.0f)
            {
                throw OperationTooComplexError(right.Range);
            }

            var factor = GetFactorBlendDesc(right, channel);
            switch( factor )
            {
            case D3D11_BLEND.D3D11_BLEND_SRC_COLOR:
                    return D3D11_BLEND.D3D11_BLEND_INV_SRC_COLOR;
            case D3D11_BLEND.D3D11_BLEND_SRC_ALPHA:
                    return D3D11_BLEND.D3D11_BLEND_INV_SRC_ALPHA;
            case D3D11_BLEND.D3D11_BLEND_DEST_ALPHA:
                    return D3D11_BLEND.D3D11_BLEND_INV_DEST_ALPHA;
            case D3D11_BLEND.D3D11_BLEND_DEST_COLOR:
                    return D3D11_BLEND.D3D11_BLEND_INV_DEST_COLOR;
            case D3D11_BLEND.D3D11_BLEND_BLEND_FACTOR:
                    return D3D11_BLEND.D3D11_BLEND_INV_BLEND_FACTOR;
            case D3D11_BLEND.D3D11_BLEND_SRC1_COLOR:
                    return D3D11_BLEND.D3D11_BLEND_INV_SRC1_COLOR;
            case D3D11_BLEND.D3D11_BLEND_SRC1_ALPHA:
                    return D3D11_BLEND.D3D11_BLEND_INV_SRC1_ALPHA;
            default:
                    throw OperationTooComplexError(right.Range);
            }
        }
 public override bool IsFactor(
     TermFlavor flavor,
     AttrCase channel)
 {
     if (flavor == TermFlavor.Dest)
         return true;
     return false;
 }
Пример #23
0
 ChannelBlendDesc GetChannelBlendDesc(
     AttrInfo info,
     AttrCase channel)
 {
     return(GetChannelBlendDescImpl((dynamic)info, channel));
 }
        D3D11_BLEND GetTermBlendDescImpl(
            TermInfo info,
            AttrCase channel,
            TermFlavor flavor)
        {
            // Need to look for a match on our target type
            var left = info._left;
            var right = info._right;

            AttrInfo factor = null;
            if (left.IsFactor(flavor, channel))
            {
                factor = right;
            }
            else if (right.IsFactor(flavor, channel))
            {
                factor = left;
            }
            else
            {
                throw OperationTooComplexError(info.Range);
            }

            return GetFactorBlendDesc(
                factor,
                channel );
        }
Пример #25
0
 ChannelBlendDesc GetChannelBlendDescImpl(
     AttrInfo info,
     AttrCase channel)
 {
     throw OperationTooComplexError(info.Range);
 }
Пример #26
0
 D3D11_BLEND GetFactorBlendDesc(
     AttrInfo info,
     AttrCase channel)
 {
     return(GetFactorBlendDescImpl((dynamic)info, channel));
 }
 D3D11_BLEND GetFactorBlendDescImpl(
     FactorInfo info,
     AttrCase channel)
 {
     switch (channel)
     {
         case AttrCase.Color:
             return info._color;
         case AttrCase.Alpha:
             return info._alpha;
         default:
             throw OperationTooComplexError(info.Range);
     }
 }
 bool CanUseAsImpl(
     AttrInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     return info.IsFactor(flavor, channel);
 }
 D3D11_BLEND GetFactorBlendDescImpl(
     SubInfo info,
     AttrCase channel)
 {
     return GetSubFactorBlendDescImpl(
         (dynamic)info._left,
         (dynamic)info._right,
         channel);
 }
 ChannelBlendDesc GetChannelBlendDesc(
     AttrInfo info,
     AttrCase channel)
 {
     return GetChannelBlendDescImpl((dynamic)info, channel);
 }
 D3D11_BLEND GetSubFactorBlendDescImpl(
     AttrInfo left,
     AttrInfo right,
     AttrCase channel)
 {
     throw OperationTooComplexError(right.Range);
 }
 ChannelBlendDesc GetChannelBlendDescImpl(
     AttrInfo info,
     AttrCase channel)
 {
     throw OperationTooComplexError(info.Range);
 }
        D3D11_BLEND GetTermBlendDescImpl(
            AttrInfo info,
            AttrCase channel,
            TermFlavor flavor)
        {
            if (info.IsFactor(flavor, channel))
            {
                return D3D11_BLEND.D3D11_BLEND_ONE;
            }

            throw OperationTooComplexError(info.Range);
        }
Пример #34
0
 D3D11_BLEND GetFactorBlendDescImpl(
     AttrInfo info,
     AttrCase channel)
 {
     throw OperationTooComplexError(info.Range);
 }
 public virtual bool IsFactor(
     TermFlavor flavor,
     AttrCase channel)
 {
     return false;
 }
 bool CanUseAs(
     AttrInfo info,
     AttrCase channel,
     TermFlavor flavor)
 {
     if (info.IsFactor(flavor, channel))
         return true;
     return CanUseAsImpl((dynamic)info, channel, flavor);
 }
 public override bool IsFactor(
     TermFlavor flavor,
     AttrCase channel)
 {
     if (flavor == TermFlavor.Dest)
     {
         if (channel == AttrCase.Color)
             return _color == D3D11_BLEND.D3D11_BLEND_DEST_COLOR;
         else if (channel == AttrCase.Alpha)
             return _alpha == D3D11_BLEND.D3D11_BLEND_DEST_ALPHA;
     }
     else if (flavor == TermFlavor.Src)
     {
         if (channel == AttrCase.Color)
             return _color == D3D11_BLEND.D3D11_BLEND_SRC_COLOR;
         else if (channel == AttrCase.Alpha)
             return _alpha == D3D11_BLEND.D3D11_BLEND_SRC_ALPHA;
     }
     return false;
 }
Пример #38
0
 public virtual bool IsFactor(
     TermFlavor flavor,
     AttrCase channel)
 {
     return(false);
 }