Hi,
Have just started working on compute shaders.
I have a uniform block in a compute shader and I am trying to get the uniform block index in my application , but it is always returning me index as -1. Whereas for normal uniforms (without blocks) it is returning proper location values (+ve values) . I am working on OPENGL 4.3 with GLSL 430 on Nvidia quadro 600.
Compute Shader
#version 430
#extension GL_EXT_shader_image_load_store : enable
layout(rgba32f) uniform image2D destTex;
layout(std140) uniform colors_UB{
vec4 color1;
vec4 color2;
vec4 color3;
vec4 color4;
};
layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
void main() {
vec4 add_color= vec4(color1 + color2 + color3 + color4); // just to make active
ivec2 image_new = imageSize(destTex); // just to make active
}
The compute shader is compiling and linking properly. Also ‘destTex’ uniform is returning location value as 0.
But glGetUniformBlockIndex(compute_program, “colors_UB”); is always returning values as -1.
I am missing anything?
Thanks.