1
0
Fork 0
forked from fte/fteqw

Make sure vk+x11 can deal with window resizes properly. Fix some warnings. Deal with hardware that uses gamma ramps larger than 256 entries on x11.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5011 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2016-07-28 15:57:22 +00:00
parent 151bd6d0b1
commit 74a7dff814
25 changed files with 407 additions and 388 deletions

View file

@ -1130,7 +1130,7 @@ ifeq ($(FTE_TARGET),bsd)
M_EXE_NAME=../fteqw M_EXE_NAME=../fteqw
MCL_EXE_NAME=../fteqwcl MCL_EXE_NAME=../fteqwcl
M_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) -lpthread M_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) -lpthread
M_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include M_CFLAGS=$(VKCFLAGS) $(GLCFLAGS) -I/usr/X11R6/include
MB_DIR=m_bsd MB_DIR=m_bsd
MCL_DIR=mcl_bsd MCL_DIR=mcl_bsd

View file

@ -323,9 +323,9 @@ static package_t *BuildPackageList(vfsfile_t *f, int flags, const char *url, con
} }
if (*prefix) if (*prefix)
Q_snprintfz(p->fullname, sizeof(p->fullname), "%s/%s", prefix, Cmd_Argv(0)); Q_snprintfz(p->fullname, sizeof(p->fullname), "%s/%s", prefix, fullname);
else else
Q_snprintfz(p->fullname, sizeof(p->fullname), "%s", Cmd_Argv(0)); Q_snprintfz(p->fullname, sizeof(p->fullname), "%s", fullname);
p->name = COM_SkipPath(p->fullname); p->name = COM_SkipPath(p->fullname);
if (!gamedir) if (!gamedir)
@ -483,7 +483,6 @@ static package_t *BuildPackageList(vfsfile_t *f, int flags, const char *url, con
static void COM_QuotedConcat(const char *cat, char *buf, size_t bufsize) static void COM_QuotedConcat(const char *cat, char *buf, size_t bufsize)
{ {
qboolean haswhite = false;
const unsigned char *gah; const unsigned char *gah;
for (gah = (const unsigned char*)cat; *gah; gah++) for (gah = (const unsigned char*)cat; *gah; gah++)
{ {

View file

@ -406,7 +406,7 @@ typedef struct rendererinfo_s {
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette); qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
void (*VID_DeInit) (void); void (*VID_DeInit) (void);
void (*VID_SwapBuffers) (void); //force a buffer swap, regardless of what's displayed. void (*VID_SwapBuffers) (void); //force a buffer swap, regardless of what's displayed.
qboolean (*VID_ApplyGammaRamps) (unsigned short *ramps); qboolean (*VID_ApplyGammaRamps) (unsigned int size, unsigned short *ramps);
void *(*VID_CreateCursor) (const char *filename, float hotx, float hoty, float scale); //may be null, stub returns null void *(*VID_CreateCursor) (const char *filename, float hotx, float hoty, float scale); //may be null, stub returns null
qboolean (*VID_SetCursor) (void *cursor); //may be null qboolean (*VID_SetCursor) (void *cursor); //may be null

View file

@ -318,7 +318,7 @@ static void CSQC_FindGlobals(qboolean nofuncs)
if (!csqcg.trace_surfaceflagsf && !csqcg.trace_surfaceflagsi) if (!csqcg.trace_surfaceflagsf && !csqcg.trace_surfaceflagsi)
{ {
etype_t etype; etype_t etype = ev_void;
eval_t *v = PR_FindGlobal(csqcprogs, "trace_surfaceflags", 0, &etype); eval_t *v = PR_FindGlobal(csqcprogs, "trace_surfaceflags", 0, &etype);
if (etype == ev_float) if (etype == ev_float)
csqcg.trace_surfaceflagsf = &v->_float; csqcg.trace_surfaceflagsf = &v->_float;
@ -327,7 +327,7 @@ static void CSQC_FindGlobals(qboolean nofuncs)
} }
if (!csqcg.trace_endcontentsf && !csqcg.trace_endcontentsi) if (!csqcg.trace_endcontentsf && !csqcg.trace_endcontentsi)
{ {
etype_t etype; etype_t etype = ev_void;
eval_t *v = PR_FindGlobal(csqcprogs, "trace_endcontents", 0, &etype); eval_t *v = PR_FindGlobal(csqcprogs, "trace_endcontents", 0, &etype);
if (etype == ev_float) if (etype == ev_float)
csqcg.trace_endcontentsf = &v->_float; csqcg.trace_endcontentsf = &v->_float;

View file

@ -1263,10 +1263,13 @@ q2colormap:
TRACE(("dbg: R_ApplyRenderer: Palette loaded\n")); TRACE(("dbg: R_ApplyRenderer: Palette loaded\n"));
if (newr) if (newr)
{
vid.gammarampsize = 256; //make a guess.
if (!VID_Init(newr, host_basepal)) if (!VID_Init(newr, host_basepal))
{ {
return false; return false;
} }
}
TRACE(("dbg: R_ApplyRenderer: vid applied\n")); TRACE(("dbg: R_ApplyRenderer: vid applied\n"));
W_LoadWadFile("gfx.wad"); W_LoadWadFile("gfx.wad");

View file

@ -618,79 +618,80 @@ void DumpGLState(void);
#endif #endif
static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext) static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext)
{ {
int fd; int fd;
void *array[64]; void *array[64];
size_t size; size_t size;
int firstframe = 0; int firstframe = 0;
char signame[32]; char signame[32];
switch(sig) switch(sig)
{ {
case SIGINT: strcpy(signame, "SIGINT"); break; case SIGINT: strcpy(signame, "SIGINT"); break;
case SIGILL: strcpy(signame, "SIGILL"); break; case SIGILL: strcpy(signame, "SIGILL"); break;
case SIGFPE: strcpy(signame, "SIGFPE"); break; case SIGFPE: strcpy(signame, "SIGFPE"); break;
case SIGBUS: strcpy(signame, "SIGBUS"); break; case SIGBUS: strcpy(signame, "SIGBUS"); break;
case SIGSEGV: Q_snprintfz(signame, sizeof(signame), "SIGSEGV (%p)", info->si_addr); break; case SIGSEGV: Q_snprintfz(signame, sizeof(signame), "SIGSEGV (%p)", info->si_addr); break;
default: Q_snprintfz(signame, sizeof(signame), "%i", sig); break; default: Q_snprintfz(signame, sizeof(signame), "%i", sig); break;
} }
// get void*'s for all entries on the stack // get void*'s for all entries on the stack
size = backtrace(array, sizeof(array)/sizeof(array[0])); size = backtrace(array, sizeof(array)/sizeof(array[0]));
#if defined(__i386__) #if defined(__i386__)
//x86 signals don't leave the stack in a clean state, so replace the signal handler with the real crash address, and hide this function //x86 signals don't leave the stack in a clean state, so replace the signal handler with the real crash address, and hide this function
ucontext_t *uc = vcontext; ucontext_t *uc = vcontext;
array[1] = (void*)uc->uc_mcontext.gregs[REG_EIP]; array[1] = (void*)uc->uc_mcontext.gregs[REG_EIP];
firstframe = 1; firstframe = 1;
#elif defined(__amd64__) #elif defined(__amd64__)
//amd64 is sane enough, but this function and the libc signal handler are on the stack, and should be ignored. //amd64 is sane enough, but this function and the libc signal handler are on the stack, and should be ignored.
firstframe = 2; firstframe = 2;
#endif #endif
// print out all the frames to stderr // print out all the frames to stderr
fprintf(stderr, "Error: signal %s:\n", signame); fprintf(stderr, "Error: signal %s:\n", signame);
backtrace_symbols_fd(array+firstframe, size-firstframe, 2); backtrace_symbols_fd(array+firstframe, size-firstframe, 2);
if (sig == SIGINT) if (sig == SIGINT)
fd = -1; //don't write out crash logs on ctrl+c fd = -1; //don't write out crash logs on ctrl+c
else else
fd = open("crash.log", O_WRONLY|O_CREAT|O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP); fd = open("crash.log", O_WRONLY|O_CREAT|O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP);
if (fd != -1) if (fd != -1)
{ {
time_t rawtime; time_t rawtime;
struct tm * timeinfo; struct tm * timeinfo;
char buffer [80]; char buffer [80];
time (&rawtime); time (&rawtime);
timeinfo = localtime (&rawtime); timeinfo = localtime (&rawtime);
strftime (buffer, sizeof(buffer), "Time: %Y-%m-%d %H:%M:%S\n",timeinfo); strftime (buffer, sizeof(buffer), "Time: %Y-%m-%d %H:%M:%S\n",timeinfo);
write(fd, buffer, strlen(buffer)); write(fd, buffer, strlen(buffer));
Q_snprintfz(buffer, sizeof(buffer), "Binary: "__DATE__" "__TIME__"\n"); Q_snprintfz(buffer, sizeof(buffer), "Binary: "__DATE__" "__TIME__"\n");
write(fd, buffer, strlen(buffer)); write(fd, buffer, strlen(buffer));
Q_snprintfz(buffer, sizeof(buffer), "Ver: %i.%02i%s\n", FTE_VER_MAJOR, FTE_VER_MINOR, Q_snprintfz(buffer, sizeof(buffer), "Ver: %i.%02i%s\n", FTE_VER_MAJOR, FTE_VER_MINOR,
#ifdef OFFICIAL_RELEASE #ifdef OFFICIAL_RELEASE
" (official)"); " (official)");
#else #else
""); "");
#endif #endif
write(fd, buffer, strlen(buffer)); write(fd, buffer, strlen(buffer));
#ifdef SVNREVISION #ifdef SVNREVISION
if (strcmp(STRINGIFY(SVNREVISION), "-")) if (strcmp(STRINGIFY(SVNREVISION), "-"))
{ {
Q_snprintfz(buffer, sizeof(buffer), "Revision: %s\n", STRINGIFY(SVNREVISION)); Q_snprintfz(buffer, sizeof(buffer), "Revision: %s\n", STRINGIFY(SVNREVISION));
write(fd, buffer, strlen(buffer)); write(fd, buffer, strlen(buffer));
} }
#endif #endif
backtrace_symbols_fd(array + firstframe, size - firstframe, fd); backtrace_symbols_fd(array + firstframe, size - firstframe, fd);
write(fd, "\n", 1); write(fd, "\n", 1);
close(fd); close(fd);
} }
#if defined(DEBUG) && defined(GLQUAKE) #if defined(DEBUG) && defined(GLQUAKE)
DumpGLState(); if (qrenderer == QR_OPENGL)
DumpGLState();
#endif #endif
exit(1); exit(1);
} }
#endif #endif
// ======================================================================= // =======================================================================

View file

@ -75,6 +75,7 @@ typedef struct
qboolean activeapp; qboolean activeapp;
qboolean isminimized; //can omit rendering as it won't be seen anyway. qboolean isminimized; //can omit rendering as it won't be seen anyway.
int fullbright; // index of first fullbright color int fullbright; // index of first fullbright color
int gammarampsize; //typically 256. but can be up to 1024 (yay 10-bit hardware that's crippled to only actually use 8)
unsigned fbvwidth; /*virtual 2d width of the current framebuffer image*/ unsigned fbvwidth; /*virtual 2d width of the current framebuffer image*/
unsigned fbvheight; /*virtual 2d height*/ unsigned fbvheight; /*virtual 2d height*/
@ -103,7 +104,7 @@ extern unsigned int d_8to24bgrtable[256];
#ifdef GLQUAKE #ifdef GLQUAKE
//called when gamma ramps need to be reapplied //called when gamma ramps need to be reapplied
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps); qboolean GLVID_ApplyGammaRamps (unsigned int size, unsigned short *ramps);
qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette); qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette);
// Called at startup to set up translation tables, takes 256 8 bit RGB values // Called at startup to set up translation tables, takes 256 8 bit RGB values

