예제 #1
0
 private MidExp SimplifyExpImpl(MidAttributeFetch exp, SimplifyEnv env)
 {
     return(_exps.AttributeFetch(
                exp.Range,
                exp.Obj,
                exp.Attribute));
 }
예제 #2
0
        public MidAttributeFetch CleanupExp(MidAttributeFetch exp)
        {
            var oldAttr = exp.Attribute;
            var newAttr = MapOldToNew(oldAttr);

            return(_exps.AttributeFetch(exp.Range, exp.Obj, newAttr));
        }
예제 #3
0
            public MidExp PreTransform(
                MidAttributeFetch fetch)
            {
                AttributeInfo info;

                if (!_attrInfos.TryGetValue(fetch.Attribute, out info))
                {
                    return(fetch);
                }

                var fieldExps = (from f in info.Fields
                                 select _exps.AttributeFetch(fetch.Range, fetch.Obj, f.AttrDecl)).ToArray();

                foreach (var f in info.Fields)
                {
                    f.AttrDecl.IsOutput = true;
                }

                return(new MidStructVal(
                           fetch.Range,
                           fetch.Type,
                           fieldExps));
            }
예제 #4
0
 private static void DumpExpImpl(
     MidAttributeFetch attrFetch,
     Span span)
 {
     span.Write("{0}.{1}", attrFetch.Obj.Dump(), attrFetch.Attribute.Name);
 }
        private AttrInfo DecomposeAttrImpl(
            MidAttributeFetch exp,
            DecomposeAttrContext context)
        {
            string obj = exp.Obj.ToString();

            if (obj == "__ps2om")
            {
                // The operand is then a source to the
                // blending operation

                var srcAttr = exp.Attribute;

                switch (context.flavor)
                {
                case AttrCase.Color:
                    SetSource(ref _renderTargetSources[context.index].colorExp, srcAttr);
                    return new SrcInfo(exp.Range);
                case AttrCase.Alpha:
                    SetSource(ref _renderTargetSources[context.index].alphaExp, srcAttr);
                    return new FactorInfo(exp.Range, D3D11_BLEND.D3D11_BLEND_SRC_ALPHA);
                case AttrCase.Combined:
                    SetSource(ref _renderTargetSources[context.index].combinedExp, srcAttr);
                    return new SrcInfo(exp.Range);
                default:
                    throw OperationTooComplexError(exp.Range);
                }
            }
            else if (obj == "OM_Dest")
            {
                switch (context.flavor)
                {
                case AttrCase.Color:
                        return new FactorInfo(exp.Range, D3D11_BLEND.D3D11_BLEND_DEST_COLOR);
                case AttrCase.Alpha:
                        return new FactorInfo(exp.Range, D3D11_BLEND.D3D11_BLEND_DEST_ALPHA);
                case AttrCase.Combined:
                    return new FactorInfo(
                        exp.Range,
                        D3D11_BLEND.D3D11_BLEND_DEST_COLOR,
                        D3D11_BLEND.D3D11_BLEND_DEST_ALPHA);
                default:
                    throw OperationTooComplexError(exp.Range);
                }
            }
            else
            {
                throw OperationTooComplexError(exp.Range);
            }
        }
 private EmitValHLSL EmitExpImpl(MidAttributeFetch fetch, Span span)
 {
     var obj = EmitExp(fetch.Obj, span);
     return FetchAttr(obj, fetch.Attribute, span);
 }
 public void PreEmitExpImpl(
     MidAttributeFetch exp,
     Span span)
 {
     PreEmitExp(exp.Obj, span);
 }
예제 #8
0
 private void TransformChildrenImpl(
     MidAttributeFetch fetch)
 {
     fetch.Obj = (MidPath)Transform(fetch.Obj);
 }
예제 #9
0
 private MidExp SimplifyExpImpl(MidAttributeFetch exp, SimplifyEnv env)
 {
     return _exps.AttributeFetch(
         exp.Range,
         exp.Obj,
         exp.Attribute);
 }
예제 #10
0
 public MidAttributeFetch CleanupExp( MidAttributeFetch exp )
 {
     var oldAttr = exp.Attribute;
     var newAttr = MapOldToNew( oldAttr );
     return _exps.AttributeFetch( exp.Range, exp.Obj, newAttr );
 }
 private void TransformChildrenImpl(
     MidAttributeFetch fetch)
 {
     fetch.Obj = (MidPath) Transform(fetch.Obj);
 }
            public MidExp PreTransform(
                MidAttributeFetch fetch)
            {
                AttributeInfo info;
                if (!_attrInfos.TryGetValue(fetch.Attribute, out info))
                    return fetch;

                var fieldExps = (from f in info.Fields
                                 select _exps.AttributeFetch(fetch.Range,  fetch.Obj, f.AttrDecl )).ToArray();

                foreach( var f in info.Fields )
                {
                    f.AttrDecl.IsOutput = true;
                }

                return new MidStructVal(
                    fetch.Range,
                    fetch.Type,
                    fieldExps );
            }