コード例 #1
0
        public override string VisitIdentifierName(IdentifierNameSyntax node)
        {
            SymbolInfo symbolInfo         = GetModel(node).GetSymbolInfo(node);
            ISymbol    symbol             = symbolInfo.Symbol;
            string     containingTypeName = Utilities.GetFullName(symbolInfo.Symbol.ContainingType);

            if (containingTypeName == "ShaderGen.ShaderBuiltins")
            {
                TryRecognizeBuiltInVariable(symbolInfo);
            }
            if (symbol.Kind == SymbolKind.Field && containingTypeName == _containingTypeName)
            {
                string             symbolName         = symbol.Name;
                ResourceDefinition referencedResource = _backend.GetContext(_setName).Resources.Single(rd => rd.Name == symbolName);
                _resourcesUsed.Add(referencedResource);
                _shaderFunction.UsesTexture2DMS |= referencedResource.ValueType.Name == "ShaderGen.Texture2DMSResource";

                return(_backend.CorrectFieldAccess(symbolInfo));
            }
            else if (symbol.Kind == SymbolKind.Property)
            {
                return(_backend.FormatInvocation(_setName, containingTypeName, symbol.Name, Array.Empty <InvocationParameterInfo>()));
            }

            string mapped = _backend.CSharpToShaderIdentifierName(symbolInfo);

            return(_backend.CorrectIdentifier(mapped));
        }
コード例 #2
0
        public override string VisitIdentifierName(IdentifierNameSyntax node)
        {
            SymbolInfo symbolInfo         = GetModel(node).GetSymbolInfo(node);
            ISymbol    symbol             = symbolInfo.Symbol;
            string     containingTypeName = Utilities.GetFullName(symbolInfo.Symbol.ContainingType);

            if (symbol.Kind == SymbolKind.Field && containingTypeName == _containingTypeName)
            {
                return(_backend.CorrectFieldAccess(symbolInfo));
            }
            string mapped = _backend.CSharpToShaderIdentifierName(symbolInfo);

            return(_backend.CorrectIdentifier(mapped));
        }
コード例 #3
0
        public override string VisitIdentifierName(IdentifierNameSyntax node)
        {
            SymbolInfo symbolInfo         = GetModel(node).GetSymbolInfo(node);
            ISymbol    symbol             = symbolInfo.Symbol;
            string     containingTypeName = Utilities.GetFullName(symbolInfo.Symbol.ContainingType);

            if (containingTypeName == "ShaderGen.ShaderBuiltins")
            {
                TryRecognizeBuiltInVariable(symbolInfo);
            }
            if (symbol.Kind == SymbolKind.Field && containingTypeName == _containingTypeName)
            {
                return(_backend.CorrectFieldAccess(symbolInfo));
            }
            else if (symbol.Kind == SymbolKind.Property)
            {
                return(_backend.FormatInvocation(_setName, containingTypeName, symbol.Name, Array.Empty <InvocationParameterInfo>()));
            }

            string mapped = _backend.CSharpToShaderIdentifierName(symbolInfo);

            return(_backend.CorrectIdentifier(mapped));
        }