vispy / vispy

Main repository for Vispy
http://vispy.org
Other
3.32k stars 616 forks source link

GLSL Comma-Separated Variable Declarations Not Supported #1410

Open noushinquazi opened 6 years ago

noushinquazi commented 6 years ago

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:

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

This is also not an issue in the sister project Glumpy; what gives?

djhoese commented 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.

rougier commented 6 years ago

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.

djhoese commented 6 years ago

@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)?

campagnola commented 6 years ago

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

rougier commented 6 years ago

And it also allows to insert code snippet where necessary, to parse extra command such as #include which is not part of GLSL, etc.

djhoese commented 6 years ago

@rougier Do you recommend vispy use the pyparsing version or just modify the current version?

rougier commented 6 years ago

I think that the most straightforward is to (slightly) modify the current parser.