Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update Shader parsing such that it's capable of handling custom glsl struct definitions.
ProgramParams
are now created for the inner struct locations.Here's an example fragment shader that was failing:
Before this change,
ShaderProgram
would throw an error trying to parse the types for eachProgramParam
, specifically when looking at:uniform Light light
(exception was "Unsupported Type").The named location lookup would use the format
<uniform name>.<inner_property>
, so the attached pull request provides a little extra assistance in creating those additionalProgramParam
instances by looking for thestruct
token, then collecting each inner struct property (name + type), then storing in aDictionary
using the struct type name as a key.When processing the uniforms, we first check to see if our type is in the struct
Dictionary
, and if so, loop through each inner property and apply the.
format for the location lookups.For instance, using the fragment shader above, the following would set the appropriate values in C#:
There are a few things that I wasn't quite sure about:
-- If no, the parsing function may have to become a two pass parse.
=
token check as uniform token processing (might be unnecessary).I've been using your library for a C#/OpenGL live stream every week, and it's been an enormous help. Thank you for opening it up to the community. Hope this helps!