tessellation and per triangle index in gs

Playing around with tessellation in opengl 4.0 i happened upon a smal problem. Basically, how to make a uniqe index/numbering for each triangle in the geometry shader, after tessellation.

A little more in-depth:

Input patch is a planar quad defined by four control points. Assume fractional_odd.

For simplicity, assume that all outer and the inner tessellation levels are equal, going up to max tesselation level based on camera distance to the center of the patch.

The evaluation shader does only linear interpolation, so input to the geometry shader stage is triangles on the original plane (2 triangles for each “ouput quad” from the tessellation).

In the geometry shader i would like to read in a unique value for each triangle (from texture or something) so i need some sort of indexing scheme. As the patch get more and more tessellated, i get more and more triangles and each additional triangle should preferably get a higher index.

Any suggestion on a way to make such an index (preferably witouth having to do a read-back and re-render)?