Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable VAO cache under Emscripten #678

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/renderergl1/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ cvar_t *r_saveFontData;

cvar_t *r_marksOnTriangleMeshes;

cvar_t *r_disableStaticSurfaceVaoCache;

cvar_t *r_aviMotionJpegQuality;
cvar_t *r_screenshotJpegQuality;

Expand Down Expand Up @@ -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);

Expand Down
11 changes: 11 additions & 0 deletions code/renderergl2/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ cvar_t *r_saveFontData;

cvar_t *r_marksOnTriangleMeshes;

cvar_t *r_disableStaticSurfaceVaoCache;

cvar_t *r_aviMotionJpegQuality;
cvar_t *r_screenshotJpegQuality;

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions code/renderergl2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions code/renderergl2/tr_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down