diff --git a/code/renderergl1/tr_init.c b/code/renderergl1/tr_init.c index 1c502018da..b98cba8db1 100644 --- a/code/renderergl1/tr_init.c +++ b/code/renderergl1/tr_init.c @@ -161,6 +161,8 @@ cvar_t *r_saveFontData; cvar_t *r_marksOnTriangleMeshes; +cvar_t *r_disableStaticSurfaceVaoCache; + cvar_t *r_aviMotionJpegQuality; cvar_t *r_screenshotJpegQuality; @@ -1146,6 +1148,8 @@ void R_Register( void ) r_marksOnTriangleMeshes = ri.Cvar_Get("r_marksOnTriangleMeshes", "0", CVAR_ARCHIVE); + r_disableStaticSurfaceVaoCache = ri.Cvar_Get("r_disableStaticSurfaceVaoCache", "0", CVAR_ARCHIVE); + r_aviMotionJpegQuality = ri.Cvar_Get("r_aviMotionJpegQuality", "90", CVAR_ARCHIVE); r_screenshotJpegQuality = ri.Cvar_Get("r_screenshotJpegQuality", "90", CVAR_ARCHIVE); diff --git a/code/renderergl2/tr_init.c b/code/renderergl2/tr_init.c index 12bac4b09e..6f91e95a86 100644 --- a/code/renderergl2/tr_init.c +++ b/code/renderergl2/tr_init.c @@ -228,6 +228,8 @@ cvar_t *r_saveFontData; cvar_t *r_marksOnTriangleMeshes; +cvar_t *r_disableStaticSurfaceVaoCache; + cvar_t *r_aviMotionJpegQuality; cvar_t *r_screenshotJpegQuality; @@ -1433,6 +1435,15 @@ void R_Register( void ) r_marksOnTriangleMeshes = ri.Cvar_Get("r_marksOnTriangleMeshes", "0", CVAR_ARCHIVE); +#ifdef __EMSCRIPTEN__ + // The vao cache's use of bufferSubData hits pathological slow paths (10x + // slower) in some GLES drivers. Two known examples are ANGLE/Metal on + // macOS and Mali on Android. + r_disableStaticSurfaceVaoCache = ri.Cvar_Get("r_disableStaticSurfaceVaoCache", "1", CVAR_ARCHIVE); +#else + r_disableStaticSurfaceVaoCache = ri.Cvar_Get("r_disableStaticSurfaceVaoCache", "0", CVAR_ARCHIVE); +#endif + r_aviMotionJpegQuality = ri.Cvar_Get("r_aviMotionJpegQuality", "90", CVAR_ARCHIVE); r_screenshotJpegQuality = ri.Cvar_Get("r_screenshotJpegQuality", "90", CVAR_ARCHIVE); diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index 9f46866fb9..1bf53b31b5 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1848,6 +1848,8 @@ extern cvar_t *r_printShaders; extern cvar_t *r_marksOnTriangleMeshes; +extern cvar_t *r_disableStaticSurfaceVaoCache; + //==================================================================== static ID_INLINE qboolean ShaderRequiresCPUDeforms(const shader_t * shader) diff --git a/code/renderergl2/tr_surface.c b/code/renderergl2/tr_surface.c index 3151638af4..323a8bda16 100644 --- a/code/renderergl2/tr_surface.c +++ b/code/renderergl2/tr_surface.c @@ -409,6 +409,9 @@ static qboolean RB_SurfaceVaoCached(int numVerts, srfVert_t *verts, int numIndex qboolean recycleIndexBuffer = qfalse; qboolean endSurface = qfalse; + if (r_disableStaticSurfaceVaoCache->integer) + return qfalse; + if (!(!ShaderRequiresCPUDeforms(tess.shader) && !tess.shader->isSky && !tess.shader->isPortal)) return qfalse;