I am working on the top issues in #15 and InvalidToken shows up quite a bit. There is different variants. But the few I tried to understand were caused by GLSL keywords being used as identifier names. Keywords in Chapter 3.6
On Shadertoy it seems like all identifiers (variable names, function names, etc) get replaced by placeholder variables in the form _name1234 which will avoid this. But the shadercode might make use of certain keywords just fine. The shortest example I found is this shadertoy making use if the buffer keyword as an identifier.
So we very likely need to do some similar sanitizing/obfuscating to support all working shaderstoys from the website as is.
All solutions I can currently come up with, require some sort of lexer or parser to get all the identifiers in the first place, then check them against a mapping of keywords and replace. There will also be further issues if such an approach isn't extremely solid.
On a related note, some examples of InvdalidToken seem to be caused by keywords we introduce with the various compatibility code at the top. So it's probably a good idea to change all names to something more unique than time, mouse or frame.
I am working on the top issues in #15 and
InvalidTokenshows up quite a bit. There is different variants. But the few I tried to understand were caused by GLSL keywords being used as identifier names. Keywords in Chapter 3.6On Shadertoy it seems like all identifiers (variable names, function names, etc) get replaced by placeholder variables in the form
_name1234which will avoid this. But the shadercode might make use of certain keywords just fine. The shortest example I found is this shadertoy making use if thebufferkeyword as an identifier.So we very likely need to do some similar sanitizing/obfuscating to support all working shaderstoys from the website as is.
All solutions I can currently come up with, require some sort of lexer or parser to get all the identifiers in the first place, then check them against a mapping of keywords and replace. There will also be further issues if such an approach isn't extremely solid.
On a related note, some examples of
InvdalidTokenseem to be caused by keywords we introduce with the various compatibility code at the top. So it's probably a good idea to change all names to something more unique thantime,mouseorframe.