View Full Version : Possible driver bug?

10-08-2016, 09:04 AM

I've been searching a lot on this topic, though I cannot seem to find anyone having the same problem as me.
Consider a shader SSBO like:

#version 430

layout (std430) buffer myBlock
vec4 color;
vec3 direction;

void main()

Than you should be able to querry the index of that Buffer object with:

int blockIndex = GL43.glGetProgramResourceIndex(programID, GL43.GL_SHADER_STORAGE_BLOCK, "myBlock");

Unfortunatly it always returns '-1' (e.g. INVALID_INDEX).
I tried replacing the SSBO with an UBO (and use GL43.GL_UNIFORM_BLOCK as GLEnum in the 'glGetProgramResourceIndex' method) and it works as expected.

So further testing was querying the name with:

String blockName = GL43.glGetProgramResourceName(program, GL43.GL_SHADER_STORAGE_BLOCK, 0, 20);

And it returns "myBlock"(with delimiter) as expected.
I used index '0' because its the only SSBO declared in the whole ShaderProgram.

So even if I do:

int blockIndex = GL43.glGetProgramResourceIndex(programID, GL43.GL_SHADER_STORAGE_BLOCK, GL43.glGetProgramResourceName(program, GL43.GL_SHADER_STORAGE_BLOCK, 0, 20));

It will still return '-1' (e.g. INVALID_INDEX).

So my question is; am I doing anything wrong, or is this possibly a bug from my driver.
I wouldnt be suprissed if it is tbh. since I have many problems with different render engines as well.

Any help/comment is appreciated!

10-17-2016, 08:34 AM
Are you using members of myBlock in your shader? If none of its values are used, or at least used to produce a value output to the next stage (or framebuffer), the GLSL compiler will optimize it out entirely.