misc windows-related fixes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5346 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-11-28 05:41:39 +00:00
parent fea0ab8014
commit f464d0fef3
19 changed files with 67 additions and 39 deletions

View file

@ -3387,16 +3387,14 @@ void CL_LinkStaticEntities(void *pvs)
if (pvs && !cl.worldmodel->funcs.EdictInFatPVS(cl.worldmodel, &stat->pvscache, pvs))
continue;
// emit particles for statics (we don't need to cheat check statics)
if (stat->state.u.q1.emiteffectnum)
P_EmitEffect (stat->ent.origin, stat->ent.axis, MDLF_EMITFORWARDS, CL_TranslateParticleFromServer(stat->state.u.q1.emiteffectnum), &(stat->emit));
else if (clmodel && clmodel->particleeffect >= 0 && gl_part_flame.ival)
else if (clmodel)
{
// TODO: this is ugly.. assumes ent is in static entities, and subtracts
// pointer math to get an index to use in cl_static emit
// there needs to be a cleaner method for this
if (clmodel->particleeffect >= 0 && gl_part_flame.ival)
P_EmitEffect(stat->ent.origin, stat->ent.axis, clmodel->engineflags, clmodel->particleeffect, &stat->emit);
if ((!r_drawflame.ival) && (clmodel->engineflags & MDLF_FLAME))
continue;
}

View file

@ -2695,7 +2695,7 @@ static void SCR_ScreenShot_VR_f(void)
COM_DefaultExtension (filename, scr_sshot_type.string, sizeof(filename));
ext = COM_GetFileExtension(filename, NULL);
stereo = !strcasecmp(ext, ".pns") || !strcasecmp(ext, ".jns");
stereo = !Q_strcasecmp(ext, ".pns") || !Q_strcasecmp(ext, ".jns");

View file

@ -914,6 +914,7 @@ qboolean WriteTGA(char *filename, enum fs_relative fsroot, const qbyte *fte_rest
#define png_const_structp png_structp
#define png_const_bytep png_bytep
#define png_const_unknown_chunkp png_unknown_chunkp
#define png_const_textp png_textp
#endif
#if PNG_LIBPNG_VER < 10600
#define png_inforp png_infop

View file

@ -3457,8 +3457,11 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
"end: skin-=1\n"
"pgup: frame+=1\n"
"pgdn: frame-=1\n"
"mins: %g %g %g, maxs: %g %g %g\n", ent.model->mins[0], ent.model->mins[1], ent.model->mins[2], ent.model->maxs[0], ent.model->maxs[1], ent.model->maxs[2])
, CON_WHITEMASK, CPRINT_TALIGN|CPRINT_LALIGN, font_default, fs);
"mins: %g %g %g, maxs: %g %g %g\n"
"flags: %#x %#x\n",
ent.model->mins[0], ent.model->mins[1], ent.model->mins[2], ent.model->maxs[0], ent.model->maxs[1], ent.model->maxs[2],
ent.model->flags, ent.model->engineflags),
CON_WHITEMASK, CPRINT_TALIGN|CPRINT_LALIGN, font_default, fs);
break;
case MV_COLLISION:
if (!ent.model)

View file

