Open noushinquazi opened 6 years ago
We're going to need more information to debug this. What OS are you on? What version of python? What version of vispy? What GPU? Newest version of video drivers? Same exact environment used for vispy and glumpy? What vispy code are you executing that is causing a problem? What is the error message? What shader in vispy do you think you're running that has this type of declaration and what shader in glumpy are you running that has this type of declaration?
More info please.
I think I've modified the parser in glumpy to handle this case but did not backported it to vispy. I also implemented a pyparsing version that I've considered but it would introduce another dependency.
@rougier Thanks. I don't mind the pyparsing dependency since it is available in conda and pip. Is there a reason the shader needs to be parsed at all? Does this automatically generate the python objects that map to the GL uniforms and variables? Sounds like you're saying this is caused just because of a limitation in the python shader parsing code and not in the OpenGL shader compilation (outside of vispy)?
That's right--parsing variable names from the shader makes it possible to set shader variables in a user-friendly way. The code is here: https://github.com/vispy/vispy/blob/master/vispy/gloo/program.py#L184
And it also allows to insert code snippet where necessary, to parse extra command such as #include
which is not part of GLSL, etc.
@rougier Do you recommend vispy use the pyparsing version or just modify the current version?
I think that the most straightforward is to (slightly) modify the current parser.
model, view, and projection matrices are not detected when declared like so in the shader:
uniform mat4 model, view, projection;
However, when given their own lines, vispy finds them just fine:
This is also not an issue in the sister project Glumpy; what gives?