Skip to content

Commit 41a3253

Browse files
committed
Merge branch 'upstream'
2 parents 24c418b + 4c19ff2 commit 41a3253

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

code/qcommon/common.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,7 +2846,14 @@ void Com_Init( char *commandLine ) {
28462846
// init commands and vars
28472847
//
28482848
com_altivec = Cvar_Get ("com_altivec", "1", CVAR_ARCHIVE);
2849+
#ifdef __EMSCRIPTEN__
2850+
// Under Emscripten the browser handles throttling the frame rate.
2851+
// Manual framerate throttling interacts poorly with Emscripten's
2852+
// browser-driven event loop. So default throttling to off.
2853+
com_maxfps = Cvar_Get ("com_maxfps", "0", CVAR_ARCHIVE);
2854+
#else
28492855
com_maxfps = Cvar_Get ("com_maxfps", "85", CVAR_ARCHIVE);
2856+
#endif
28502857
com_blood = Cvar_Get ("com_blood", "1", CVAR_ARCHIVE);
28512858

28522859
com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP );

code/renderergl1/tr_curve.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ srfGridMesh_t *R_CreateSurfaceGridMesh(int width, int height,
306306
grid->heightLodError = /*ri.Hunk_Alloc*/ ri.Malloc( height * 4 );
307307
Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 );
308308
#else
309-
grid = ri.Hunk_Alloc( size );
309+
grid = ri.Hunk_Alloc( size, h_low );
310310
Com_Memset(grid, 0, size);
311311

312-
grid->widthLodError = ri.Hunk_Alloc( width * 4 );
312+
grid->widthLodError = ri.Hunk_Alloc( width * 4, h_low );
313313
Com_Memcpy( grid->widthLodError, errorTable[0], width * 4 );
314314

315-
grid->heightLodError = ri.Hunk_Alloc( height * 4 );
315+
grid->heightLodError = ri.Hunk_Alloc( height * 4, h_low );
316316
Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 );
317317
#endif
318318

code/renderergl2/glsl/shadowmask_fp.glsl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,19 @@ void main()
103103

104104
vec4 shadowpos = u_ShadowMvp * biasPos;
105105

106+
if ( depth >= 1.0 - DEPTH_MAX_ERROR )
107+
{
108+
result = 1.0;
109+
}
110+
else
106111
#if defined(USE_SHADOW_CASCADE)
107112
if (all(lessThan(abs(shadowpos.xyz), vec3(abs(shadowpos.w)))))
108-
{
109113
#endif
114+
{
110115
shadowpos.xyz = shadowpos.xyz * (0.5 / shadowpos.w) + vec3(0.5);
111116
result = PCF(u_ShadowMap, shadowpos.xy, shadowpos.z);
112-
#if defined(USE_SHADOW_CASCADE)
113117
}
118+
#if defined(USE_SHADOW_CASCADE)
114119
else
115120
{
116121
shadowpos = u_ShadowMvp2 * biasPos;

code/renderergl2/tr_curve.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ void R_CreateSurfaceGridMesh(srfBspSurface_t *grid, int width, int height,
388388
grid->numVerts = (width * height);
389389
grid->verts = ri.Malloc(grid->numVerts * sizeof(srfVert_t));
390390
#else
391-
grid->widthLodError = ri.Hunk_Alloc( width * 4 );
391+
grid->widthLodError = ri.Hunk_Alloc( width * 4, h_low );
392392
Com_Memcpy( grid->widthLodError, errorTable[0], width * 4 );
393393

394-
grid->heightLodError = ri.Hunk_Alloc( height * 4 );
394+
grid->heightLodError = ri.Hunk_Alloc( height * 4, h_low );
395395
Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 );
396396

397397
grid->numIndexes = numIndexes;

code/renderergl2/tr_init.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,15 @@ void R_Register( void )
13831383
r_dlightBacks = ri.Cvar_Get( "r_dlightBacks", "1", CVAR_ARCHIVE );
13841384
r_finish = ri.Cvar_Get ("r_finish", "0", CVAR_ARCHIVE);
13851385
r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE );
1386+
#ifdef __EMSCRIPTEN__
1387+
// Under Emscripten we don't throttle framerate with com_maxfps by default, so enable
1388+
// vsync by default instead.
1389+
r_swapInterval = ri.Cvar_Get( "r_swapInterval", "1",
1390+
CVAR_ARCHIVE | CVAR_LATCH );
1391+
#else
13861392
r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0",
13871393
CVAR_ARCHIVE | CVAR_LATCH );
1394+
#endif
13881395
r_gamma = ri.Cvar_Get( "r_gamma", "1", CVAR_ARCHIVE );
13891396
r_facePlaneCull = ri.Cvar_Get ("r_facePlaneCull", "1", CVAR_ARCHIVE );
13901397

code/sdl/sdl_glimp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,11 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder, qbool
438438
if( display < 0 )
439439
{
440440
ri.Printf( PRINT_DEVELOPER, "SDL_GetWindowDisplayIndex() failed: %s\n", SDL_GetError() );
441+
display = 0;
441442
}
442443
}
443444

444-
if( display >= 0 && SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 )
445+
if( SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 )
445446
{
446447
displayAspect = (float)desktopMode.w / (float)desktopMode.h;
447448

0 commit comments

Comments
 (0)