Greetings,
Seems like the OpenGL UBO implementation doesn't work as advertised, or I'm doing something wrong here.
Using Catalyst 12.6 on a 7850
OpenGL Hardware Device Context
* Vendor: ATI Technologies Inc.
* Renderer: AMD Radeon HD 7800 Series
* Version: 4.2.11733 Compatibility Profile Context
* GLSL Version: 4.20
The code in question is here:
[App]
...
uint_t block_index = glGetUniformBlockIndex(m_id, "minstanceparams");
if (GL_INVALID_INDEX != block_index)
{
int_t block_size = 0;
glGetActiveUniformBlockiv(m_id, block_index, GL_UNIFORM_BLOCK_DATA_SIZE, &block_size);
.....
}
[VertexShader]
const int kMaxInstances = 256;
struct minstancedata
{
mat4 m_mvp;
mat4 m_shadowbiasmvp;
mat4 m_normalmatrix;
};
layout( std140 ) uniform minstanceparams
{
minstancedata m_instancebuffer[kMaxInstances];
};
The size of the UBO should be 256 * sizeof(mat4) * 3 = 49152. This gets correctly reported on my other workstation which has a Nvidia card.
On my 7850 I'm getting -16384. Upon testing and reducing the number of instances to kMaxInstances = 128, I'm getting the correct size. An interesting fact is that when I tried different values for kMaxInstances (e.g. 192) I've gotten different results in block_size.
My questions are:
a) The spec says ( I believe, at least I've read this a few times while doing research) you should have at least 64 KB for UBO available, but that doesn't seem to be the case here (seems to be limited more to 32 KB)
b) The spec says that if an error occurs nothing gets written to block_size. That definitely doesn't happen here.
c) Lastly, am I'm missing anything in my setup, or the way I'm trying to use the UBOs isn't advised?
Thanks for your time