You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
There is no proper source, but looking at the scripts inside the website, it looks like the built in code editor has a parser attached that handles keywords. L16392 when you look at the source of https://www.shadertoy.com/new it gets translated to HLSL, you can click on the "Compiled in 0.0 secs" at the bottom and see it.
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.6On 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 thebuffer
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 thantime
,mouse
orframe
.The text was updated successfully, but these errors were encountered: