fix !!ver so it actually works, allowing later glsl version (for stuff like 'flat')

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4683 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-06-08 09:36:15 +00:00
parent 854c56d9c0
commit d143045118
6 changed files with 21 additions and 16 deletions

View file

@ -5310,7 +5310,6 @@ void NET_GetLocalAddress (int socket, netadr_t *out)
{ {
#if defined(_WIN32) && defined(HAVE_PACKET) #if defined(_WIN32) && defined(HAVE_PACKET)
char buff[512]; char buff[512];
char adrbuf[MAX_ADR_SIZE];
struct sockaddr_qstorage address; struct sockaddr_qstorage address;
int namelen; int namelen;
netadr_t adr = {0}; netadr_t adr = {0};
@ -5362,6 +5361,7 @@ void NET_GetLocalAddress (int socket, netadr_t *out)
if (!notvalid) if (!notvalid)
{ {
// char adrbuf[MAX_ADR_SIZE];
// Con_TPrintf("Client IP address %s\n", NET_AdrToString (adrbuf, sizeof(adrbuf), out) ); // Con_TPrintf("Client IP address %s\n", NET_AdrToString (adrbuf, sizeof(adrbuf), out) );
return; return;
} }

View file

@ -325,7 +325,7 @@ static qboolean D3D11Shader_LoadBlob(program_t *prog, const char *name, unsigned
return success; return success;
} }
qboolean D3D11Shader_CreateProgram (program_t *prog, const char *name, unsigned int permu, const char **precompilerconstants, const char *vert, const char *hull, const char *domain, const char *frag, qboolean silenterrors, vfsfile_t *blobfile) qboolean D3D11Shader_CreateProgram (program_t *prog, const char *name, unsigned int permu, int ver, const char **precompilerconstants, const char *vert, const char *hull, const char *domain, const char *frag, qboolean silenterrors, vfsfile_t *blobfile)
{ {
char *vsformat; char *vsformat;
char *hsformat = NULL; char *hsformat = NULL;

View file

@ -141,7 +141,7 @@ static dllhandle_t *shaderlib;
(This)->lpVtbl -> Release(This) (This)->lpVtbl -> Release(This)
#endif #endif
static qboolean D3D9Shader_CreateProgram (program_t *prog, const char *sname, unsigned int permu, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *frag, qboolean silent, vfsfile_t *blobfile) static qboolean D3D9Shader_CreateProgram (program_t *prog, const char *sname, unsigned int permu, int ver, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *frag, qboolean silent, vfsfile_t *blobfile)
{ {
D3DXMACRO defines[64]; D3DXMACRO defines[64];
LPD3DXBUFFER code = NULL, errors = NULL; LPD3DXBUFFER code = NULL, errors = NULL;

View file

@ -893,6 +893,8 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
qboolean onefailed = false; qboolean onefailed = false;
extern cvar_t gl_specular; extern cvar_t gl_specular;
ver = 0;
if (qrenderer != qrtype) if (qrenderer != qrtype)
{ {
return false; return false;
@ -1031,14 +1033,14 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
{ {
unsigned int magic; unsigned int magic;
unsigned int corrupt = false; unsigned int corrupt = false;
char ver[MAX_QPATH]; char ever[MAX_QPATH];
char *thisver = version_string(); char *thisever = version_string();
corrupt |= VFS_READ(blobfile, &magic, sizeof(magic)) != sizeof(magic); corrupt |= VFS_READ(blobfile, &magic, sizeof(magic)) != sizeof(magic);
corrupt |= magic != *(unsigned int*)"FBLB"; corrupt |= magic != *(unsigned int*)"FBLB";
corrupt |= VFS_READ(blobfile, &blobheaderoffset, sizeof(blobheaderoffset)) != sizeof(blobheaderoffset); corrupt |= VFS_READ(blobfile, &blobheaderoffset, sizeof(blobheaderoffset)) != sizeof(blobheaderoffset);
corrupt |= VFS_READ(blobfile, ver, sizeof(ver)) != sizeof(ver); corrupt |= VFS_READ(blobfile, ever, sizeof(ever)) != sizeof(ever);
corrupt |= strcmp(ver, thisver); corrupt |= strcmp(ever, thisever);
//if the magic or header didn't read properly then the file is corrupt //if the magic or header didn't read properly then the file is corrupt
if (corrupt) if (corrupt)
{ {
@ -1051,9 +1053,9 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
VFS_SEEK(blobfile, 0); VFS_SEEK(blobfile, 0);
magic = *(unsigned int*)"FBLB"; //magic magic = *(unsigned int*)"FBLB"; //magic
VFS_WRITE(blobfile, &magic, sizeof(magic)); VFS_WRITE(blobfile, &magic, sizeof(magic));
memset(ver, 0, sizeof(ver)); //make sure we don't leak stuff. memset(ever, 0, sizeof(ever)); //make sure we don't leak stuff.
Q_strncpyz(ver, thisver, sizeof(ver)); Q_strncpyz(ever, thisever, sizeof(ever));
VFS_WRITE(blobfile, ver, sizeof(ver)); VFS_WRITE(blobfile, ever, sizeof(ever));
blobheaderoffset = 0; blobheaderoffset = 0;
} }
} }
@ -1200,7 +1202,7 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
initoffset = VFS_GETLEN(blobfile); initoffset = VFS_GETLEN(blobfile);
VFS_SEEK(blobfile, initoffset); VFS_SEEK(blobfile, initoffset);
} }
if (!sh_config.pCreateProgram(prog, name, p, permutationdefines, script, tess?script:NULL, tess?script:NULL, script, (p & PERMUTATION_SKELETAL)?true:onefailed, blobfile)) if (!sh_config.pCreateProgram(prog, name, p, ver, permutationdefines, script, tess?script:NULL, tess?script:NULL, script, (p & PERMUTATION_SKELETAL)?true:onefailed, blobfile))
{ {
if (!(p & PERMUTATION_SKELETAL)) if (!(p & PERMUTATION_SKELETAL))
onefailed = true; //don't flag it if skeletal failed. onefailed = true; //don't flag it if skeletal failed.

View file

@ -1686,11 +1686,14 @@ GLhandleARB GLSlang_CreateProgram(const char *name, int ver, const char **precom
return handle; return handle;
} }
qboolean GLSlang_CreateProgramPermu(program_t *prog, const char *name, unsigned int permu, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *frag, qboolean noerrors, vfsfile_t *blobfile) qboolean GLSlang_CreateProgramPermu(program_t *prog, const char *name, unsigned int permu, int ver, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *frag, qboolean noerrors, vfsfile_t *blobfile)
{ {
int ver = gl_config.gles?100:110; if (!ver)
{
ver = gl_config.gles?100:110;
if (permu & PERMUTATION_SKELETAL) if (permu & PERMUTATION_SKELETAL)
ver = 120; ver = 120;
}
prog->permu[permu].handle.glsl = GLSlang_CreateProgram(name, ver, precompilerconstants, vert, frag, noerrors, blobfile); prog->permu[permu].handle.glsl = GLSlang_CreateProgram(name, ver, precompilerconstants, vert, frag, noerrors, blobfile);
if (prog->permu[permu].handle.glsl) if (prog->permu[permu].handle.glsl)
return true; return true;

View file

@ -633,7 +633,7 @@ typedef struct
void (*pDeleteProg) (program_t *prog, unsigned int permu); void (*pDeleteProg) (program_t *prog, unsigned int permu);
qboolean (*pLoadBlob) (program_t *prog, const char *name, unsigned int permu, vfsfile_t *blobfile); qboolean (*pLoadBlob) (program_t *prog, const char *name, unsigned int permu, vfsfile_t *blobfile);
qboolean (*pCreateProgram) (program_t *prog, const char *name, unsigned int permu, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *frag, qboolean noerrors, vfsfile_t *blobfile); qboolean (*pCreateProgram) (program_t *prog, const char *name, unsigned int permu, int ver, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *frag, qboolean noerrors, vfsfile_t *blobfile);
void (*pProgAutoFields) (program_t *prog, char **cvarnames, int *cvartypes); void (*pProgAutoFields) (program_t *prog, char **cvarnames, int *cvartypes);
} sh_config_t; } sh_config_t;
extern sh_config_t sh_config; extern sh_config_t sh_config;