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:
parent
151bd6d0b1
commit
74a7dff814
25 changed files with 407 additions and 388 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -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
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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]);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -56,7 +56,7 @@ void GLVID_SwapBuffers(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps)
|
qboolean GLVID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue