Bindable uniform?

I haven’t dealt with these in a while, and I forgot how they work. Is this sufficient to declare a bindable uniform in GLSL, or do I have to specify something special in the shader?:

uniform mat4 InstanceMatrix[128];

Trial&Error or Google would certainly be faster, than asking in a forum.

But, yes, that is sufficient.

Jan.

Trial&Error or Google would certainly be faster, than asking in a forum.

I don’t appreciate the tone of your reply. Trial and error is impossible unless I am to randomly type ASCII characters and test them. And a search for practical information on GLSL usually just returns pages that talk about GLSL without going into any detail:
http://www.google.com/search?hl=en&q=bindable+uniform+glsl

But, yes, that is sufficient.

No it isn’t.

For anyone else who runs across this, you need the following code at the top of your shader:

#version 120
#extension GL_EXT_gpu_shader4 : enable
#extension GL_EXT_bindable_uniform : enable

bindable uniform mat4 InstanceMatrix[1000];

Something else worth looking into is texture buffer objects. They are able to hold 2^27 texels maximum, which is excellent for large bone arrays.

I’ve found that bindable uniforms have odd constraints (for the time being anyway) - I am unable to use anything other than a vec4 (or mat4 I suppose) for my bindable uniforms. This isn’t a big problem though.

/me is willing to bet that information was in the spec

Yes, I already read the spec. The closest thing I can find to what I mentioned is issue #2… it just says layout may not be consistent across platforms.

EDIT: Luckily it mentions something about a possible future extension that will add packing rules. (Also, I may’ve misinterpreted the above reply…) :wink:

Sorry, i misunderstood your question, i thought you were only talking about uniforms in general (and was wondering why you would ask such a simple question).

I don’t appreciate the tone of YOUR reply either. But since i really don’t like arguing, i’d call it quits.

Jan.

So a bindable uniform is like a program environment and it is also like an array. Why not just use a texture? Maybe a texture would be too slow to access?

So a bindable uniform is like a program environment and it is also like an array.

No.

What he’s talking about is the specific ability to use buffer objects to store uniform data in. This would be particularly useful for programs that have lots of data, or for large segments of data that are shared between several programs.

Basically it’s a random-access VBO.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.