gl2shim: Allow drawing huge QUADS sequences by splitting drawcalls on overflow

This commit is contained in:
mittorn 2023-10-15 03:38:22 +03:00 committed by Alibek Omarov
parent 2454e87509
commit ddf3f2ffdb
1 changed files with 9 additions and 1 deletions

View File

@ -1065,7 +1065,15 @@ static void APIENTRY GL2_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
}
++gl2wrap.end;
if( gl2wrap.end - gl2wrap.begin >= MAX_BEGINEND_VERTS )
if( gl2wrap.prim == GL_QUADS )
{
if( !( ( gl2wrap.end - gl2wrap.begin ) % 4 ) && gl2wrap.end > ( GL2_MAX_VERTS - 4 ) )
{
GL2_FlushPrims();
GL2_Begin( GL_QUADS );
}
}
else if( gl2wrap.end - gl2wrap.begin >= MAX_BEGINEND_VERTS )
{
GLenum prim = gl2wrap.prim;
gEngfuncs.Con_DPrintf( S_ERROR "GL2_Vertex3f: Vertex buffer overflow!\n" );