Update prediction code to propagate some values properly with certain protocol combinations that I'd overlooked.
Try to fix problems caused by (auto)save's screenshots Added code to allow falling back on stbi for when libpng/libjpeg are not compiled it, at eukara's request. Handle .exr image files as suggested by eukara, when the appropriate library is available. Fix mipmaps etc for half-float files. Enable support for stbi's special gif loader, loading gifs as an 2darray texture. Add code for threading the qcvm's tempstring recycling, disabled due to paranoia but does otherwise help xonotic perf (at the cost of extra ram). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5548 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2498024a77
commit
cfd20f4f06
49 changed files with 1656 additions and 606 deletions
|
@ -77,6 +77,7 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
char tempname[256];
|
||||
char tempvert[256];
|
||||
char tempfrag[256];
|
||||
char incpath[256], *sl;
|
||||
int inheader = 1;
|
||||
int i;
|
||||
unsigned short constid = 256; //first few are reserved.
|
||||
|
@ -94,9 +95,19 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
NULL
|
||||
};
|
||||
|
||||
snprintf(tempname, sizeof(tempname), "vulkan/temp.tmp");
|
||||
snprintf(tempvert, sizeof(tempvert), "vulkan/temp.vert");
|
||||
snprintf(tempfrag, sizeof(tempfrag), "vulkan/temp.frag");
|
||||
const char *tmppath = "/tmp/";
|
||||
|
||||
char customsamplerlines[16][256];
|
||||
|
||||
snprintf(tempname, sizeof(tempname), "%stemp.tmp", tmppath);
|
||||
snprintf(tempvert, sizeof(tempvert), "%stemp.vert", tmppath);
|
||||
snprintf(tempfrag, sizeof(tempfrag), "%stemp.frag", tmppath);
|
||||
|
||||
memcpy(incpath, glslname, sizeof(incpath));
|
||||
if ((sl = strrchr(incpath, '/')))
|
||||
sl[1] = 0;
|
||||
else if ((sl = strrchr(incpath, '\\'))) //in case someone is on crappy windows.
|
||||
sl[1] = 0;
|
||||
|
||||
memcpy(blob->blobmagic, "\xffSPV", 4);
|
||||
blob->blobversion = 1;
|
||||
|
@ -243,10 +254,34 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
blob->defaulttextures |= 1u<<13 | 1u<<17 | 1u<<18 | 1u<<19;
|
||||
|
||||
//shader pass
|
||||
else if (atoi(arg))
|
||||
blob->numtextures = atoi(arg);
|
||||
else if ((i=atoi(arg)))
|
||||
{ //legacy
|
||||
if (blob->numtextures < i)
|
||||
blob->numtextures = i;
|
||||
}
|
||||
else
|
||||
printf("Unknown texture: \"%s\"\n", arg);
|
||||
{
|
||||
char *eq = strrchr(arg, '=');
|
||||
if (eq)
|
||||
{
|
||||
char *type = strrchr(arg, ':');
|
||||
int pass = atoi(eq+1);
|
||||
*eq = 0;
|
||||
if (type)
|
||||
*type++ = 0;
|
||||
else
|
||||
type = "2D";
|
||||
if (pass < 16)
|
||||
{
|
||||
snprintf(customsamplerlines[pass], sizeof(customsamplerlines[pass]), "uniform sampler%s s_%s;\n", type, arg);
|
||||
if (blob->numtextures < ++pass)
|
||||
blob->numtextures = pass;
|
||||
}
|
||||
else printf("sampler binding too high: %s:%s=%i\n", arg, type, pass);
|
||||
}
|
||||
else
|
||||
printf("Unknown texture: \"%s\"\n", arg);
|
||||
}
|
||||
} while((arg = strtok(NULL, " ,\r\n")));
|
||||
}
|
||||
continue;
|
||||
|
@ -295,7 +330,11 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
}
|
||||
for (i = 0; i < blob->numtextures; i++)
|
||||
{
|
||||
fprintf(temp, "layout(set=0, binding=%u) uniform sampler2D s_t%u;\n", binding++, i);
|
||||
fprintf(temp, "layout(set=0, binding=%u) ", binding++);
|
||||
if (*customsamplerlines[i])
|
||||
fprintf(temp, "%s", customsamplerlines[i]);
|
||||
else
|
||||
fprintf(temp, "uniform sampler2D s_t%u;\n", i);
|
||||
}
|
||||
fprintf(temp, "#endif\n");
|
||||
|
||||
|
@ -415,7 +454,7 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
#else
|
||||
"echo \"#version 450 core\" > %s && "
|
||||
#endif
|
||||
"cpp %s -DVULKAN -DVERTEX_SHADER -P >> %s && "
|
||||
"cpp %s -I%s -DVULKAN -DVERTEX_SHADER -P >> %s && "
|
||||
|
||||
/*preprocess the fragment shader*/
|
||||
#ifdef _WIN32
|
||||
|
@ -423,7 +462,7 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
#else
|
||||
"echo \"#version 450 core\" > %s && "
|
||||
#endif
|
||||
"cpp %s -DVULKAN -DFRAGMENT_SHADER -P >> %s && "
|
||||
"cpp %s -I%s -DVULKAN -DFRAGMENT_SHADER -P >> %s && "
|
||||
|
||||
/*convert to spir-v (annoyingly we have no control over the output file names*/
|
||||
"glslangValidator -V -l -d %s %s"
|
||||
|
@ -431,13 +470,15 @@ int generatevulkanblobs(struct blobheader *blob, size_t maxblobsize, const char
|
|||
/*strip stuff out, so drivers don't glitch out from stuff that we don't use*/
|
||||
// " && spirv-remap -i vert.spv frag.spv -o vulkan/remap"
|
||||
|
||||
,tempvert, tempname, tempvert, tempfrag, tempname, tempfrag, tempvert, tempfrag);
|
||||
,tempvert, tempname, incpath, tempvert //vertex shader args
|
||||
,tempfrag, tempname, incpath, tempfrag //fragment shader args
|
||||
,tempvert, tempfrag); //compile/link args.
|
||||
|
||||
system(command);
|
||||
|
||||
remove(tempname);
|
||||
remove(tempvert);
|
||||
remove(tempfrag);
|
||||
// remove(tempname);
|
||||
// remove(tempvert);
|
||||
// remove(tempfrag);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -451,6 +492,12 @@ int main(int argc, const char **argv)
|
|||
char line[256];
|
||||
int r = 1;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
printf("%s input.glsl output.fvb\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!generatevulkanblobs((struct blobheader*)proto, sizeof(proto), inname))
|
||||
return 1;
|
||||
//should have generated two files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue