Jump to content
  • Advertisement
Sign in to follow this  
JorenJoestar

Binding location for an image2D in compute shader

This topic is 540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

   I am trying to search the binding index of a uniform image2D into a compute shader.

If I have this kind of syntax:

 

layout(rgba16f, binding=0) readonly uniform image2D tex0;

and I use

 

glBindImageTexture(0, ...)

it works of course.
But I can't find any proper way of finding the binding point. glGetUniformLocation does not work of course, but I can't find a method to get the binding.
I would like not to have to explicitly write the binding point in the shader and in the cpu code, but just reflect it!
Any ideas?

Thank you a lot!

Share this post


Link to post
Share on other sites
Advertisement

glGetUniformLocation and glUniform1i/glProgramUniform1i should work just fine like with textures. Is your shader actually using the image in a way that it changes the output? Otherwise the glsl compilers are free to optimize it away. And then any kind of query won't find it in the gl shader object and glGetUniformLocation will return -1!

Edited by Osbios

Share this post


Link to post
Share on other sites

glGetUniformLocation gives you the location. And then you can use the location to set/get the binding via glUniform1i / glGetUniformiv.

Edited by Osbios

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!