View file

@ -150,7 +150,7 @@ static void Headless_VID_DeInit (void)
static void Headless_VID_SwapBuffers (void) static void Headless_VID_SwapBuffers (void)
{ {
} }
static qboolean Headless_VID_ApplyGammaRamps (unsigned short *ramps) static qboolean Headless_VID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
return false; return false;
} }

View file

@ -324,7 +324,6 @@ cvar_t v_brightness = CVARFDC("brightness", "0.0", CVAR_ARCHIVE, "Brightness is
qbyte gammatable[256]; // palette is sent through this qbyte gammatable[256]; // palette is sent through this
unsigned short ramps[3][256];
qboolean gammaworks; qboolean gammaworks;
float hw_blend[4]; // rgba 0.0 - 1.0 float hw_blend[4]; // rgba 0.0 - 1.0
/* /*
@ -849,6 +848,9 @@ void V_UpdatePalette (qboolean force)
if (hw_blend[0] != newhw_blend[0] || hw_blend[1] != newhw_blend[1] || hw_blend[2] != newhw_blend[2] || hw_blend[3] != newhw_blend[3] || force) if (hw_blend[0] != newhw_blend[0] || hw_blend[1] != newhw_blend[1] || hw_blend[2] != newhw_blend[2] || hw_blend[3] != newhw_blend[3] || force)
{ {
float r,g,b,a; float r,g,b,a;
static unsigned short allramps[3*2048];
unsigned int rampsize = min(vid.gammarampsize, countof(allramps)/3);
unsigned short *ramps[3] = {&allramps[0],&allramps[rampsize],&allramps[rampsize*2]};
Vector4Copy(newhw_blend, hw_blend); Vector4Copy(newhw_blend, hw_blend);
a = hw_blend[3]; a = hw_blend[3];
@ -857,7 +859,8 @@ void V_UpdatePalette (qboolean force)
b = 255*hw_blend[2]*a; b = 255*hw_blend[2]*a;
a = 1-a; a = 1-a;
for (i=0 ; i<256 ; i++) a *= 256.0/rampsize;
for (i=0 ; i < rampsize; i++)
{ {
ir = i*a + r; ir = i*a + r;
ig = i*a + g; ig = i*a + g;
@ -869,6 +872,7 @@ void V_UpdatePalette (qboolean force)
if (ib > 255) if (ib > 255)
ib = 255; ib = 255;
//FIXME: shit precision
ramps[0][i] = gammatable[ir]<<8; ramps[0][i] = gammatable[ir]<<8;
ramps[1][i] = gammatable[ig]<<8; ramps[1][i] = gammatable[ig]<<8;
ramps[2][i] = gammatable[ib]<<8; ramps[2][i] = gammatable[ib]<<8;
@ -876,9 +880,9 @@ void V_UpdatePalette (qboolean force)
if (qrenderer) if (qrenderer)
{ {
applied = rf->VID_ApplyGammaRamps ((unsigned short*)ramps); applied = rf->VID_ApplyGammaRamps (rampsize, allramps);
if (!applied && r2d_canhwgamma) if (!applied && r2d_canhwgamma)
rf->VID_ApplyGammaRamps (NULL); rf->VID_ApplyGammaRamps (0, NULL);
r2d_canhwgamma = applied; r2d_canhwgamma = applied;
} }
} }

View file

@ -2251,7 +2251,7 @@ qboolean Mod_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3],
#ifdef SKELETALMODELS #ifdef SKELETALMODELS
if (mod->ofs_skel_weight) if (mod->ofs_skel_weight)
{ //fixme: would be better to consider the distance to the vertex too. cartesian coord stuff etc. { //fixme: would be better to consider the distance to the vertex too. cartesian coord stuff etc.
unsigned int best = 0, v, w, i; unsigned int v, w, i;
float bw = 0; float bw = 0;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
@ -7839,4 +7839,4 @@ void Alias_Register(void)
Mod_RegisterModelFormatText(NULL, "MD5 Mesh/Anim (md5mesh)", "MD5Version", Mod_LoadMD5MeshModel); Mod_RegisterModelFormatText(NULL, "MD5 Mesh/Anim (md5mesh)", "MD5Version", Mod_LoadMD5MeshModel);
Mod_RegisterModelFormatText(NULL, "External Anim", "EXTERNALANIM", Mod_LoadCompositeAnim); Mod_RegisterModelFormatText(NULL, "External Anim", "EXTERNALANIM", Mod_LoadCompositeAnim);
#endif #endif
} }

View file

@ -4548,6 +4548,9 @@ void COM_Version_f (void)
Con_Printf("(GLSL)"); Con_Printf("(GLSL)");
#endif #endif
#endif #endif
#ifdef VKQUAKE
Con_Printf(" Vulkan");
#endif
#ifdef D3D9QUAKE #ifdef D3D9QUAKE
Con_Printf(" Direct3D9"); Con_Printf(" Direct3D9");
#endif #endif
@ -5069,7 +5072,7 @@ static int COM_WorkerThread(void *arg)
static void Sys_ErrorThread(void *ctx, void *data, size_t a, size_t b) static void Sys_ErrorThread(void *ctx, void *data, size_t a, size_t b)
{ {
//posted to main thread from a worker. //posted to main thread from a worker.
Sys_Error("%s", data); Sys_Error("%s", (const char*)data);
} }
void COM_WorkerAbort(char *message) void COM_WorkerAbort(char *message)
{ {

View file

@ -790,11 +790,11 @@ static void (D3D9_VID_DeInit) (void)
// Cvar_Unhook(&v_brightness); // Cvar_Unhook(&v_brightness);
} }
qboolean D3D9_VID_ApplyGammaRamps (unsigned short *ramps) qboolean D3D9_VID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
if (d3dpp.Windowed) if (d3dpp.Windowed)
return false; return false;
if (pD3DDev9 && ramps) if (pD3DDev9 && ramps && gammarampsize == 256)
IDirect3DDevice9_SetGammaRamp(pD3DDev9, 0, D3DSGR_NO_CALIBRATION, (D3DGAMMARAMP *)ramps); IDirect3DDevice9_SetGammaRamp(pD3DDev9, 0, D3DSGR_NO_CALIBRATION, (D3DGAMMARAMP *)ramps);
return true; return true;
} }

View file

@ -1058,6 +1058,7 @@ extern float hw_blend[4]; // rgba 0.0 - 1.0
static void D3D11_BuildRamps(int points, DXGI_RGB *out) static void D3D11_BuildRamps(int points, DXGI_RGB *out)
{ {
//FIXME: repack input rather than recalculating.
int i; int i;
vec3_t cshift; vec3_t cshift;
vec3_t c; vec3_t c;
@ -1076,7 +1077,7 @@ static void D3D11_BuildRamps(int points, DXGI_RGB *out)
} }
} }
static qboolean D3D11_VID_ApplyGammaRamps(unsigned short *ramps) static qboolean D3D11_VID_ApplyGammaRamps(unsigned int gammarampsize, unsigned short *ramps)
{ {
HRESULT hr; HRESULT hr;
DXGI_GAMMA_CONTROL_CAPABILITIES caps; DXGI_GAMMA_CONTROL_CAPABILITIES caps;

View file

@ -184,7 +184,7 @@ void GLVID_SwapBuffers(void)
} }
#endif #endif
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps) qboolean GLVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
return false; return false;
} }

View file

@ -327,8 +327,9 @@ static struct
XF86VidModeModeInfo **modes; XF86VidModeModeInfo **modes;
int num_modes; int num_modes;
int usemode; int usemode;
unsigned short originalramps[3][256]; unsigned short originalramps[3][2048];
qboolean originalapplied; //states that the origionalramps arrays are valid, and contain stuff that we should revert to on close qboolean originalapplied; //states that the origionalramps arrays are valid, and contain stuff that we should revert to on close
int originalrampsize;
} vm; } vm;
static qboolean VMODE_Init(void) static qboolean VMODE_Init(void)
{ {
@ -1017,6 +1018,9 @@ static void GetEvent(void)
x11.pXFreeEventData(vid_dpy, &event.xcookie); x11.pXFreeEventData(vid_dpy, &event.xcookie);
break; break;
case ResizeRequest: case ResizeRequest:
#ifdef VKQUAKE
vk.neednewswapchain = true;
#endif
vid.pixelwidth = event.xresizerequest.width; vid.pixelwidth = event.xresizerequest.width;
vid.pixelheight = event.xresizerequest.height; vid.pixelheight = event.xresizerequest.height;
Cvar_ForceCallback(&vid_conautoscale); Cvar_ForceCallback(&vid_conautoscale);
@ -1026,6 +1030,9 @@ static void GetEvent(void)
case ConfigureNotify: case ConfigureNotify:
if (event.xconfigurerequest.window == vid_window) if (event.xconfigurerequest.window == vid_window)
{ {
#ifdef VKQUAKE
vk.neednewswapchain = true;
#endif
vid.pixelwidth = event.xconfigurerequest.width; vid.pixelwidth = event.xconfigurerequest.width;
vid.pixelheight = event.xconfigurerequest.height; vid.pixelheight = event.xconfigurerequest.height;
Cvar_ForceCallback(&vid_conautoscale); Cvar_ForceCallback(&vid_conautoscale);
@ -1179,7 +1186,7 @@ static void GetEvent(void)
} }
if (vm.originalapplied) if (vm.originalapplied)
vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]);
mw = vid_window; mw = vid_window;
if ((fullscreenflags & FULLSCREEN_LEGACY) && (fullscreenflags & FULLSCREEN_ACTIVE)) if ((fullscreenflags & FULLSCREEN_LEGACY) && (fullscreenflags & FULLSCREEN_ACTIVE))
@ -1267,7 +1274,7 @@ void GLVID_Shutdown(void)
uninstall_grabs(); uninstall_grabs();
if (vm.originalapplied) if (vm.originalapplied)
vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]);
X_ShutdownUnicode(); X_ShutdownUnicode();
@ -1344,7 +1351,7 @@ static Cursor CreateNullCursor(Display *display, Window root)
return cursor; return cursor;
} }
qboolean GLVID_ApplyGammaRamps(unsigned short *ramps) qboolean GLVID_ApplyGammaRamps(unsigned int rampcount, unsigned short *ramps)
{ {
extern qboolean gammaworks; extern qboolean gammaworks;
//extern cvar_t vid_hardwaregamma; //extern cvar_t vid_hardwaregamma;
@ -1353,7 +1360,7 @@ qboolean GLVID_ApplyGammaRamps(unsigned short *ramps)
if (!vm.originalapplied) if (!vm.originalapplied)
return false; return false;
if (ramps) if (ramps || rampcount != vm.originalrampsize)
{ {
//hardwaregamma==1 skips hardware gamma when we're not fullscreen, in favour of software glsl based gamma. //hardwaregamma==1 skips hardware gamma when we're not fullscreen, in favour of software glsl based gamma.
// if (vid_hardwaregamma.value == 1 && !vid.activeapp && !(fullscreenflags & FULLSCREEN_ACTIVE)) // if (vid_hardwaregamma.value == 1 && !vid.activeapp && !(fullscreenflags & FULLSCREEN_ACTIVE))
@ -1365,15 +1372,15 @@ qboolean GLVID_ApplyGammaRamps(unsigned short *ramps)
//we have hardware gamma applied - if we're doing a BF, we don't want to reset to the default gamma if it randomly fails (yuck) //we have hardware gamma applied - if we're doing a BF, we don't want to reset to the default gamma if it randomly fails (yuck)
if (gammaworks) if (gammaworks)
vm.pXF86VidModeSetGammaRamp (vid_dpy, scrnum, 256, &ramps[0], &ramps[256], &ramps[512]); vm.pXF86VidModeSetGammaRamp (vid_dpy, scrnum, rampcount, &ramps[0], &ramps[rampcount], &ramps[rampcount*2]);
else else
gammaworks = !!vm.pXF86VidModeSetGammaRamp (vid_dpy, scrnum, 256, &ramps[0], &ramps[256], &ramps[512]); gammaworks = !!vm.pXF86VidModeSetGammaRamp (vid_dpy, scrnum, rampcount, &ramps[0], &ramps[rampcount], &ramps[rampcount*2]);
return gammaworks; return gammaworks;
} }
else else
{ {
vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]);
return true; return true;
} }
} }
@ -1845,13 +1852,16 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
{ {
int rampsize = 256; int rampsize = 256;
vm.pXF86VidModeGetGammaRampSize(vid_dpy, scrnum, &rampsize); vm.pXF86VidModeGetGammaRampSize(vid_dpy, scrnum, &rampsize);
if (rampsize != 256) if (rampsize > countof(vm.originalramps[0]))
{ {
vm.originalapplied = false; vm.originalapplied = false;
Con_Printf("Gamma ramps are not of 256 components (but %i).\n", rampsize); Con_Printf("Gamma ramps are not of 256 components (but %i).\n", rampsize);
} }
else else
vm.originalapplied = vm.pXF86VidModeGetGammaRamp(vid_dpy, scrnum, 256, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); {
vm.originalrampsize = vid.gammarampsize = rampsize;
vm.originalapplied = vm.pXF86VidModeGetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]);
}
} }
else else
vm.originalapplied = false; vm.originalapplied = false;
@ -2033,7 +2043,7 @@ void Sys_SendKeyEvents(void)
if (fullscreenflags & FULLSCREEN_VMODE) if (fullscreenflags & FULLSCREEN_VMODE)
{ {
if (vm.originalapplied) if (vm.originalapplied)
vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]);
if (fullscreenflags & FULLSCREEN_VMODEACTIVE) if (fullscreenflags & FULLSCREEN_VMODEACTIVE)
{ {
vm.pXF86VidModeSwitchToMode(vid_dpy, scrnum, vm.modes[0]); vm.pXF86VidModeSwitchToMode(vid_dpy, scrnum, vm.modes[0]);

View file

@ -1831,11 +1831,11 @@ void OblitterateOldGamma(void)
} }
} }
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps) qboolean GLVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
if (ramps) if (ramps)
{ {
if (!gammaworks) if (!gammaworks || gammarampsize != 256)
return false; return false;
if (vid_hardwaregamma.value == 1 && modestate == MS_WINDOWED) if (vid_hardwaregamma.value == 1 && modestate == MS_WINDOWED)

View file

@ -68,7 +68,7 @@ void RPI_DeInit(void)
{ {
EGL_Shutdown(); EGL_Shutdown();
} }
qboolean RPI_ApplyGammaRamps(unsigned short *ramps) qboolean RPI_ApplyGammaRamps(unsigned int gammarampsize, unsigned short *ramps)
{ {
//not supported //not supported
return false; return false;

View file

@ -328,10 +328,10 @@ void GLVID_SwapBuffers (void)
} }
} }
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps) qboolean GLVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
#if SDL_MAJOR_VERSION >= 2 #if SDL_MAJOR_VERSION >= 2
if (ramps) if (ramps && gammarampsize == 256)
{ {
if (vid_hardwaregamma.value) if (vid_hardwaregamma.value)
{ {
@ -353,7 +353,7 @@ qboolean GLVID_ApplyGammaRamps (unsigned short *ramps)
return true; return true;
} }
#else #else
if (ramps) if (ramps && gammarampsize == 256)
{ {
if (vid_hardwaregamma.value) if (vid_hardwaregamma.value)
{ {

View file

@ -396,7 +396,7 @@ static void WL_DeInit(void)
EGL_Shutdown(); EGL_Shutdown();
wl_egl_window_destroy(w.enwindow); wl_egl_window_destroy(w.enwindow);
} }
static qboolean WL_ApplyGammaRamps(unsigned short *ramps) static qboolean WL_ApplyGammaRamps(unsigned int gammarampsize, unsigned short *ramps)
{ {
//not supported //not supported
return false; return false;

View file

@ -1,299 +1,299 @@
#include "quakedef.h" #include "quakedef.h"
#include "glquake.h" #include "glquake.h"
#include <ppapi/c/ppb_core.h> #include <ppapi/c/ppb_core.h>
#include <ppapi/c/pp_completion_callback.h> #include <ppapi/c/pp_completion_callback.h>
#include <ppapi/gles2/gl2ext_ppapi.h> #include <ppapi/gles2/gl2ext_ppapi.h>
#include <ppapi/c/ppb_graphics_3d.h> #include <ppapi/c/ppb_graphics_3d.h>
#include <ppapi/c/ppb_instance.h> #include <ppapi/c/ppb_instance.h>
#include <ppapi/c/pp_errors.h> #include <ppapi/c/pp_errors.h>
extern PPB_Core *ppb_core; extern PPB_Core *ppb_core;
extern PPB_GetInterface sys_gbi; extern PPB_GetInterface sys_gbi;
extern PPB_Graphics3D* graphics3d_interface; extern PPB_Graphics3D* graphics3d_interface;
extern PP_Instance pp_instance; extern PP_Instance pp_instance;
static PP_Resource glcontext; static PP_Resource glcontext;
extern PPB_Instance* instance_interface; extern PPB_Instance* instance_interface;
qboolean swappending; qboolean swappending;
extern cvar_t vid_vsync; extern cvar_t vid_vsync;
void FrameEvent(void* user_data, int32_t result); void FrameEvent(void* user_data, int32_t result);
qboolean NAGL_SwapPending(void) qboolean NAGL_SwapPending(void)
{ {
return swappending; return swappending;
} }
void swap_callback(void* user_data, int32_t result) void swap_callback(void* user_data, int32_t result)
{ {
if (swappending) if (swappending)
{ {
swappending = false; swappending = false;
FrameEvent(NULL, 0); FrameEvent(NULL, 0);
} }
} }
void GLVID_SwapBuffers(void) void GLVID_SwapBuffers(void)
{ {
qboolean vsync = vid_vsync.ival || !*vid_vsync.string; qboolean vsync = vid_vsync.ival || !*vid_vsync.string;
struct PP_CompletionCallback ccb = { swap_callback, NULL, vsync?PP_COMPLETIONCALLBACK_FLAG_NONE:PP_COMPLETIONCALLBACK_FLAG_OPTIONAL}; struct PP_CompletionCallback ccb = { swap_callback, NULL, vsync?PP_COMPLETIONCALLBACK_FLAG_NONE:PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
glFlush(); glFlush();
switch(graphics3d_interface->SwapBuffers(glcontext, ccb)) switch(graphics3d_interface->SwapBuffers(glcontext, ccb))
{ {
case PP_OK_COMPLETIONPENDING: case PP_OK_COMPLETIONPENDING:
swappending |= vsync; swappending |= vsync;
break; break;
case PP_OK: case PP_OK:
break; break;
case PP_ERROR_INPROGRESS: case PP_ERROR_INPROGRESS:
Con_DPrintf("chrome still can't handle vid_wait 0. forcing vsync\n"); Con_DPrintf("chrome still can't handle vid_wait 0. forcing vsync\n");
vid_vsync.ival = 1; vid_vsync.ival = 1;
break; break;
default: default:
Con_DPrintf("unknown error on SwapBuffers call\n"); Con_DPrintf("unknown error on SwapBuffers call\n");
break; break;
} }
} }
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps) qboolean GLVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
return false; return false;
} }
void *PPAPI_GetGLSymbol(char *symname) void *PPAPI_GetGLSymbol(char *symname)
{ {
int i; int i;
static struct {char *name; void *ptr;} funcs[] = static struct {char *name; void *ptr;} funcs[] =
{ {
#define f(n) {#n , n}, #define f(n) {#n , n},
f(glActiveTexture) f(glActiveTexture)
f(glAttachShader) f(glAttachShader)
f(glBindAttribLocation) f(glBindAttribLocation)
f(glBindBuffer) f(glBindBuffer)
f(glBindFramebuffer) f(glBindFramebuffer)
f(glBindRenderbuffer) f(glBindRenderbuffer)
f(glBindTexture) f(glBindTexture)
f(glBlendColor) f(glBlendColor)
f(glBlendEquation) f(glBlendEquation)
f(glBlendEquationSeparate) f(glBlendEquationSeparate)
f(glBlendFunc) f(glBlendFunc)
f(glBlendFuncSeparate) f(glBlendFuncSeparate)
f(glBufferData) f(glBufferData)
f(glBufferSubData) f(glBufferSubData)
f(glCheckFramebufferStatus) f(glCheckFramebufferStatus)
f(glClear) f(glClear)
f(glClearColor) f(glClearColor)
f(glClearDepthf) f(glClearDepthf)
f(glClearStencil) f(glClearStencil)
f(glColorMask) f(glColorMask)
f(glCompileShader) f(glCompileShader)
f(glCompressedTexImage2D) f(glCompressedTexImage2D)
f(glCompressedTexSubImage2D) f(glCompressedTexSubImage2D)
f(glCopyTexImage2D) f(glCopyTexImage2D)
f(glCopyTexSubImage2D) f(glCopyTexSubImage2D)
f(glCreateProgram) f(glCreateProgram)
f(glCreateShader) f(glCreateShader)
f(glCullFace) f(glCullFace)
f(glDeleteBuffers) f(glDeleteBuffers)
f(glDeleteFramebuffers) f(glDeleteFramebuffers)
f(glDeleteProgram) f(glDeleteProgram)
f(glDeleteRenderbuffers) f(glDeleteRenderbuffers)
f(glDeleteShader) f(glDeleteShader)
f(glDeleteTextures) f(glDeleteTextures)
f(glDepthFunc) f(glDepthFunc)
f(glDepthMask) f(glDepthMask)
f(glDepthRangef) f(glDepthRangef)
f(glDetachShader) f(glDetachShader)
f(glDisable) f(glDisable)
f(glDisableVertexAttribArray) f(glDisableVertexAttribArray)
f(glDrawArrays) f(glDrawArrays)
f(glDrawElements) f(glDrawElements)
f(glEnable) f(glEnable)
f(glEnableVertexAttribArray) f(glEnableVertexAttribArray)
f(glFinish) f(glFinish)
f(glFlush) f(glFlush)
f(glFramebufferRenderbuffer) f(glFramebufferRenderbuffer)
f(glFramebufferTexture2D) f(glFramebufferTexture2D)
f(glFrontFace) f(glFrontFace)
f(glGenBuffers) f(glGenBuffers)
f(glGenerateMipmap) f(glGenerateMipmap)
f(glGenFramebuffers) f(glGenFramebuffers)
f(glGenRenderbuffers) f(glGenRenderbuffers)
f(glGenTextures) f(glGenTextures)
f(glGetActiveAttrib) f(glGetActiveAttrib)
f(glGetActiveUniform) f(glGetActiveUniform)
f(glGetAttachedShaders) f(glGetAttachedShaders)
f(glGetAttribLocation) f(glGetAttribLocation)
f(glGetBooleanv) f(glGetBooleanv)
f(glGetBufferParameteriv) f(glGetBufferParameteriv)
f(glGetError) f(glGetError)
f(glGetFloatv) f(glGetFloatv)
f(glGetFramebufferAttachmentParameteriv) f(glGetFramebufferAttachmentParameteriv)
f(glGetIntegerv) f(glGetIntegerv)
f(glGetProgramiv) f(glGetProgramiv)
f(glGetProgramInfoLog) f(glGetProgramInfoLog)
f(glGetRenderbufferParameteriv) f(glGetRenderbufferParameteriv)
f(glGetShaderiv) f(glGetShaderiv)
f(glGetShaderInfoLog) f(glGetShaderInfoLog)
f(glGetShaderPrecisionFormat) f(glGetShaderPrecisionFormat)
f(glGetShaderSource) f(glGetShaderSource)
f(glGetString) f(glGetString)
f(glGetTexParameterfv) f(glGetTexParameterfv)
f(glGetTexParameteriv) f(glGetTexParameteriv)
f(glGetUniformfv) f(glGetUniformfv)
f(glGetUniformiv) f(glGetUniformiv)
f(glGetUniformLocation) f(glGetUniformLocation)
f(glGetVertexAttribfv) f(glGetVertexAttribfv)
f(glGetVertexAttribiv) f(glGetVertexAttribiv)
f(glGetVertexAttribPointerv) f(glGetVertexAttribPointerv)
f(glHint) f(glHint)
f(glIsBuffer) f(glIsBuffer)
f(glIsEnabled) f(glIsEnabled)
f(glIsFramebuffer) f(glIsFramebuffer)
f(glIsProgram) f(glIsProgram)
f(glIsRenderbuffer) f(glIsRenderbuffer)
f(glIsShader) f(glIsShader)
f(glIsTexture) f(glIsTexture)
f(glLineWidth) f(glLineWidth)
f(glLinkProgram) f(glLinkProgram)
f(glPixelStorei) f(glPixelStorei)
f(glPolygonOffset) f(glPolygonOffset)
f(glReadPixels) f(glReadPixels)
f(glReleaseShaderCompiler) f(glReleaseShaderCompiler)
f(glRenderbufferStorage) f(glRenderbufferStorage)
f(glSampleCoverage) f(glSampleCoverage)
f(glScissor) f(glScissor)
f(glShaderBinary) f(glShaderBinary)
f(glShaderSource) f(glShaderSource)
f(glStencilFunc) f(glStencilFunc)
f(glStencilFuncSeparate) f(glStencilFuncSeparate)
f(glStencilMask) f(glStencilMask)
f(glStencilMaskSeparate) f(glStencilMaskSeparate)
f(glStencilOp) f(glStencilOp)
f(glStencilOpSeparate) f(glStencilOpSeparate)
f(glTexImage2D) f(glTexImage2D)
f(glTexParameterf) f(glTexParameterf)
f(glTexParameterfv) f(glTexParameterfv)
f(glTexParameteri) f(glTexParameteri)
f(glTexParameteriv) f(glTexParameteriv)
f(glTexSubImage2D) f(glTexSubImage2D)
f(glUniform1f) f(glUniform1f)
f(glUniform1fv) f(glUniform1fv)
f(glUniform1i) f(glUniform1i)
f(glUniform1iv) f(glUniform1iv)
f(glUniform2f) f(glUniform2f)
f(glUniform2fv) f(glUniform2fv)
f(glUniform2i) f(glUniform2i)
f(glUniform2iv) f(glUniform2iv)
f(glUniform3f) f(glUniform3f)
f(glUniform3fv) f(glUniform3fv)
f(glUniform3i) f(glUniform3i)
f(glUniform3iv) f(glUniform3iv)
f(glUniform4f) f(glUniform4f)
f(glUniform4fv) f(glUniform4fv)
f(glUniform4i) f(glUniform4i)
f(glUniform4iv) f(glUniform4iv)
f(glUniformMatrix2fv) f(glUniformMatrix2fv)
f(glUniformMatrix3fv) f(glUniformMatrix3fv)
f(glUniformMatrix4fv) f(glUniformMatrix4fv)
f(glUseProgram) f(glUseProgram)
f(glValidateProgram) f(glValidateProgram)
f(glVertexAttrib1f) f(glVertexAttrib1f)
f(glVertexAttrib1fv) f(glVertexAttrib1fv)
f(glVertexAttrib2f) f(glVertexAttrib2f)
f(glVertexAttrib2fv) f(glVertexAttrib2fv)
f(glVertexAttrib3f) f(glVertexAttrib3f)
f(glVertexAttrib3fv) f(glVertexAttrib3fv)
f(glVertexAttrib4f) f(glVertexAttrib4f)
f(glVertexAttrib4fv) f(glVertexAttrib4fv)
f(glVertexAttribPointer) f(glVertexAttribPointer)
f(glViewport) f(glViewport)
{NULL} {NULL}
}; };
for (i = 0; funcs[i].name; i++) for (i = 0; funcs[i].name; i++)
{ {
if (!strcmp(funcs[i].name, symname)) if (!strcmp(funcs[i].name, symname))
return funcs[i].ptr; return funcs[i].ptr;
} }
return NULL; return NULL;
} }
void GL_Resized(int width, int height) void GL_Resized(int width, int height)
{ {
extern cvar_t vid_conautoscale, vid_conwidth; extern cvar_t vid_conautoscale, vid_conwidth;
vid.pixelwidth = width; vid.pixelwidth = width;
vid.pixelheight = height; vid.pixelheight = height;
if (glcontext) if (glcontext)
{ {
graphics3d_interface->ResizeBuffers(glcontext, width, height); graphics3d_interface->ResizeBuffers(glcontext, width, height);
Cvar_ForceCallback(&vid_conautoscale); Cvar_ForceCallback(&vid_conautoscale);
Cvar_ForceCallback(&vid_conwidth); Cvar_ForceCallback(&vid_conwidth);
} }
} }
qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
{ {
if (!vid.pixelwidth) if (!vid.pixelwidth)
vid.pixelwidth = info->width; vid.pixelwidth = info->width;
if (!vid.pixelheight) if (!vid.pixelheight)
vid.pixelheight = info->height; vid.pixelheight = info->height;
if (vid.pixelwidth < 320) if (vid.pixelwidth < 320)
vid.pixelwidth = 320; vid.pixelwidth = 320;
if (vid.pixelheight < 200) if (vid.pixelheight < 200)
vid.pixelheight = 200; vid.pixelheight = 200;
int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, vid.pixelwidth, int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, vid.pixelwidth,
PP_GRAPHICS3DATTRIB_HEIGHT, vid.pixelheight, PP_GRAPHICS3DATTRIB_HEIGHT, vid.pixelheight,
PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR, PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED, PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR, PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED,
PP_GRAPHICS3DATTRIB_NONE}; PP_GRAPHICS3DATTRIB_NONE};
glcontext = graphics3d_interface->Create(pp_instance, 0, attribs); glcontext = graphics3d_interface->Create(pp_instance, 0, attribs);
glSetCurrentContextPPAPI(glcontext); glSetCurrentContextPPAPI(glcontext);
if (!instance_interface->BindGraphics(pp_instance, glcontext)) if (!instance_interface->BindGraphics(pp_instance, glcontext))
{ {
Con_Printf("failed to bind context\n"); Con_Printf("failed to bind context\n");
return false; return false;
} }
glClearColor(1.0f, 0.0f, 0.0f, 1.0f); glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
GLVID_SwapBuffers(); GLVID_SwapBuffers();
// vid.pixelwidth = info->width; // vid.pixelwidth = info->width;
// vid.pixelheight = info->height; // vid.pixelheight = info->height;
GL_Init(PPAPI_GetGLSymbol); GL_Init(PPAPI_GetGLSymbol);
return true; return true;
} }
void GLVID_Shutdown (void) void GLVID_Shutdown (void)
{ {
glClearColor(1.0f, 0.0f, 0.0f, 1.0f); glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
GLVID_SwapBuffers(); GLVID_SwapBuffers();
ppb_core->ReleaseResource(glcontext); ppb_core->ReleaseResource(glcontext);
// glTerminatePPAPI(); // glTerminatePPAPI();
} }
void GLVID_DeInit (void) void GLVID_DeInit (void)
{ {
GLVID_Shutdown(); GLVID_Shutdown();
} }
void GLVID_Crashed(void); void GLVID_Crashed(void);
void GLVID_Update (vrect_t *rects); void GLVID_Update (vrect_t *rects);
int GLVID_SetMode (rendererstate_t *info, unsigned char *palette); int GLVID_SetMode (rendererstate_t *info, unsigned char *palette);
void GLVID_SetCaption(const char *caption) void GLVID_SetCaption(const char *caption)
{ {
} }

View file

@ -768,7 +768,7 @@ void SW_VID_DeInit(void)
ChangeDisplaySettings (NULL, 0); ChangeDisplaySettings (NULL, 0);
} }
qboolean SW_VID_ApplyGammaRamps (unsigned short *ramps) qboolean SW_VID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
return false; return false;
} }

View file

@ -407,7 +407,7 @@ static VkSampler VK_GetSampler(unsigned int flags)
#endif #endif
//creates the layout stuff for the prog. //creates the layout stuff for the prog.
static VK_FinishProg(program_t *prog, const char *name) static void VK_FinishProg(program_t *prog, const char *name)
{ {
{ {
VkDescriptorSetLayout desclayout; VkDescriptorSetLayout desclayout;
@ -4862,7 +4862,6 @@ static qboolean BE_GenerateRefraction(batch_t *batch, shader_t *bs)
if (bs->flags & SHADER_HASREFLECT) if (bs->flags & SHADER_HASREFLECT)
{ {
struct vk_rendertarg *targ = vk.rendertarg;
vrect_t orect = r_refdef.vrect; vrect_t orect = r_refdef.vrect;
pxrect_t oprect = r_refdef.pxrect; pxrect_t oprect = r_refdef.pxrect;

View file

@ -1336,8 +1336,6 @@ static qboolean VK_R_RenderScene_Cubemap(struct vk_rendertarg *fb)
shader_t *shader; shader_t *shader;
int facemask; int facemask;
extern cvar_t r_projection; extern cvar_t r_projection;
int oldfbo = -1;
qboolean fboreset = false;
int osm = r_refdef.stereomethod; int osm = r_refdef.stereomethod;
struct vk_rendertarg_cube *rtc = &vk_rt_cubemap; struct vk_rendertarg_cube *rtc = &vk_rt_cubemap;
@ -3178,10 +3176,10 @@ void VK_Shutdown(void)
size_t size; size_t size;
if (VK_SUCCESS == vkGetPipelineCacheData(vk.device, vk.pipelinecache, &size, NULL)) if (VK_SUCCESS == vkGetPipelineCacheData(vk.device, vk.pipelinecache, &size, NULL))
{ {
void *ptr = BZ_Malloc(size); void *ptr = Z_Malloc(size); //valgrind says nvidia isn't initialising this.
if (VK_SUCCESS == vkGetPipelineCacheData(vk.device, vk.pipelinecache, &size, ptr)) if (VK_SUCCESS == vkGetPipelineCacheData(vk.device, vk.pipelinecache, &size, ptr))
FS_WriteFile("vulkan.pcache", ptr, size, FS_ROOT); FS_WriteFile("vulkan.pcache", ptr, size, FS_ROOT);
BZ_Free(ptr); Z_Free(ptr);
} }
vkDestroyPipelineCache(vk.device, vk.pipelinecache, vkallocationcb); vkDestroyPipelineCache(vk.device, vk.pipelinecache, vkallocationcb);
} }

View file

@ -953,11 +953,11 @@ static void OblitterateOldGamma(void)
} }
} }
static qboolean VKVID_ApplyGammaRamps (unsigned short *ramps) static qboolean VKVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
if (ramps) if (ramps)
{ {
if (!gammaworks) if (!gammaworks || gammarampsize != 256)
return false; return false;
if (vid_hardwaregamma.value == 1 && modestate == MS_WINDOWED) if (vid_hardwaregamma.value == 1 && modestate == MS_WINDOWED)

View file

@ -268,7 +268,7 @@ void GLVID_SwapBuffers (void)
*/ */
} }
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps) qboolean GLVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
{ {
gammaworks = false; gammaworks = false;
return gammaworks; return gammaworks;