]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
apply new patch submitted in irc by mynick1 nyov/izy-threaded-screenshot-patch
authorMrBougo <mrbougo@xonotic.org>
Thu, 20 Nov 2014 16:20:00 +0000 (17:20 +0100)
committerMrBougo <mrbougo@xonotic.org>
Thu, 20 Nov 2014 16:20:00 +0000 (17:20 +0100)
description:
- makefile: makefile with LTO
- sys_shared: missing CC in asm code
- screenshot: removed unused variables

cl_screen.c
makefile.inc
model_brush.c
svvm_cmds.c
sys_shared.c

index 0f607844ea4572f96c51cc04238d22b6bc943b67..ffd295d7de30a7ef02f8c941b516c4e9d5198d52 100644 (file)
@@ -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;
index c7e98d22ab8a1d60112496e8cf9c31067972c9a3..91dc6777195e39f10f2745ae2933782bd82d3f3d 100644 (file)
@@ -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 #####
index 9f8d70e122c09f70934d03f78c266caef0a3e5e8..990d64f0661e71d0daf6efb7b2dddc5c0847309d 100644 (file)
@@ -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;
                }
index ff55c4fde46479e66de9f4ae38559fc6b2d974d5..ad188670342e86677ecb3892b13ef183c6c9ad11 100644 (file)
@@ -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)
index 03c059850eaf8183e6a192656adf0df0080d3af5..88a1aa1e0fd8bea6417deded16683ebfe8f8bbdd 100644 (file)
@@ -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 {