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:

Code :
// Vertex
#version 330
#define POSITION    0
uniform mat4 MVP_Matrix;
layout(location = POSITION) in vec4 VertexPosition;
void main(void)
   gl_Position = MVP_Matrix * VertexPosition;
// Fragment
#version 330
#extension GL_EXT_gpu_shader4 : enable
uniform uint gEntyID; // Object Id 
uniform uint gSubEntyID; // Element Id
uvec3 outFragColor;
void main()
    outFragColor = uvec3 (gEntyID,gSubEntyID,gl_PrimitiveID);