-
Notifications
You must be signed in to change notification settings - Fork 423
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
Optimize multiple vec* into array of vec* #112
Comments
You can do that manually (don't use anything other than vec4 for storing uniforms):
|
Interesting trick, but not scalable IMHO. Mostly because setting/binding uniforms will be very complex since we lose the naming. How can the app know how my vec*[] are mapped/organized? I'd rather have the optimizer do it for me: it will probably do it a lot better and can provide a map that keeps the glUniform* calls automation possible. |
You could create .h file that contains layout and can be included in both shader and C/C++ code. |
I'm sure you'll understand that writing additional (C header) code doesn't comply with our need for automation or scalability. |
I'm just telling you what are things you can use right now without any changes to compiler. Not sure how submitting GitHub issue and waiting someone to implement it for you, with no ETA, solves "automation and scalability"? |
I'm not asking anyone to implement anything. I'm asking if such feature exists or is planned. |
This sounds like a good feature request. I would have thought GLSL Optimizer to be able to do that already actually. |
It's a good feature request, but not implemented right now. I would like to do it at some point if I had too much spare time... alas... :/ |
I'd like to implement this. I'm working on integrating this optimizer in MonoGame's shader building pipeline so we can support GLSL natively and we really want to do an optimization like this to keep glUniform calls to a minimum. MonoGame currently uses MojoShader to translate HLSL to GLSL and MojoShader does an optimization like this by packing uniforms in 3 arrays: one for bools, one for ints and one for floats. So that's what we're looking to do too. I'll be sure to contribute back if I ever manage to complete this :) I haven't looked into the code yet, so any pointers are very much appreciated! |
Any update on this? |
Nope. I successfully integrated the optimizer in the MonoGame content pipeline, but didn't implement this. No one is actively working on GLSL support in MonoGame right now and there are a lot of higher priority issues. |
Hi,
is there a feature that automagically optimizes the uniforms memory layout to group them in arrays of the corresponding type ?
For example:
would become:
That would save a lot of glUniform* calls on platforms that don't support uniform buffers (OpenGL ES2 / WebGL for example).
Thank you,
The text was updated successfully, but these errors were encountered: