• Advertisement
Sign in to follow this  

GLSL: glLinkProgram slow with instancing

This topic is 2665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone have this problem with instancing? I have a uniform buffer object shared between shaders. The block looks like this:

#version 150
#extension GL_ARB_uniform_buffer_object : enable

uniform MatrixBlock
{
mat4 MVMatrix;
mat4 NormalMatrix;
mat4 ProjectionMatrix;
};

uniform InstanceBlock
{
vec4 rotation[1000];
vec4 position[1000];
};

....

mat4 quatToMatrix(in vec4 q);

void main()
{
mat4 world = quatToMatrix(rotation[gl_InstanceID]);

world[3][0] = position[gl_InstanceID].x;
world[3][1] = position[gl_InstanceID].y;
world[3][2] = position[gl_InstanceID].z;

....
}


This causes glLinkProgram to take a very long time to link for each shader that uses this block. It's painfully slow. If I reduce the number from 1000 to 100 for the position and rotation arrays, the link is considerably faster. I'm compiling on ATI 5700 HD series.

Is this the norm or am I doing it wrong?

Share this post


Link to post
Share on other sites
Advertisement
I encountered the exact same behavior last night, as I just started working on some instancing stuff that uses large uniform blocks. This appears to be an ATI issue, as my NVidia card and drivers don't seem to have an issue.

I'm currently testing on HD4850. May be worth mentioning in the ATI developer forums and/or in the Drivers section in the OpenGL.org forums.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement