Hi, I’ve encountered strange behavior when using uniform buffer that consists of matrix array.
Vertex shader code:
layout(location = POSITION) in vec4 In_position;
layout(location = TEXCOORD) in vec2 In_texCoord;
out fragIn {
vec2 texCoord;
} Out;
layout(std140, column_major) uniform transform
{
mat4 modelViewProj[64];
} t;
void main()
{
gl_Position = t.modelViewProj[gl_InstanceID] * In_position;
Out.texCoord = In_texCoord;
}
Above code works ok and this gives me size=4096
glGetActiveUniformBlockiv(program, uboIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &size);
However when I change vertex shader to
...
layout(std140, column_major) uniform transform
{
mat4 modelViewProj[64];
};
...
gl_Position = modelViewProj[gl_InstanceID] * In_position;
glGetActiveUniformBlockiv gives me size=16192 and the visual effects are not the same.
Catalyst 11.7/8 (both)
Radeon 5850 HD
Windows 7 x64