Ejemplo n.º 1
0
 private void BindConstantBufferDeclaration(ConstantBufferSyntax declaration)
 {
     // Add constant buffer fields to global scope.
     throw new NotImplementedException();
     //foreach (var field in declaration.Declarations)
     //    BindGlobalVariable(field);
 }
Ejemplo n.º 2
0
 public override void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     ProcessItem(node.Name, node.Name.Text, node.GetTextSpanSafe(), NavigateToItemKind.Structure, node.Parent, Glyph.ConstantBuffer);
     foreach (var member in node.Declarations)
     {
         Visit(member);
     }
 }
        internal ConstantBufferSymbol(ConstantBufferSyntax syntax, Symbol parent)
            : base(SymbolKind.ConstantBuffer, syntax.Name.Text, string.Empty, parent)
        {
            Syntax = syntax;

            SourceTree           = syntax.SyntaxTree;
            Locations            = ImmutableArray.Create(syntax.Name.SourceRange);
            DeclaringSyntaxNodes = ImmutableArray.Create((SyntaxNodeBase)syntax);
        }
Ejemplo n.º 4
0
 public override void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     CreateTag(
         BlockSpanType.Type,
         node.Name,
         node.CloseBraceToken,
         node.ConstantBufferKeyword,
         node.Name,
         false);
     base.VisitConstantBuffer(node);
 }
        private AnnotationShaderGroup UpdateVariables(SyntaxTree tree, ShaderType header)
        {
            // Probably should use a combined approach of the compiled shader with the source for annotations to get this info.
            //
            // because now it will also show unused buffers/variables
            // Also when you register buffers to the same slot and use only one, the shader will compile and work, but I don't have
            // any idea about which buffer I need to bind to the pipeline, so current solution show errorbox
            AnnotationFactory.Start(header);
            IList <SyntaxNodeBase> nodes     = tree.Root.ChildNodes;
            List <string>          registers = new List <string>();

            foreach (SyntaxNodeBase node in nodes)
            {
                if (node is ConstantBufferSyntax)
                {
                    ConstantBufferSyntax structType = (ConstantBufferSyntax)node;
                    string register = structType.Register.Register.ValueText;

                    AnnotationFactory.BeginGroup();
                    if (registers.Contains(register))
                    {
                        MessageBox.Show($"Register: {register}\nDefined multiple times, ShaderBox can not decides which one needs to be binded.\n\nWill be resolved in a future release.", "Unsupported operation", MessageBoxButton.OK, MessageBoxImage.Error);
                        AnnotationFactory.DestroyGroup();
                        return(null);
                    }
                    registers.Add(register);
                    AnnotationFactory.SetRegister(register);
                    foreach (VariableDeclarationStatementSyntax syntax in structType.Declarations)
                    {
                        if (!ParseVariableDeclarationStatementSyntax(syntax, registers))
                        {
                            return(null);
                        }
                    }
                    AnnotationFactory.EndGroup();
                }

                if (node is VariableDeclarationStatementSyntax)
                {
                    AnnotationFactory.BeginGroup();
                    if (!ParseVariableDeclarationStatementSyntax((VariableDeclarationStatementSyntax)node, registers))
                    {
                        return(null);
                    }
                    AnnotationFactory.EndGroup();
                }
            }

            return(AnnotationFactory.End());
        }
Ejemplo n.º 6
0
        private BoundConstantBuffer BindConstantBufferDeclaration(ConstantBufferSyntax declaration)
        {
            var constantBufferSymbol = new ConstantBufferSymbol(declaration, null);

            var variables = new List <BoundMultipleVariableDeclarations>();

            // Add constant buffer fields to global scope.
            foreach (var field in declaration.Declarations)
            {
                var boundStatement = Bind(field, x => BindVariableDeclarationStatement(x, constantBufferSymbol));
                variables.Add(boundStatement);

                foreach (var boundDeclaration in boundStatement.VariableDeclarations)
                {
                    constantBufferSymbol.AddMember(boundDeclaration.VariableSymbol);
                }
            }

            return(new BoundConstantBuffer(constantBufferSymbol, variables.ToImmutableArray()));
        }
