Created attachment 117029 [details]
Complete small program to demonstrate problem. Compile instructions in source
glVertexAttribDivisor does not work on a Fedora 21 system with Intel HD Graphics 5500, Mesa 10.5.8, core profile version 3.3. Attribute with divisor set to 1 (per instance) appears to be still incrementing per vertex.
Mesa 10.5.8 built from source with floating point textures enabled. Problem is not mentioned in release notes for 10.5.9, 10.6, or 10.6.1; does not appear in bug database.
Attached is program that demonstrates problem.
Created attachment 117030 [details]
Expected output from running program
I tested this on git master (f12302b89836a2) on SKL and it's also failing. However I think it is due to the combination of glPolygonMode and glVertexAttribDivisor rather than a general failure with glVertexAttribDivisor. If I comment out the call to glPolygonMode then it works (albeit with filled triangles).
There is a piglit test called arb_instanced_arrays-instanced_arrays which tests glVertexAttribDivisor and this does work on SKL.
This problem doesn't exist on HSW.
I have an idea what's going wrong. I'm working on a patch.
Here's another presumably related bug. Polygon mode GL_LINE also clobbers gl_InstanceID in a vertex shader. Value appears to be undefined.
Still on Mesa 10.5.8, but with patch 54228 applied which does fix the attribute divisor
Created attachment 117049 [details]
Complete small program to demonstrate problem with gl_InstanceID
I think the problem with gl_InstanceID is probably bug 84677.
Yes, I guess a fix for either of these will interact with each other. I think the patch I posted here won't work if we fix the other bug because it would put the element for the vertex/instance ID before the edge flag.
I've posted a v2 of the patch which works in conjunction with a fix for the other bug here:
I've also posted a patch for Piglit to make sure we test glPolygonMode with gl_InstanceID here:
I've also extended the test to test glPolygonMode with an instanced array here:
Reversed the original patch, applied the version 2 of this patch and the version 2 patch for bug 84677 to my Mesa 10.5.8 source tree.
Both programs now work as expected on my Intel HD 5500.
The patch was landed in master and later released in 10.6.6.