@ -2373,7 +2373,7 @@ void QCBUILTIN PF_fwrite (pubprogfuncs_t *prinst, struct globalvars_s *pr_global
return;
}
G_INT(OFS_PARM1) = PF_fwrite_internal (prinst, fnum, prinst->stringtable + ptr, size);
G_INT(OFS_RETURN) = PF_fwrite_internal (prinst, fnum, prinst->stringtable + ptr, size);
}
void QCBUILTIN PF_fread (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -2386,7 +2386,7 @@ void QCBUILTIN PF_fread (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
return;
}
G_INT(OFS_PARM1) = PF_fread_internal (prinst, fnum, prinst->stringtable + ptr, size);
G_INT(OFS_RETURN) = PF_fread_internal (prinst, fnum, prinst->stringtable + ptr, size);
}
void QCBUILTIN PF_fseek (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{

View file

@ -1957,9 +1957,11 @@ static void BE_RenderMeshProgram(program_t *p, shaderpass_t *pass, unsigned int
pp = p->permu[perm];
if (!pp)
{
pp = Shader_LoadPermutation(p, perm);
p->permu[perm] = pp = Shader_LoadPermutation(p, perm);
if (!pp)
pp = p->permu[perm=0];
{ //failed? copy from 0 so we don't keep re-failing
pp = p->permu[perm] = p->permu[0];
}
}
BE_ApplyUniforms(p, pp);

View file

@ -212,11 +212,15 @@ void D3D11Shader_DeleteProg(program_t *prog)
ID3D11VertexShader *vert;
unsigned int permu, l;
struct programpermu_s *pp;
for (permu = 0; permu < countof(prog->permu); permu++)
for (permu = countof(prog->permu); permu-- > 0; )
{
pp = prog->permu[permu];
if (!pp)
continue;
prog->permu[permu] = NULL;
if (pp == prog->permu[0] && permu)
continue; //entry 0 (only) can get copied to avoid constant recompile failures (0 is always precompiled)
vert = pp->h.hlsl.vert;
frag = pp->h.hlsl.frag;
if (vert)
@ -229,6 +233,7 @@ void D3D11Shader_DeleteProg(program_t *prog)
if (layout)
ID3D11InputLayout_Release(layout);
}
Z_Free(pp);
}
}

View file

@ -2669,6 +2669,8 @@ static void BE_UploadLightmaps(qboolean force)
if (!TEXLOADED(lm->lightmap_texture))
lm->lightmap_texture = Image_CreateTexture("***lightmap***", NULL, (r_lightmap_nearest.ival?IF_NEAREST:IF_LINEAR)|IF_NOMIPMAP);
tex = lm->lightmap_texture->ptr;
if (lm->fmt != PTI_BGRA8)
continue; //erk!
if (!tex)
{
IDirect3DDevice8_CreateTexture(pD3DDev8, lm->width, lm->height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &tex);
@ -2687,7 +2689,7 @@ static void BE_UploadLightmaps(qboolean force)
IDirect3DTexture8_LockRect(tex, 0, &lock, &rect, 0);
for (r = 0, w = theRect->r-theRect->l; r < lightmap[i]->rectchange.b-lightmap[i]->rectchange.t; r++)
{
memcpy((char*)lock.pBits + r*lock.Pitch, lightmap[i]->lightmaps+(theRect->l+((r+theRect->t)*lm->width))*lightmap_bytes, w*lightmap_bytes);
memcpy((char*)lock.pBits + r*lock.Pitch, lightmap[i]->lightmaps+(theRect->l+((r+theRect->t)*lm->width))*4, w*4);
}
IDirect3DTexture8_UnlockRect(tex, 0);
theRect->l = lm->width;

View file

@ -179,7 +179,7 @@ typedef struct
float m_model[16];
unsigned int lastpasscount;
vbo_t *batchvbo;
program_t *curprog;
struct programpermu_s *curperm;
shader_t *shader_rtlight;
IDirect3DTexture9 *curtex[MAX_TMUS];
@ -1932,9 +1932,9 @@ static void BE_ApplyUniforms(program_t *prog, struct programpermu_s *perm)
vec4_t param4;
int h;
int i;
if (shaderstate.curprog != prog)
if (shaderstate.curperm != perm)
{
shaderstate.curprog = prog;
shaderstate.curperm = perm;
IDirect3DDevice9_SetVertexShader(pD3DDev9, perm->h.hlsl.vert);
IDirect3DDevice9_SetPixelShader(pD3DDev9, perm->h.hlsl.frag);
}
@ -2120,10 +2120,7 @@ static unsigned int BE_DrawMeshChain_SetupProgram(program_t *p)
perm |= PERMUTATION_FOG;
#ifdef NONSKELETALMODELS
if (shaderstate.batchvbo && shaderstate.batchvbo->coord2.d3d.buff)
{
perm |= PERMUTATION_FRAMEBLEND;
vdec |= D3D_VDEC_POS2;
}
#endif
// if (p->permu[perm|PERMUTATION_DELUXE].h.loaded && TEXVALID(shaderstate.curtexnums->bump) && shaderstate.curbatch->lightmap[0] >= 0 && lightmap[shaderstate.curbatch->lightmap[0]]->hasdeluxe)
// perm |= PERMUTATION_DELUXE;
@ -2138,10 +2135,13 @@ static unsigned int BE_DrawMeshChain_SetupProgram(program_t *p)
pp = p->permu[perm];
if (!pp)
{
pp = p->permu[perm] = Shader_LoadPermutation(p, perm);
p->permu[perm] = pp = Shader_LoadPermutation(p, perm);
if (!pp)
pp = p->permu[perm=0];
{ //failed? copy from 0 so we don't keep re-failing
pp = p->permu[perm] = p->permu[0];
}
}
perm = pp->permutation;
if (perm & PERMUTATION_FRAMEBLEND)
vdec |= D3D_VDEC_POS2;
@ -2232,9 +2232,9 @@ static qboolean BE_DrawMeshChain_SetupPass(shaderpass_t *pass, unsigned int vert
}
else
{
if (shaderstate.curprog)
if (shaderstate.curperm)
{
shaderstate.curprog = NULL;
shaderstate.curperm = NULL;
IDirect3DDevice9_SetVertexShader(pD3DDev9, NULL);
IDirect3DDevice9_SetPixelShader(pD3DDev9, NULL);
}
@ -2340,12 +2340,9 @@ static void BE_RenderMeshProgram(shader_t *s, unsigned int vertbase, unsigned in
perm |= PERMUTATION_FOG;
#ifdef NONSKELETALMODELS
if (shaderstate.batchvbo && shaderstate.batchvbo->coord2.d3d.buff)
{
perm |= PERMUTATION_FRAMEBLEND;
vdec |= D3D_VDEC_POS2;
}
#endif
// if (p->permu[perm|PERMUTATION_DELUXE].h.loaded && TEXVALID(shaderstate.curtexnums->bump) && shaderstate.curbatch->lightmap[0] >= 0 && lightmap[shaderstate.curbatch->lightmap[0]]->hasdeluxe)
// if (TEXVALID(shaderstate.curtexnums->bump) && shaderstate.curbatch->lightmap[0] >= 0 && lightmap[shaderstate.curbatch->lightmap[0]]->hasdeluxe)
// perm |= PERMUTATION_DELUXE;
#if MAXRLIGHTMAPS > 1
if (shaderstate.curbatch && shaderstate.curbatch->lightmap[1] >= 0)
@ -2358,10 +2355,13 @@ static void BE_RenderMeshProgram(shader_t *s, unsigned int vertbase, unsigned in
pp = p->permu[perm];
if (!pp)
{
pp = Shader_LoadPermutation(p, perm);
p->permu[perm] = pp = Shader_LoadPermutation(p, perm);
if (!pp)
pp = p->permu[perm=0];
{ //failed? copy from 0 so we don't keep re-failing
pp = p->permu[perm] = p->permu[0];
}
}
perm = pp->permutation;
if (perm & PERMUTATION_FRAMEBLEND)
vdec |= D3D_VDEC_POS2;

View file

@ -515,11 +515,14 @@ void D3D9Shader_DeleteProg(program_t *prog)
{
unsigned int permu;
struct programpermu_s *pp;
for (permu = 0; permu < countof(prog->permu); permu++)
for (permu = countof(prog->permu); permu-- > 0; )
{
pp = prog->permu[permu];
if (!pp)
continue;
prog->permu[permu] = NULL;
if (pp == prog->permu[0] && permu)
continue; //entry 0 (only) can get copied to avoid constant recompile failures (0 is always precompiled)
if (pp->h.hlsl.vert)
{
IDirect3DVertexShader9 *vs = pp->h.hlsl.vert;
@ -546,6 +549,7 @@ void D3D9Shader_DeleteProg(program_t *prog)
}
pp->numparms = 0;
BZ_Free(pp->parm);
Z_Free(pp);
}
}

View file

@ -1162,7 +1162,7 @@ static qboolean (D3D8_SCR_UpdateScreen) (void)
if (uimenu != 1)
{
if (r_worldentity.model && cls.state == ca_active)
V_RenderView ();
V_RenderView (nohud);
else
{
noworld = true;

View file

@ -2830,7 +2830,7 @@ void BE_GenModelBatches(batch_t **batches, const dlight_t *dl, unsigned int bemo
{
if (gl_part_flame.value)
{
if (ent->model->engineflags & MDLF_EMITREPLACE)
if (emodel->engineflags & MDLF_EMITREPLACE)
continue;
}
}

View file

@ -3810,7 +3810,9 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
{
p->permu[perm] = permu = Shader_LoadPermutation(p, perm);
if (!permu)
return;
{ //failed? copy from 0 so we don't keep re-failing
permu = p->permu[perm] = p->permu[0];
}
}
GL_SelectProgram(permu->h.glsl.handle);

View file

@ -1718,6 +1718,7 @@ void Shader_UnloadProg(program_t *prog)
Z_Free(prog->name);
Z_Free(prog->preshade);
Z_Free(prog->shadertext);
Z_Free(prog->cvardata);
Z_Free(prog);
}
@ -1789,6 +1790,8 @@ static void Shader_LoadGeneric(sgeneric_t *g, int qrtype)
g->prog.preshade = NULL;
Z_Free(g->prog.shadertext);
g->prog.shadertext = NULL;
Z_Free(g->prog.cvardata);
g->prog.cvardata = NULL;
if (file)
{

View file

@ -2652,17 +2652,23 @@ static void GLSlang_DeleteProg(program_t *prog)
{
unsigned int permu;
struct programpermu_s *pp;
for (permu = 0; permu < countof(prog->permu); permu++)
for (permu = countof(prog->permu); permu-- > 0; )
{
pp = prog->permu[permu];
if (pp)
{
prog->permu[permu] = NULL;
if (pp == prog->permu[0] && permu)
continue; //entry 0 (only) can get copied to avoid constant recompile failures (0 is always precompiled)
qglDeleteProgramObject_(pp->h.glsl.handle);
pp->h.glsl.handle = 0;
BZ_Free(pp->parm);
pp->parm = NULL;
pp->numparms = 0;
Z_Free(pp);
}
}
}

View file

@ -481,6 +481,7 @@ typedef struct {
struct programpermu_s
{
#if defined(GLQUAKE) || defined(D3DQUAKE)
union programhandle_u
{
#ifdef GLQUAKE
@ -509,6 +510,7 @@ struct programpermu_s
} hlsl;
#endif
} h;
#endif
unsigned int permutation;
unsigned int attrmask;
unsigned int texmask; //'standard' textures that are in use

View file

@ -2982,7 +2982,7 @@ void SV_PrecacheList_f(void)
for (i = 0; i < MAX_PRECACHE_MODELS; i++)
{
if (sv.strings.model_precache[i])
Con_Printf("model %u: %s\n", i, sv.strings.model_precache[i]);
Con_Printf("model %u: ^[%s\\modelviewer\\%s^]\n", i, sv.strings.model_precache[i], sv.strings.model_precache[i]);
}
}
if (!*group || !strncmp(group, "sound", 5))

View file

@ -999,7 +999,7 @@ qboolean SW_SCR_UpdateScreen(void)
if (cls.state == ca_active)
{
if (!CSQC_DrawView())
V_RenderView ();
V_RenderView (false);
R2D_BrightenScreen();
}

View file

@ -28,7 +28,7 @@
#endif
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#include <../vulkan/vulkan.h>
#if defined(_MSC_VER) && !defined(UINT64_MAX)
#define UINT64_MAX _UI64_MAX