Ejemplo n.º 7
0
        private BoundConstantBuffer BindConstantBufferDeclaration(ConstantBufferSyntax declaration)
        {
            var constantBufferSymbol = new ConstantBufferSymbol(declaration, null);

            var variables = new List<BoundMultipleVariableDeclarations>();

            // Add constant buffer fields to global scope.
            foreach (var field in declaration.Declarations)
            {
                var boundStatement = Bind(field, x => BindVariableDeclarationStatement(x, constantBufferSymbol));
                variables.Add(boundStatement);

                foreach (var boundDeclaration in boundStatement.VariableDeclarations)
                    constantBufferSymbol.AddMember(boundDeclaration.VariableSymbol);
            }

            return new BoundConstantBuffer(constantBufferSymbol, variables.ToImmutableArray());
        }
Ejemplo n.º 8
0
 public override void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     CreateTag(node.Name, node.CloseBraceToken);
 }
Ejemplo n.º 9
0
        public override void VisitConstantBuffer(ConstantBufferSyntax node)
        {
            CreateTag(node.Name, HlslClassificationTypeNames.ConstantBufferIdentifier);

            base.VisitConstantBuffer(node);
        }
Ejemplo n.º 10
0
 public override IEnumerable <EditorNavigationTarget> VisitConstantBuffer(ConstantBufferSyntax node)
 {
     yield return(CreateTypeTarget(node.Name, node.GetTextSpanSafe(), Glyph.ConstantBuffer,
                                   node.Declarations.OfType <VariableDeclarationStatementSyntax>()));
 }
Ejemplo n.º 11
0
        public override void VisitConstantBuffer(ConstantBufferSyntax node)
        {
            CreateTag(node.Name, _classificationService.ClassIdentifier);

            base.VisitConstantBuffer(node);
        }
Ejemplo n.º 12
0
 public ConstantBufferSymbol GetDeclaredSymbol(ConstantBufferSyntax syntax)
 {
     var result = _bindingResult.GetBoundNode(syntax) as BoundConstantBuffer;
     return result?.ConstantBufferSymbol;
 }
Ejemplo n.º 13
0
 internal ConstantBufferSymbol(ConstantBufferSyntax syntax, Symbol parent)
     : base(SymbolKind.ConstantBuffer, syntax.Name.Text, string.Empty, parent)
 {
     Syntax = syntax;
 }
Ejemplo n.º 14
0
 public virtual void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     DefaultVisit(node);
 }
Ejemplo n.º 15
0
 public override void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     CreateTag(node.Name, node.CloseBraceToken);
 }
Ejemplo n.º 16
0
 public virtual void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     DefaultVisit(node);
 }
Ejemplo n.º 17
0
        public override void VisitConstantBuffer(ConstantBufferSyntax node)
        {
            CreateTag(node.Name, _classificationService.ClassIdentifier);

            base.VisitConstantBuffer(node);
        }
Ejemplo n.º 18
0
 internal ConstantBufferSymbol(ConstantBufferSyntax syntax, Symbol parent)
     : base(SymbolKind.ConstantBuffer, syntax.Name.Text, string.Empty, parent)
 {
     Syntax = syntax;
 }
Ejemplo n.º 19
0
        public ConstantBufferSymbol GetDeclaredSymbol(ConstantBufferSyntax syntax)
        {
            var result = _bindingResult.GetBoundNode(syntax) as BoundConstantBuffer;

            return(result?.ConstantBufferSymbol);
        }
Ejemplo n.º 20
0
 public override void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     ProcessItem(node.Name, node.Name.Text, node.GetTextSpanSafe(), NavigateToItemKind.Structure, node.Parent, Glyph.ConstantBuffer);
     foreach (var member in node.Declarations)
         Visit(member);
 }
Ejemplo n.º 21
0
 private void BindConstantBufferDeclaration(ConstantBufferSyntax declaration)
 {
     // Add constant buffer fields to global scope.
     throw new NotImplementedException();
     //foreach (var field in declaration.Declarations)
     //    BindGlobalVariable(field);
 }