diff --git a/README.md b/README.md index dd97bcb7..20f9486e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The Visual Studio and Xcode project files are not supported. ## Discussion - * [Discord (Clover.moe Community)](https://discord.gg/7J2pjGD) + * [Discussion / Technical support](https://clover.moe/open-source) ## License diff --git a/code/qcommon/common.c b/code/qcommon/common.c index ce08bac1..90f4e0c2 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2748,7 +2748,14 @@ void Com_Init( char *commandLine ) { // init commands and vars // com_altivec = Cvar_Get ("com_altivec", "1", CVAR_ARCHIVE); +#ifdef __EMSCRIPTEN__ + // Under Emscripten the browser handles throttling the frame rate. + // Manual framerate throttling interacts poorly with Emscripten's + // browser-driven event loop. So default throttling to off. + com_maxfps = Cvar_Get ("com_maxfps", "0", CVAR_ARCHIVE); +#else com_maxfps = Cvar_Get ("com_maxfps", "85", CVAR_ARCHIVE); +#endif com_blood = Cvar_Get ("com_blood", "1", CVAR_ARCHIVE); com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP ); diff --git a/code/renderergl1/tr_curve.c b/code/renderergl1/tr_curve.c index eaabba46..c5c9d98d 100644 --- a/code/renderergl1/tr_curve.c +++ b/code/renderergl1/tr_curve.c @@ -306,13 +306,13 @@ srfGridMesh_t *R_CreateSurfaceGridMesh(int width, int height, grid->heightLodError = /*ri.Hunk_Alloc*/ ri.Malloc( height * 4 ); Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 ); #else - grid = ri.Hunk_Alloc( size ); + grid = ri.Hunk_Alloc( size, h_low ); Com_Memset(grid, 0, size); - grid->widthLodError = ri.Hunk_Alloc( width * 4 ); + grid->widthLodError = ri.Hunk_Alloc( width * 4, h_low ); Com_Memcpy( grid->widthLodError, errorTable[0], width * 4 ); - grid->heightLodError = ri.Hunk_Alloc( height * 4 ); + grid->heightLodError = ri.Hunk_Alloc( height * 4, h_low ); Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 ); #endif diff --git a/code/renderergl2/glsl/shadowmask_fp.glsl b/code/renderergl2/glsl/shadowmask_fp.glsl index 2b57e3ba..56d480fb 100644 --- a/code/renderergl2/glsl/shadowmask_fp.glsl +++ b/code/renderergl2/glsl/shadowmask_fp.glsl @@ -103,14 +103,19 @@ void main() vec4 shadowpos = u_ShadowMvp * biasPos; + if ( depth >= 1.0 - DEPTH_MAX_ERROR ) + { + result = 1.0; + } + else #if defined(USE_SHADOW_CASCADE) if (all(lessThan(abs(shadowpos.xyz), vec3(abs(shadowpos.w))))) - { #endif + { shadowpos.xyz = shadowpos.xyz * (0.5 / shadowpos.w) + vec3(0.5); result = PCF(u_ShadowMap, shadowpos.xy, shadowpos.z); -#if defined(USE_SHADOW_CASCADE) } +#if defined(USE_SHADOW_CASCADE) else { shadowpos = u_ShadowMvp2 * biasPos; diff --git a/code/renderergl2/tr_curve.c b/code/renderergl2/tr_curve.c index d175789b..54910d04 100644 --- a/code/renderergl2/tr_curve.c +++ b/code/renderergl2/tr_curve.c @@ -388,10 +388,10 @@ void R_CreateSurfaceGridMesh(srfBspSurface_t *grid, int width, int height, grid->numVerts = (width * height); grid->verts = ri.Malloc(grid->numVerts * sizeof(srfVert_t)); #else - grid->widthLodError = ri.Hunk_Alloc( width * 4 ); + grid->widthLodError = ri.Hunk_Alloc( width * 4, h_low ); Com_Memcpy( grid->widthLodError, errorTable[0], width * 4 ); - grid->heightLodError = ri.Hunk_Alloc( height * 4 ); + grid->heightLodError = ri.Hunk_Alloc( height * 4, h_low ); Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 ); grid->numIndexes = numIndexes; diff --git a/code/renderergl2/tr_init.c b/code/renderergl2/tr_init.c index 8019c3a2..3d5bee60 100644 --- a/code/renderergl2/tr_init.c +++ b/code/renderergl2/tr_init.c @@ -1375,8 +1375,15 @@ void R_Register( void ) r_dlightBacks = ri.Cvar_Get( "r_dlightBacks", "1", CVAR_ARCHIVE ); r_finish = ri.Cvar_Get ("r_finish", "0", CVAR_ARCHIVE); r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE ); +#ifdef __EMSCRIPTEN__ + // Under Emscripten we don't throttle framerate with com_maxfps by default, so enable + // vsync by default instead. + r_swapInterval = ri.Cvar_Get( "r_swapInterval", "1", + CVAR_ARCHIVE | CVAR_LATCH ); +#else r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE | CVAR_LATCH ); +#endif r_gamma = ri.Cvar_Get( "r_gamma", "1", CVAR_ARCHIVE ); r_facePlaneCull = ri.Cvar_Get ("r_facePlaneCull", "1", CVAR_ARCHIVE ); diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 2678dc71..5ce1e47d 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -438,10 +438,11 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder, qbool if( display < 0 ) { ri.Printf( PRINT_DEVELOPER, "SDL_GetWindowDisplayIndex() failed: %s\n", SDL_GetError() ); + display = 0; } } - if( display >= 0 && SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 ) + if( SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 ) { displayAspect = (float)desktopMode.w / (float)desktopMode.h;