Example #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);
 }
Example #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);
        }
Example #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());
        }
        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()));
        }
Example #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());
        }
Example #8
0
 public override void VisitConstantBuffer(ConstantBufferSyntax node)
 {
     CreateTag(node.Name, node.CloseBraceToken);
 }
        public override void VisitConstantBuffer(ConstantBufferSyntax node)
        {
            CreateTag(node.Name, HlslClassificationTypeNames.ConstantBufferIdentifier);

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

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

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

            return(result?.ConstantBufferSymbol);
        }
 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);
 }
Example #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);
 }