kbirk
kbirk

Reputation: 4022

GLSL error C3012: invalid value 8 for layout specifier 'binding' in compute shader

I am using a GeForce GTX 670, am I really limited to only 8 layout specifiers?

I really thought it would be more than that... my GL_MAX_IMAGE_UNITS is 30k+

Heres some example code from my compute shader that gives the error:

layout (local_size_x = 256) in;

layout (rgba32f, binding = 0) uniform image1D a;
layout (rgba32f, binding = 1) uniform image1D b;
layout (rgba32f, binding = 2) uniform image1D c;
layout (rgba32f, binding = 3) uniform image1D d;
layout (rgba32f, binding = 4) uniform image1D e;
layout (rgba32f, binding = 5) uniform image1D f;
layout (rgba32f, binding = 6) uniform image1D g;
layout (rgba32f, binding = 7) uniform image1D h;
layout (rgba32f, binding = 8) uniform image1D i;

void main(void)
{ 
}

If I use "location" instead of "binding", the shader will compile, but will not write to any of the textures...

Upvotes: 0

Views: 1722

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 474476

8 image units is the minimum that the GL 4.3 specification requires. And it's likely to be the standard for current hardware.

However, there's no reason why you should be limited by that. Just use a 1D array texture; that way, you can write to as many "1D textures" as you want.

Upvotes: 3

Related Questions