I have encountered a particularly strange bug on AMD using both crimson 17.7.2 and 17.9.1 (AMD R9 270). A consecutive range of first-count pairs is provided where every end of one range is the start of the next, but the primitive type (GL_TRIANGLE_STRIP) does not allow the draw to be collapsed. Using glMultiDrawArrays gives artifacts but emulating the call using glDrawArrays in a loop using the data in the first-count arrays works fine.
The snippet is as follows:
if (branch cond)
..[fill first-count pairs]
glMultiDrawArrays(GL_TRIANGLE_STRIP, firsts.data(), counts.data(), draw_count);
replacing the glMultiDrawArrays call with:
for (int i = 0; i < draw_count; ++i)
glDrawArrays(GL_TRIANGLE_STRIP, firsts[i], counts[i]);
gives correct results.
The man page for glMultiDrawArrays does not mandate that first/count data is kept 'alive' after use so I assume the driver stores the information locally. I've tried moving the storage outside to global storage and the error is still visible. It is worth noting similar setup elsewhere works consistently with GL_POINTS. The same setup also works fine on radeonsi and the other hw vendors.
It is also worth noting that gl_VertexID is used to generate vertex shader output. I have attached expected vs actual output on AMD drivers below, while emulating the game resident evil 4 (rpcs3)
EDIT: I retried with a 128 megabyte ring buffer just to ensure I was not overwriting anything the driver might be using and the result is the same. Output is also very stable with no flickering making a race condition in the program less likely.
After speaking to others with the same issue - it seems gl_VertexID is broken with multidraw. It does not increment with the first argument of a set as the base index. Manually passing vertex ID or using multiDrawElements with an identity index buffer seems to work okay.