17 namespace ShaderParser {
39 std::string_view
trim(int32_t start, int32_t end)
41 size_t pos = start < 0 ?
range.size() - start : start;
42 size_t len = (end < 0 ?
range.size() + end : end) - start;
43 return range.substr(pos, len);
66 std::string_view consume(
size_t num);
69 std::string_view remaining;
71 uint32_t currentOffset;
132 std::string m_fileName;
135 uint32_t m_nextTextureBinding;
136 uint32_t m_nextBufferBinding;
137 uint32_t m_nextPushConstantBinding;
138 std::unique_ptr<Tokenizer> m_tokenizer;
Definition ShaderParser.h:104
ParseResult parseTexture()
Definition ShaderParser.cpp:220
ParseResult parsePushConstant()
Definition ShaderParser.cpp:287
bool advanceIfType(Token::Type type, bool shouldExpect=true)
Definition ShaderParser.cpp:390
std::string makeLineInfo()
Definition ShaderParser.cpp:352
ParseResult
Definition ShaderParser.h:109
@ DidNotMatch
Definition ShaderParser.h:110
@ ParseFailure
Definition ShaderParser.h:111
@ Parsed
Definition ShaderParser.h:112
bool expect(Token::Type type, const Token &tok)
Definition ShaderParser.cpp:359
bool isKeyword(std::string_view keyword, const Token &tok)
Definition ShaderParser.cpp:372
ShaderInfo Parse(std::string filename, std::string_view fileData)
Definition ShaderParser.cpp:150
ParseResult parseBuffer()
Definition ShaderParser.cpp:263
bool advanceIfLineRemaining()
Definition ShaderParser.cpp:427
bool advanceIfKeyword(std::string_view keyword)
Definition ShaderParser.cpp:410
void advance()
Definition ShaderParser.cpp:378
Definition Background.h:14
TextureType
Definition Texture.h:38
ConstantDataFormat
Definition Types.h:55
Definition ShaderParser.h:83
std::string name
Definition ShaderParser.h:84
uint32_t binding
Definition ShaderParser.h:85
Definition ShaderParser.h:88
std::string name
Definition ShaderParser.h:90
Graphics::ConstantDataFormat type
Definition ShaderParser.h:89
uint32_t binding
Definition ShaderParser.h:91
Definition ShaderParser.h:94
std::vector< TextureInfo > textureBindings
Definition ShaderParser.h:99
std::vector< BufferInfo > bufferBindings
Definition ShaderParser.h:100
std::string fragmentPath
Definition ShaderParser.h:97
std::vector< PushConstantInfo > pushConstantBindings
Definition ShaderParser.h:101
std::string name
Definition ShaderParser.h:95
std::string vertexPath
Definition ShaderParser.h:96
Definition ShaderParser.h:76
std::string bindName
Definition ShaderParser.h:78
uint32_t binding
Definition ShaderParser.h:80
Graphics::TextureType type
Definition ShaderParser.h:77
std::string name
Definition ShaderParser.h:79
Definition ShaderParser.h:19
std::string_view trim(int32_t start, int32_t end)
Definition ShaderParser.h:39
std::string_view range
Definition ShaderParser.h:37
Type
Definition ShaderParser.h:23
@ LBrace
Definition ShaderParser.h:30
@ String
Definition ShaderParser.h:25
@ Number
Definition ShaderParser.h:26
@ RBrace
Definition ShaderParser.h:31
@ Identifier
Definition ShaderParser.h:27
@ Equals
Definition ShaderParser.h:32
@ EndOfFile
Definition ShaderParser.h:28
@ Hash
Definition ShaderParser.h:33
@ Discard
Definition ShaderParser.h:24
Type type
Definition ShaderParser.h:36
Definition ShaderParser.h:47
Token advance()
Definition ShaderParser.cpp:74
uint32_t getCurrentLine() const
Definition ShaderParser.h:62
bool peekIsNextLine() const
Definition ShaderParser.h:59
const Token & peek() const
Definition ShaderParser.h:61
bool discardLine()
Definition ShaderParser.cpp:132
uint32_t getCurrentChar() const
Definition ShaderParser.h:63