Example #1
0
        private void ParseConstantBuffers(UnifiedShaderInfo info, List <UnifiedShaderToken> tokens)
        {
            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.OpenBrace);

            while (tokens[0].TokenType == UnifiedShaderTokenType.StringToken && tokens[0].Text == "cbuffer")
            {
                var buffer = new ConstantBufferInfo();
                ParseConstantBuffer(buffer, tokens);
                info.ConstantBuffers.Add(buffer);
            }

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.CloseBrace);
        }
Example #2
0
        private void ParseConstantBuffer(ConstantBufferInfo buffer, List <UnifiedShaderToken> tokens)
        {
            ExpectToken(ConsumeToken(tokens), "cbuffer");
            var name = ConsumeToken(tokens);

            ExpectToken(name, UnifiedShaderTokenType.StringToken);

            buffer.Name      = name.Text;
            buffer.Variables = new List <ParameterInfo>();

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.OpenBrace);

            ParseParameterList(buffer.Variables, tokens);

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.CloseBrace);
        }
        private void ParseConstantBuffer(ConstantBufferInfo buffer, List<UnifiedShaderToken> tokens)
        {
            ExpectToken(ConsumeToken(tokens), "cbuffer");
            var name = ConsumeToken(tokens);
            ExpectToken(name, UnifiedShaderTokenType.StringToken);
            
            buffer.Name = name.Text;
            buffer.Variables = new List<ParameterInfo>();
            
            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.OpenBrace);

            ParseParameterList(buffer.Variables, tokens);

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.CloseBrace);
        }
        private void ParseConstantBuffers(UnifiedShaderInfo info, List<UnifiedShaderToken> tokens)
        {
            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.OpenBrace);

            while (tokens[0].TokenType == UnifiedShaderTokenType.StringToken && tokens[0].Text == "cbuffer")
            {
                var buffer = new ConstantBufferInfo();
                ParseConstantBuffer(buffer, tokens);
                info.ConstantBuffers.Add(buffer);
            }

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.CloseBrace);
        }