• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Can a bindless_sampler be mapped as normal UBO instead of using glProgramUniformHandleui64vARB ?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1Prune  Members

Posted 21 May 2014 - 05:42 PM

ARB_bindless_texture specifies functions like glProgramUniformHandleui64vARB to update an array of texture handles. Can one, instead, use a regular uniform buffer object of GLuint64 and map it and write the handles to it, as one would write elements to any other mapped buffer object?

Edited by Prune, 21 May 2014 - 05:42 PM.

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

### #2phantom  Members

Posted 22 May 2014 - 01:54 AM

Yes, that function is just an overload to set uniforms; you can just treat it like a blob of data and push it into a buffer as you suggest.

### #3Prune  Members

Posted 22 May 2014 - 12:30 PM

Given that UBOs use a "binding" index instead of "location", do I need to switch "location" to "binding" in my GLSL declaration to use a UBO for texture handles?

layout(location = SAMPLERS, bindless_sampler) uniform sampler2D textures[MAX_TEX];

-->

layout(binding = SAMPLERS, bindless_sampler) uniform sampler2D textures[MAX_TEX];

The reason I'm not sure is because ARB_bindless_texture says:

With GLSL 4.20, sampler and image uniforms may be initialized in the shader using

layout(binding = integer-constant)

as described in section 4.4.4 "Opaque-Uniform Layout Qualifiers". When ARB_bindless_texture is supported, these initial binding values are always taken to mean a texture image or image unit number, not a bindless handle.

If this "binding" refers to an image unit, is it not different than the "binding" index of UBOs?

Edited by Prune, 22 May 2014 - 12:41 PM.

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

### #4Chris_F  Members

Posted 22 May 2014 - 01:05 PM

The bindless_sampler qualifier is necessary for uniform samplers in the default block only. If you are going to use a UBO, then it would probably look something like this:

layout(binding = SAMPLERS, std140) uniform sampler_buffer
{
sampler2D textures[MAX_TEX];
};


Binding points for bound textures and UBO/SSBOs are completely separate.

Edit: Fix'd

Edited by Chris_F, 22 May 2014 - 02:05 PM.

### #5Prune  Members

Posted 22 May 2014 - 01:52 PM

Thanks. I actually feel dumb to have asked that since I was already using block like this for transforms.

Just a note that std430 can't be used for UBO as in your example, only SSBO.

Edited by Prune, 22 May 2014 - 01:53 PM.

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.