cancel
Showing results for 
Search instead for 
Did you mean: 

Drivers & Software

artem_bochkarev
Journeyman III

Issue with GL_PRIMITIVE_RESTART

AMD Radeon RX 5500 XT, 19.2.2, 20.4.2, 20.5.1 versions checked.

I created minimal sample to reproduce issue, main.cpp attached(uses glfw, glad and glm).

Additional line to zero is drawn in some cases.

Ok case:
glDrawElements( GL_LINE_STRIP, indexes.size() - 2, INDEX_TYPE_GL, (void*)(indexes.data() + 2) );

glDisable( GL_PRIMITIVE_RESTART );

glDrawArrays( GL_LINES, 0, 2 );

Wrong case, data is splitted to separate draw calls:

glDrawElements( GL_LINE_STRIP, 6, INDEX_TYPE_GL, (void*)(indexes.data() + 7) );
glDrawElements( GL_LINE_STRIP, 5, INDEX_TYPE_GL, (void*)( indexes.data() + 2 ) );

glDisable( GL_PRIMITIVE_RESTART );

glDrawArrays( GL_LINES, 0, 2 );

Without glDrawArrays also ok:

glDrawElements( GL_LINE_STRIP, 6, INDEX_TYPE_GL, (void*)(indexes.data() + 7) );
glDrawElements( GL_LINE_STRIP, 5, INDEX_TYPE_GL, (void*)( indexes.data() + 2 ) );

glDisable( GL_PRIMITIVE_RESTART );

I tried to change buffers before glDrawArrays call and to use index buffers. But any draw calls after: 

glDrawElements( GL_LINE_STRIP, 6, INDEX_TYPE_GL, (void*)(indexes.data() + 7) );
glDrawElements( GL_LINE_STRIP, 5, INDEX_TYPE_GL, (void*)( indexes.data() + 2 ) );

causes this wrong line to be drawn.

If use 0 as restart index this additional line is drawn not to (0, 0, 0) vertex, but to the first vertex in the current VBO.

0 Likes
1 Solution
artem_bochkarev
Journeyman III

Issue is no more repro. Checked driver version: 27.20.21002.112

View solution in original post

0 Likes
1 Reply
artem_bochkarev
Journeyman III

Issue is no more repro. Checked driver version: 27.20.21002.112

0 Likes