From 20970e801f64d95399e256068382576c456e34c2 Mon Sep 17 00:00:00 2001 From: MrBougo Date: Thu, 20 Nov 2014 17:20:00 +0100 Subject: [PATCH] apply new patch submitted in irc by mynick1 description: - makefile: makefile with LTO - sys_shared: missing CC in asm code - screenshot: removed unused variables --- cl_screen.c | 9 +++------ makefile.inc | 9 +++++---- model_brush.c | 2 +- svvm_cmds.c | 6 +++--- sys_shared.c | 6 +++++- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index 0f607844..ffd295d7 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -120,8 +120,6 @@ extern cvar_t sbar_info_pos; extern cvar_t r_fog_clear; #define WANT_SCREENSHOT_HWGAMMA (scr_screenshot_hwgamma.integer && vid_usinghwgamma) -int jpeg_supported = false; - qboolean scr_initialized; // ready to draw float scr_con_current; @@ -2092,7 +2090,7 @@ qboolean SCR_ScreenShot_Sync(char *filename, unsigned char *buffer1, unsigned ch struct scr_screenshots_thread_s { /* SCR_ScreenShot_Async added by Izy (izy from http://www.izysoftware.com/) */ - struct scr_screenshots_thread_s *next, *back; + struct scr_screenshots_thread_s *next; void *thread; int ended; @@ -2164,9 +2162,9 @@ static int SCR_ScreenShot_Async_Thread(void *data) height = it->height; keep_alpha = it->keep_alpha; buffer1 = (unsigned char *)(it+1); - buffer2 = (unsigned char *)Mem_Alloc(scr_screenshots_mempool, width * height * (keep_alpha ? 4 : 3)); + buffer2 = (unsigned char *)malloc(width * height * (keep_alpha ? 4 : 3)); ret = SCR_ScreenShot_Sync(it->filename, buffer1, buffer2, it->x, it->y, width, height, it->flipx, it->flipy, it->flipdiagonal, it->jpeg, it->png, it->gammacorrect, keep_alpha, Dummy_ReadPixelsBGRA); - Mem_Free(buffer2); + free(buffer2); it->ended = 1; // don't care about mutex sync objects... return ret; } @@ -2217,7 +2215,6 @@ qboolean SCR_ScreenShot_Async(char *filename, int x, int y, int width, int heigh if (!it->thread) goto failure2; it->next = NULL; - it->back = scr_screenshots_thread_last; if(scr_screenshots_thread_last) scr_screenshots_thread_last->next = it; scr_screenshots_thread_last = it; diff --git a/makefile.inc b/makefile.inc index c7e98d22..91dc6777 100644 --- a/makefile.inc +++ b/makefile.inc @@ -189,7 +189,8 @@ OPTIM_DEBUG=$(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS) -OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS) +#OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS) +OPTIM_RELEASE=-O3 -flto -fno-strict-aliasing $(CPUOPTIMIZATIONS) # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag DO_CC=$(CC) $(CFLAGS) -c $< -o $@ @@ -228,9 +229,9 @@ CMD_UNIXMKDIR=mkdir -p ##### Linux specific variables ##### # Link -LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXCL) -LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXSDL) +LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -Wl,-z,now -Wl,-z,relro $(LDFLAGS_UNIXCL) +LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -Wl,-z,now -Wl,-z,relro +LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -Wl,-z,now -Wl,-z,relro $(LDFLAGS_UNIXSDL) ##### Mac OS X specific variables ##### diff --git a/model_brush.c b/model_brush.c index 9f8d70e1..990d64f0 100644 --- a/model_brush.c +++ b/model_brush.c @@ -4236,7 +4236,7 @@ static void Mod_Q2BSP_LoadNodes(sizebuf_t *sb) out->numsurfaces = (unsigned short)MSG_ReadLittleShort(sb); if (out->firstsurface + out->numsurfaces > (unsigned int)loadmodel->num_surfaces) { - Con_Printf("Mod_Q2BSP_LoadNodes: invalid surface index range %i+%i (file has only %i surfaces)\n", p, out->firstsurface, out->numsurfaces, loadmodel->num_surfaces); + Con_Printf("Mod_Q2BSP_LoadNodes: invalid surface index range %i+%i (file has only %i surfaces)\n", out->firstsurface, out->numsurfaces, loadmodel->num_surfaces); out->firstsurface = 0; out->numsurfaces = 0; } diff --git a/svvm_cmds.c b/svvm_cmds.c index ff55c4fd..ad188670 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -241,7 +241,7 @@ static void VM_SV_setorigin(prvm_prog_t *prog) { prvm_edict_t *e; - VM_SAFEPARMCOUNT(2, VM_setorigin); + VM_SAFEPARMCOUNT(2, VM_SV_setorigin); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -292,7 +292,7 @@ static void VM_SV_setsize(prvm_prog_t *prog) prvm_edict_t *e; vec3_t mins, maxs; - VM_SAFEPARMCOUNT(3, VM_setsize); + VM_SAFEPARMCOUNT(3, VM_SV_setsize); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -325,7 +325,7 @@ static void VM_SV_setmodel(prvm_prog_t *prog) dp_model_t *mod; int i; - VM_SAFEPARMCOUNT(2, VM_setmodel); + VM_SAFEPARMCOUNT(2, VM_SV_setmodel); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) diff --git a/sys_shared.c b/sys_shared.c index 03c05985..88a1aa1e 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -4,6 +4,10 @@ # endif #endif +#if defined(__GNUC__) && defined(__FAST_MATH__) // Izy's Patch +#error "__FAST_MATH__ was defined by the GCC compiler. You are using -ffast-math" +#endif + #include "quakedef.h" #include "thread.h" @@ -533,7 +537,7 @@ static int CPUID_Features(void) " movl %%edi,%%ebx\n" : "=m" (features) : - : "%eax", "%ecx", "%edx", "%edi" + : "%eax", "%ecx", "%edx", "%edi", "cc" // fix, izy's ); # elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) __asm { -- 2.39.2