ref_gl: vbo: do not do zero-length drawcalls (fix glError on vivante)

This commit is contained in:
Dmitry Toroshchin 2023-10-27 19:42:04 +03:00 committed by Alibek Omarov
parent 1d4d355b38
commit e8409cee8b

View File

@ -2389,6 +2389,9 @@ draw details when not enough tmus
*/ */
static void R_AdditionalPasses( vboarray_t *vbo, int indexlen, void *indexarray, texture_t *tex, qboolean resetvbo, size_t offset ) static void R_AdditionalPasses( vboarray_t *vbo, int indexlen, void *indexarray, texture_t *tex, qboolean resetvbo, size_t offset )
{ {
if( !indexlen )
return;
// draw details in additional pass // draw details in additional pass
if( r_detailtextures.value && r_vbo_detail.value == 1 && mtst.tmu_dt == -1 && tex->dt_texturenum ) if( r_detailtextures.value && r_vbo_detail.value == 1 && mtst.tmu_dt == -1 && tex->dt_texturenum )
{ {
@ -2772,6 +2775,8 @@ Draw array for given vbotexture_t. build and draw dynamic lightmaps if present
===================== =====================
*/ */
static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture_t *texture, int lightmap, qboolean skiplighting ) static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture_t *texture, int lightmap, qboolean skiplighting )
{
if( vbotex->curindex )
{ {
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
@ -2800,6 +2805,8 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
pglEnable( GL_TEXTURE_2D ); pglEnable( GL_TEXTURE_2D );
R_SetDecalMode( false ); R_SetDecalMode( false );
} }
}
//Msg( "%d %d %d\n", vbo->array_len, vbotex->len, lightmap ); //Msg( "%d %d %d\n", vbo->array_len, vbotex->len, lightmap );
if( skiplighting ) if( skiplighting )
{ {