We are developing a CAD application where the meshes usually are very big. For improve the performance we are painting in a unique batch all the primitives using glDrawElements.
We are using the follow shader to generate Picking info over a FBO. With small mesh (around 2 million of primitives), all works fine but with mesh greater than of 8 millions of primitives the gl_PrimitiveID became invalid. It looks like if in a previous state, the gl_PrimitiveID was reset to zero. Is gl_PrimitiveID limited to a max number of Primitives? or is just a bug?
The shaders we are using are this:
#define POSITION 0
uniform mat4 MVP_Matrix;
layout(location = POSITION) in vec4 VertexPosition;
gl_Position = MVP_Matrix * VertexPosition;
#extension GL_EXT_gpu_shader4 : enable
uniform uint gEntyID; // Object Id
uniform uint gSubEntyID; // Element Id
outFragColor = uvec3 (gEntyID,gSubEntyID,gl_PrimitiveID);