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

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

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

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

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