-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a GlslProg::create() method for transform feedback shaders. #1241
base: master
Are you sure you want to change the base?
Conversation
This allows you to quickly create the transform feedback shader by just supplying a file, a list of varyings and optionally a transform feedback format. Attributes don't need to be specified, because GlslProg already is able to query them from the source files. Thanks to this addition, I was able to add support for transform feedback shaders to a caching system, which would otherwise have been harder.
Sounds reasonable to add TF-oriented constructor to me, if nothing else than to make it clear to first time users of the technique what is needed. Maybe at least one of the samples should make use of this new create() method? I wish we'd document the constructors, especially when they have arguments with defaults because some lesser IDEs (cough, cough, Xcode) tend to not even show those variables during auto-completion, but at the same time I realize the other ones aren't documented, either. |
Yeah, it's a good idea to use it in a sample. Will add it to this PR tomorrow. |
I agree. I also think there should be a constructor that takes a geometry shader as well. |
@ryanbartley well that one becomes a slippery slope - then do we need a constructor for tesselation shaders too? compute? TF is sort of unique because it is commonly its own standalone vert shader. |
So, there actually are It also got me thinking, what with the changes @paulhoux is proposing here, we could remove the default-empty fragment shader in these constructors, since AFAIK the only time you would use a vert-shader-only GlslProg would be in the case of transform feedback. |
My own opinion is that for just about every case that's not just vert+frag, |
@andrewfb : there is a slight issue with |
@paulhoux you can load the glsl into std::string's async and then construct the entire format right when you're create()ing the GlslProg. But yea, I don't see why you couldn't create the entire Format on a background thread and then copy (move if you prefer) to the main thread to load. It's actually nice that the file i/o is happening at the Format for this reason come to think of it, because it allows you to at least handle that part async if you wish. Tempting to move the shader preprocessing there as well.. |
This allows you to quickly create the transform feedback shader by just supplying a file, a list of varyings and optionally a transform feedback format. Attributes don't need to be specified, because GlslProg already is able to query them from the source files. Thanks to this addition, I was able to add support for transform feedback shaders to a caching system, which would otherwise have been harder.