I was just looking at it when trying to find something that would get me the same result as glGetUniform1i, except in the glProgramX pattern, like glProgramUniform1i. It's not clear to me how to use the functions to get that value.
-
-
Vastauksena käyttäjille @tloch14 ja @mikulasflorek
hopefully this will help as I don't 100% understand the problem, but I did a bit of shader reflection in my program and what I do is use glGetProgramInterfaceiv to build a map of uniforms and locations, that I can then use later with my shader object
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
relevant functions: glGetProgramInterfaceiv, glGetProgramResourceiv, glGetProgramResourceName would share code but it's not C/C++
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjille @radgeRayden ja @mikulasflorek
building a map of name->bindpoints is exactly what I'm doing. Then I can take all the resources used for a particular drawcall, create arrays I can pass to glBindTextures/glBindSamplers/glBindImageTextures, and use those.
1 vastaus 0 uudelleentwiittausta 1 tykkäys -
And then re-use those "bundles" frame over frame. Pay the cost of building them once and reuse.
1 vastaus 0 uudelleentwiittausta 1 tykkäys -
Vastauksena käyttäjille @tloch14 ja @mikulasflorek
yep it works pretty nicely and you can even cheaply address stuff by name if you do it right.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjille @radgeRayden ja @mikulasflorek
Yes! Exactly. I just need to get that binding index. I can call glProgramUniform1i to set it myself, but I'd rather attempt to respect what the shader author wrote in the layout qualifier.
1 vastaus 0 uudelleentwiittausta 1 tykkäys -
Vastauksena käyttäjille @tloch14 ja @radgeRayden
Quick googling suggests glGetUniform should work.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjille @mikulasflorek ja @radgeRayden
Right. I expect glGetUniform1i to work. I was hoping for there to be a glGetProgramUniform1i(program, location).
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Ah wait, glGetUniform takes a program. *doh*! Naming convention of glUniform/glProgramUniform made me think it wouldn't.
1 vastaus 0 uudelleentwiittausta 2 tykkäystä
Just tested it and it works great. Thanks to both of you for the help!
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.