Skip to content

Commit

Permalink
Merge branch 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Aug 28, 2024
2 parents 712ec3b + 4c19ff2 commit a239f78
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
7 changes: 7 additions & 0 deletions code/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2744,7 +2744,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 );
Expand Down
6 changes: 3 additions & 3 deletions code/renderergl1/tr_curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions code/renderergl2/glsl/shadowmask_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions code/renderergl2/tr_curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions code/renderergl2/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,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 );

Expand Down
3 changes: 2 additions & 1 deletion code/sdl/sdl_glimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a239f78

Please sign in to comment.