Fix vulkan lag issue with vk_busywait. Separate lightmap formats, to fix deluxemapping-with-hdr-lightmaps. Fix decals lingering on removed bmodels.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5326 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-10-27 04:32:18 +00:00
parent a3f9fe886e
commit 45b4659de6
25 changed files with 398 additions and 436 deletions

View File

@ -31,7 +31,7 @@ OGGVER=1.3.3
VORBISVER=1.3.6
SDL2VER=2.0.7
SCINTILLAVER=373
OPUSVER=1.2.1
OPUSVER=1.3
SPEEXVER=1.2.0
SPEEXDSPVER=1.2rc3
FREETYPEVER=2.9

View File

@ -63,7 +63,6 @@ static struct predicted_player
} predicted_players[MAX_CLIENTS];
static void CL_LerpNetFrameState(framestate_t *fs, lerpents_t *le);
qboolean CL_PredictPlayer(lerpents_t *le, entity_state_t *state, int sequence);
void CL_PlayerFrameUpdated(player_state_t *plstate, entity_state_t *state, int sequence);
void CL_AckedInputFrame(int inseq, int outseq, qboolean worldstateokay);

View File

@ -5670,17 +5670,13 @@ double Host_Frame (double time)
if (cl.paused)
cl.gametimemark += time;
idle = (cls.state == ca_disconnected) ||
//if we're at a menu/console/thing
idle = Key_Dest_Has_Higher(kdm_gmenu);
#ifdef VM_UI
UI_MenuState() != 0 ||
idle |= UI_MenuState() != 0;
#endif
Key_Dest_Has(kdm_gmenu) ||
Key_Dest_Has(kdm_emenu) ||
Key_Dest_Has(kdm_editor) ||
!vid.activeapp ||
cl.paused
;
// TODO: check if minimized or unfocused
idle = ((cls.state == ca_disconnected) || cl.paused) && !idle; //idle if we're disconnected/paused and not at a menu
idle |= !vid.activeapp; //always idle when tabbed out
//read packets early and always, so we don't have stuff waiting for reception quite so often.
//should smooth out a few things, and increase download speeds.

View File

@ -1166,7 +1166,6 @@ void CL_PredictMovePNum (int seat)
}
if (i == pe->num_entities && pv->nolocalplayer)
{
return;
fromstate = &nullstate;
nopred = true;
}

View File

@ -692,7 +692,7 @@ static void MenuDraw(menu_t *menu)
}
menutext_t *MC_AddWhiteText(menu_t *menu, int lhs, int rhs, int y, const char *text, qboolean rightalign)
menutext_t *MC_AddWhiteText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign)
{
menutext_t *n = Z_Malloc(sizeof(menutext_t) + (text?strlen(text):0)+1);
n->common.type = mt_text;
@ -712,7 +712,7 @@ menutext_t *MC_AddWhiteText(menu_t *menu, int lhs, int rhs, int y, const char *t
return n;
}
menutext_t *MC_AddBufferedText(menu_t *menu, int lhs, int rhs, int y, const char *text, qboolean rightalign, qboolean red)
menutext_t *MC_AddBufferedText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign, qboolean red)
{
menutext_t *n = Z_Malloc(sizeof(menutext_t) + strlen(text)+1);
n->common.type = mt_text;
@ -732,7 +732,7 @@ menutext_t *MC_AddBufferedText(menu_t *menu, int lhs, int rhs, int y, const char
return n;
}
menutext_t *MC_AddRedText(menu_t *menu, int lhs, int rhs, int y, const char *text, qboolean rightalign)
menutext_t *MC_AddRedText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign)
{
menutext_t *n;
n = MC_AddWhiteText(menu, lhs, rhs, y, text, rightalign);
@ -1329,7 +1329,7 @@ menubutton_t *MC_AddCommand(menu_t *menu, int lhs, int rhs, int y, char *text, q
return n;
}
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int lhs, int rhs, int y, qboolean rightalign, const char *text, char *command, ...)
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int lhs, int rhs, int y, int rightalign, const char *text, char *command, ...)
{
va_list argptr;
static char string[1024];

View File

@ -1136,9 +1136,9 @@ void M_Menu_Quit_f (void)
quitmenu = M_CreateMenuInfront(0);
quitmenu->key = MC_SaveQuit_Key;
MC_AddWhiteText(quitmenu, 64, 0, 84, "You have unsaved settings ", false);
MC_AddWhiteText(quitmenu, 64, 0, 92, " Would you like to ", false);
MC_AddWhiteText(quitmenu, 64, 0, 100, " save them now? ", false);
MC_AddWhiteText(quitmenu, 64, 256, 84, "You have unsaved settings ", 2);
MC_AddWhiteText(quitmenu, 64, 256, 92, " Would you like to ", 2);
MC_AddWhiteText(quitmenu, 64, 256, 100, " save them now? ", 2);
quitmenu->selecteditem = (menuoption_t *)
#ifdef FTE_TARGET_WEB
@ -1162,19 +1162,19 @@ void M_Menu_Quit_f (void)
#ifdef FTE_TARGET_WEB
// MC_AddWhiteText(quitmenu, 64, 0, 84, " ", false);
MC_AddWhiteText(quitmenu, 64, 0, 92, " There is nothing to save ", false);
// MC_AddWhiteText(quitmenu, 64, 0, 100, " ", false);
// MC_AddWhiteText(quitmenu, 64, 256, 84, " ", 2);
MC_AddWhiteText(quitmenu, 64, 256, 92, " There is nothing to save ", 2);
// MC_AddWhiteText(quitmenu, 64, 256, 100, " ", 2);
quitmenu->selecteditem = (menuoption_t *)
MC_AddConsoleCommand (quitmenu, 120, 0, 116, "Oh", "menupop\n");
#else
{
int i = rand()&7;
MC_AddWhiteText(quitmenu, 64, 0, 84, quitMessage[i*4+0], false);
MC_AddWhiteText(quitmenu, 64, 0, 92, quitMessage[i*4+1], false);
MC_AddWhiteText(quitmenu, 64, 0, 100, quitMessage[i*4+2], false);
MC_AddWhiteText(quitmenu, 64, 0, 108, quitMessage[i*4+3], false);
MC_AddWhiteText(quitmenu, 64, 256, 84, quitMessage[i*4+0], 2);
MC_AddWhiteText(quitmenu, 64, 256, 92, quitMessage[i*4+1], 2);
MC_AddWhiteText(quitmenu, 64, 256, 100, quitMessage[i*4+2], 2);
MC_AddWhiteText(quitmenu, 64, 256, 108, quitMessage[i*4+3], 2);
}
quitmenu->selecteditem = (menuoption_t *)

View File

@ -201,7 +201,7 @@ typedef struct menucheck_s {
typedef struct {
menucommon_t common;
const char *text;
qboolean rightalign;
int rightalign;
qboolean isred;
} menutext_t;
@ -302,9 +302,9 @@ typedef struct menu_s {
menuoption_t *cursoritem;
} menu_t;
menutext_t *MC_AddBufferedText(menu_t *menu, int lhs, int rhs, int y, const char *text, qboolean rightalign, qboolean red);
menutext_t *MC_AddRedText(menu_t *menu, int lhs, int rhs, int y, const char *text, qboolean rightalign);
menutext_t *MC_AddWhiteText(menu_t *menu, int lhs, int rhs, int y, const char *text, qboolean rightalign);
menutext_t *MC_AddBufferedText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign, qboolean red);
menutext_t *MC_AddRedText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign);
menutext_t *MC_AddWhiteText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign);
menubind_t *MC_AddBind(menu_t *menu, int cx, int bx, int y, const char *caption, char *command, char *tooltip);
menubox_t *MC_AddBox(menu_t *menu, int x, int y, int width, int height);
menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, int width, int height, char *picname);
@ -319,7 +319,7 @@ menubutton_t *MC_AddConsoleCommand(menu_t *menu, int lhs, int rhs, int y, const
menubutton_t *MC_AddConsoleCommandQBigFont(menu_t *menu, int x, int y, const char *text, const char *command);
mpic_t *QBigFontWorks(void);
menubutton_t *MC_AddConsoleCommandHexen2BigFont(menu_t *menu, int x, int y, const char *text, const char *command);
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int lhs, int rhs, int y, qboolean rightalign, const char *text, char *command, ...);
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int lhs, int rhs, int y, int rightalign, const char *text, char *command, ...);
menubutton_t *MC_AddCommand(menu_t *menu, int lhs, int rhs, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));
menucombo_t *MC_AddCombo(menu_t *menu, int tx, int cx, int y, const char *caption, const char **ops, int initialvalue);
menucombo_t *MC_AddCvarCombo(menu_t *menu, int tx, int cx, int y, const char *caption, cvar_t *cvar, const char **ops, const char **values);

View File

@ -6489,6 +6489,8 @@ static void R_AddClippedDecal(scenetris_t *t, clippeddecal_t *d, plooks_t *type)
if (d->entity > 0)
{
lerpents_t *le = cl.lerpents+d->entity;
if (le->sequence != cl.lerpentssequence)
return; //hide until its visible again.
if (le->angles[0] || le->angles[1] || le->angles[2])
{ //FIXME: deal with rotated entities.
d->die = -1;

File diff suppressed because it is too large Load Diff

View File

@ -358,22 +358,19 @@ typedef unsigned char stmap;
struct mesh_s;
typedef struct {
texid_t lightmap_texture;
qboolean modified;
qboolean external;
qboolean hasdeluxe;
uploadfmt_t fmt;
qboolean modified; //data was changed. consult rectchange to see the bounds.
qboolean external; //the data was loaded from a file (q3bsp feature where we shouldn't be blending lightmaps at all)
qboolean hasdeluxe; //says that the next lightmap index contains deluxemap info
uploadfmt_t fmt; //texture format that we're using
qbyte pixbytes; //yes, this means no compressed formats.
int width;
int height;
glRect_t rectchange;
qbyte *lightmaps;//[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
stmap *stainmaps;//[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed.
qbyte *lightmaps; //[pixbytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
stmap *stainmaps; //[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed.
} lightmapinfo_t;
extern lightmapinfo_t **lightmap;
extern int numlightmaps;
//extern texid_t *lightmap_textures;
//extern texid_t *deluxmap_textures;
extern int lightmap_bytes; // 1, 3, or 4
extern uploadfmt_t lightmap_fmt; //bgra32, rgba32, rgb24, lum8
void QDECL Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue);

View File

@ -465,9 +465,21 @@ static void Con_Editor_LineChanged_Shader(conline_t *line)
flocation_t loc;
unsigned int flags;
image_t img;
memset(&img, 0, sizeof(img));
img.ident = mapname;
COM_DeFunString(n, end, mapname, sizeof(mapname), true, true);
while(*img.ident == '$')
{
if (!Q_strncasecmp(img.ident, "$lightmap", 9))
return; //lightmaps don't need to load from disk
if (!Q_strncasecmp(img.ident, "$rt:", 4))
return; //render targets never come from disk
if (!Q_strncasecmp(img.ident, "$clamp:", 7) || !Q_strncasecmp(img.ident, "$3d:", 4) || !Q_strncasecmp(img.ident, "$cube:", 6) || !Q_strncasecmp(img.ident, "$nearest:", 9) || !Q_strncasecmp(img.ident, "$linear:", 8))
img.ident = strchr(img.ident, ':')+1;
else
break;
}
if (!Image_LocateHighResTexture(&img, &loc, fname, sizeof(fname), &flags))
line->flags |= CONL_BREAKPOINT;
return;

View File

@ -1499,8 +1499,9 @@ qboolean R_CalcModelLighting(entity_t *e, model_t *clmodel)
}
}
switch(lightmap_fmt)
switch(PTI_E5BGR9)//lightmap_fmt)
{
//don't clamp model lighting if we're not clamping world lighting either.
case PTI_E5BGR9:
case PTI_RGBA16F:
case PTI_RGBA32F:

View File

@ -5445,20 +5445,20 @@ static void BE_UpdateLightmaps(void)
GL_MTBind(0, GL_TEXTURE_2D, lm->lightmap_texture);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qglTexImage2D(GL_TEXTURE_2D, 0, gl_config.formatinfo[lightmap_fmt].internalformat, lm->width, lm->height, 0, gl_config.formatinfo[lightmap_fmt].format, gl_config.formatinfo[lightmap_fmt].type, lm->lightmaps);
qglTexImage2D(GL_TEXTURE_2D, 0, gl_config.formatinfo[lm->fmt].internalformat, lm->width, lm->height, 0, gl_config.formatinfo[lm->fmt].format, gl_config.formatinfo[lm->fmt].type, lm->lightmaps);
if (gl_config.glversion >= (gl_config.gles?3.0:3.3))
{
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_config.formatinfo[lightmap_fmt].swizzle_r);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, gl_config.formatinfo[lightmap_fmt].swizzle_g);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, gl_config.formatinfo[lightmap_fmt].swizzle_b);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, gl_config.formatinfo[lightmap_fmt].swizzle_a);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_config.formatinfo[lm->fmt].swizzle_r);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, gl_config.formatinfo[lm->fmt].swizzle_g);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, gl_config.formatinfo[lm->fmt].swizzle_b);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, gl_config.formatinfo[lm->fmt].swizzle_a);
}
}
else
{
GL_MTBind(0, GL_TEXTURE_2D, lm->lightmap_texture);
qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, t, lm->width, b-t, gl_config.formatinfo[lightmap_fmt].format, gl_config.formatinfo[lightmap_fmt].type, lm->lightmaps+t*lm->width*lightmap_bytes);
qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, t, lm->width, b-t, gl_config.formatinfo[lm->fmt].format, gl_config.formatinfo[lm->fmt].type, lm->lightmaps+t*lm->width*lm->pixbytes);
}
lm->modified = false;
lm->rectchange.l = lm->width;

View File

@ -72,8 +72,6 @@ void validatelinks2(link_t *firstnode, link_t *panic)
return;*/
}
//FIXME
int Surf_NewLightmaps(int count, int width, int height, qboolean deluxe);
#ifndef SERVERONLY
static void ted_dorelight(heightmap_t *hm);
@ -164,7 +162,7 @@ static qboolean QDECL Terr_InitLightmap(hmsection_t *s, qboolean initialise)
int lm;
int i;
Sys_UnlockMutex(com_resourcemutex);
lm = Surf_NewLightmaps(1, SECTTEXSIZE*LMCHUNKS, SECTTEXSIZE*LMCHUNKS, false);
lm = Surf_NewLightmaps(1, SECTTEXSIZE*LMCHUNKS, SECTTEXSIZE*LMCHUNKS, PTI_BGRA8, false);
Sys_LockMutex(com_resourcemutex);
for (i = 0; i < LMCHUNKS*LMCHUNKS; i++)
{
@ -196,9 +194,9 @@ static qboolean QDECL Terr_InitLightmap(hmsection_t *s, qboolean initialise)
if (initialise && s->lightmap >= 0)
{
int x, y;
unsigned char *lm;
lm = lightmap[s->lightmap]->lightmaps;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes;
unsigned char *lm = lightmap[s->lightmap]->lightmaps;
unsigned int pixbytes = lightmap[s->lightmap]->pixbytes;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * pixbytes;
for (y = 0; y < SECTTEXSIZE; y++)
{
for (x = 0; x < SECTTEXSIZE; x++)
@ -208,7 +206,7 @@ static qboolean QDECL Terr_InitLightmap(hmsection_t *s, qboolean initialise)
lm[x*4+2] = 0;
lm[x*4+3] = 255;
}
lm += (HMLMSTRIDE)*lightmap_bytes;
lm += (HMLMSTRIDE)*pixbytes;
}
}
@ -803,6 +801,7 @@ static void Terr_SaveV2(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
unsigned int flags = s->flags;
int i, j, x, y;
struct hmwater_s *w;
unsigned int pixbytes;
flags &= ~(TSF_INTERNAL);
flags &= ~(TSF_HASCOLOURS|TSF_HASHEIGHTS|TSF_HASSHADOW);
@ -824,8 +823,9 @@ static void Terr_SaveV2(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
}
}
pixbytes = lightmap[s->lightmap]->pixbytes;
lm = lightmap[s->lightmap]->lightmaps;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * pixbytes;
for (y = 0; y < SECTTEXSIZE; y++)
{
for (x = 0; x < SECTTEXSIZE; x++)
@ -837,7 +837,7 @@ static void Terr_SaveV2(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
break;
}
}
lm += (HMLMSTRIDE)*lightmap_bytes;
lm += (HMLMSTRIDE)*pixbytes;
}
//write the flags so the loader knows what to load
@ -927,8 +927,9 @@ static void Terr_SaveV2(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
//write the channel
last = 0;
pixbytes = lightmap[s->lightmap]->pixbytes;
lm = lightmap[s->lightmap]->lightmaps;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * pixbytes;
for (y = 0; y < SECTTEXSIZE; y++)
{
for (x = 0; x < SECTTEXSIZE; x++)
@ -937,7 +938,7 @@ static void Terr_SaveV2(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
last = lm[x*4+j];
Terr_Write_Byte(&strm, delta);
}
lm += (HMLMSTRIDE)*lightmap_bytes;
lm += (HMLMSTRIDE)*pixbytes;
}
}
@ -994,15 +995,16 @@ static void Terr_WorkerLoadedSectionLightmap(void *ctx, void *data, size_t a, si
int y;
if (s)
if (lightmap_bytes == 4 && Terr_InitLightmap(s, false))
if (Terr_InitLightmap(s, false))
{
int pixbytes = lightmap[s->lightmap]->pixbytes;
outlm = lightmap[s->lightmap]->lightmaps;
outlm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes;
outlm += (s->lmy * HMLMSTRIDE + s->lmx) * pixbytes;
for (y = 0; y < SECTTEXSIZE; y++)
{
memcpy(outlm, inlm, SECTTEXSIZE*4);
inlm += SECTTEXSIZE*4;
outlm += (HMLMSTRIDE)*lightmap_bytes;
outlm += (HMLMSTRIDE)*pixbytes;
}
}
@ -1220,10 +1222,9 @@ static void Terr_GenerateDefault(heightmap_t *hm, hmsection_t *s)
if (s->lightmap >= 0)
{
int j;
qbyte *lm;
lm = lightmap[s->lightmap]->lightmaps;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes;
qbyte *lm = lightmap[s->lightmap]->lightmaps;
int pixbytes = lightmap[s->lightmap]->pixbytes;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * pixbytes;
for (i = 0; i < SECTTEXSIZE; i++)
{
for (j = 0; j < SECTTEXSIZE; j++)
@ -1233,7 +1234,7 @@ static void Terr_GenerateDefault(heightmap_t *hm, hmsection_t *s)
lm[j*4+0] = 0;
lm[j*4+3] = 255;
}
lm += (HMLMSTRIDE)*lightmap_bytes;
lm += (HMLMSTRIDE)*pixbytes;
}
lightmap[s->lightmap]->modified = true;
lightmap[s->lightmap]->rectchange.l = 0;
@ -1557,6 +1558,7 @@ static void Terr_SaveV1(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
vec4_t dcolours[SECTHEIGHTSIZE*SECTHEIGHTSIZE];
int nothing = 0;
struct hmwater_s *w = s->water;
int pixbytes;
memset(&ds, 0, sizeof(ds));
memset(&dm, 0, sizeof(dm));
@ -1595,12 +1597,13 @@ static void Terr_SaveV1(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
}
s->flags |= TSF_DIRTY;
pixbytes = lightmap[s->lightmap]->pixbytes;
lm = lightmap[s->lightmap]->lightmaps;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes;
lm += (s->lmy * HMLMSTRIDE + s->lmx) * pixbytes;
for (i = 0; i < SECTTEXSIZE; i++)
{
memcpy(ds.texmap + i, lm, sizeof(ds.texmap[0]));
lm += (HMLMSTRIDE)*lightmap_bytes;
lm += (HMLMSTRIDE)*pixbytes;
}
for (i = 0; i < SECTHEIGHTSIZE*SECTHEIGHTSIZE; i++)
@ -4349,7 +4352,6 @@ int Heightmap_ClusterForPoint (model_t *model, vec3_t point)
#ifndef SERVERONLY
static unsigned char *QDECL Terr_GetLightmap(hmsection_t *s, int idx, qboolean edit)
{
unsigned char *lm;
int x = idx % SECTTEXSIZE, y = idx / SECTTEXSIZE;
if (s->lightmap < 0)
{
@ -4369,9 +4371,7 @@ static unsigned char *QDECL Terr_GetLightmap(hmsection_t *s, int idx, qboolean e
lightmap[s->lightmap]->rectchange.r = HMLMSTRIDE;
lightmap[s->lightmap]->rectchange.b = HMLMSTRIDE;
}
lm = lightmap[s->lightmap]->lightmaps;
lm += ((s->lmy+y) * HMLMSTRIDE + (s->lmx+x)) * lightmap_bytes;
return lm;
return lightmap[s->lightmap]->lightmaps + ((s->lmy+y) * HMLMSTRIDE + (s->lmx+x)) * lightmap[s->lightmap]->pixbytes;
}
static void ted_dorelight(heightmap_t *hm)
{
@ -5588,7 +5588,7 @@ void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e)
{
int first;
hm->brushlmremaps = BZ_Realloc(hm->brushlmremaps, sizeof(*hm->brushlmremaps) * lmcount);
first = Surf_NewLightmaps(lmcount - hm->brushmaxlms, hm->brushlmalloc.width, hm->brushlmalloc.height, hm->brushlmalloc.deluxe);
first = Surf_NewLightmaps(lmcount - hm->brushmaxlms, hm->brushlmalloc.width, hm->brushlmalloc.height, PTI_BGRA8, hm->brushlmalloc.deluxe);
while(hm->brushmaxlms < lmcount)
hm->brushlmremaps[hm->brushmaxlms++] = first++;
@ -5642,11 +5642,11 @@ void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e)
lm->rectchange.b = lm->height;
in = br->faces[j].lightdata;
out = lm->lightmaps + (br->faces[j].lmbase[1] * lm->width + br->faces[j].lmbase[0]) * lightmap_bytes;
switch(lightmap_fmt)
out = lm->lightmaps + (br->faces[j].lmbase[1] * lm->width + br->faces[j].lmbase[0]) * lm->pixbytes;
switch(lm->fmt)
{
default:
Sys_Error("Bad lightmap_fmt\n");
Sys_Error("Bad terrain lightmap format %i\n", lm->fmt);
break;
case PTI_BGRA8:
case PTI_BGRX8:
@ -5741,8 +5741,33 @@ void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e)
out += (lm->width - br->faces[j].lmextents[0]);
}
break;
case PTI_RGBA16F:
case PTI_RGBA32F:
for (t = 0; t < br->faces[j].lmextents[1]; t++)
{
for (s = 0; s < br->faces[j].lmextents[0]; s++)
{
((float*)out)[0] = in[0]/255.0;
((float*)out)[1] = in[1]/255.0;
((float*)out)[2] = in[2]/255.0;
((float*)out)[3] = 1.0;
out+=16;
in+=3;
}
out += (lm->width - br->faces[j].lmextents[0]) * 16;
}
break;
/*case PTI_RGBA16F:
for (t = 0; t < br->faces[j].lmextents[1]; t++)
{
for (s = 0; s < br->faces[j].lmextents[0]; s++)
{
Surf_PackRGB16F(in[0], in[1], in[2], 255);
out+=8;
in+=3;
}
out += (lm->width - br->faces[j].lmextents[0]) * 8;
}
break;*/
case PTI_RGB565:
case PTI_RGBA4444:
case PTI_RGBA5551:

View File

@ -567,14 +567,14 @@ void GLBE_UploadAllLightmaps(void)
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
qglTexImage2D(GL_TEXTURE_2D, 0, gl_config.formatinfo[lightmap_fmt].internalformat, lm->width, lm->height, 0, gl_config.formatinfo[lightmap_fmt].format, gl_config.formatinfo[lightmap_fmt].type, lightmap[i]->lightmaps);
qglTexImage2D(GL_TEXTURE_2D, 0, gl_config.formatinfo[lm->fmt].internalformat, lm->width, lm->height, 0, gl_config.formatinfo[lm->fmt].format, gl_config.formatinfo[lm->fmt].type, lightmap[i]->lightmaps);
if (gl_config.glversion >= (gl_config.gles?3.0:3.3))
{
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_config.formatinfo[lightmap_fmt].swizzle_r);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, gl_config.formatinfo[lightmap_fmt].swizzle_g);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, gl_config.formatinfo[lightmap_fmt].swizzle_b);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, gl_config.formatinfo[lightmap_fmt].swizzle_a);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_config.formatinfo[lm->fmt].swizzle_r);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, gl_config.formatinfo[lm->fmt].swizzle_g);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, gl_config.formatinfo[lm->fmt].swizzle_b);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, gl_config.formatinfo[lm->fmt].swizzle_a);
}
//for completeness.

View File

@ -30,7 +30,7 @@ cluster:
internal concept to avoid a single pointer array of 16 million entries per terrain.
*/
int Surf_NewLightmaps(int count, int width, int height, qboolean deluxe);
int Surf_NewLightmaps(int count, int width, int height, uploadfmt_t fmt, qboolean deluxe);
#define MAXCLUSTERS 64
#define MAXSECTIONS 64 //this many sections within each cluster in each direction

View File

@ -5490,6 +5490,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#ifdef BUMPMODELSPACE\n"
"deluxe = normalize(deluxe*invsurface);\n"
"#else\n"
"deluxe = normalize(deluxe);\n"
"lightmaps *= 2.0 / max(0.25, deluxe.z); //counter the darkening from deluxemaps\n"
"#endif\n"
"lightmaps *= dot(norm, deluxe);\n"

View File

@ -9772,7 +9772,10 @@ static void QCBUILTIN PF_runclientphys(pubprogfuncs_t *prinst, struct globalvars
movevars.maxspeed *= ent->xv->hasted;
#endif
if (client)
{
movevars.coordsize = client->netchan.netprim.coordsize;
client->lastruncmd = sv.time*1000;
}
else
movevars.coordsize = svs.netprim.coordsize;
@ -10869,8 +10872,8 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"getlocalinfo", PF_getlocalinfo,0, 0, 0, 0, D("int(string keyname, optional void *outptr, int size)", "Obtains a copy of the full data blob. Will write up to size bytes and return the actual size. Does not null terminate (but memalloc(ret+1) will, if you want to cast the buffer to a string), and the blob may contain embedded nulls. Ignores all special keys, returning only what is actually there.")},
{"setlocalinfo", PF_setlocalinfo,0, 0, 0, 0, D("void(string keyname, optional void *outptr, int size)", "Changes the server's localinfo. This data will be available for the following map, and will *usually* reload with saved games.")},
{"isdemo", PF_Fixme, 0, 0, 0, 349, D("float()", "Returns if the client is currently playing a demo or not")},// (EXT_CSQC)
{"isserver", PF_Fixme, 0, 0, 0, 350, D("float()", "Returns if the client is acting as the server (aka: listen server)")},//(EXT_CSQC)
{"isdemo", PF_Fixme, 0, 0, 0, 349, D("float()", "Returns if the client is currently playing a demo or not. Returns 2 when playing an mvd (where other player's stats can be queried, or the pov can be changed freely).")},// (EXT_CSQC)
{"isserver", PF_Fixme, 0, 0, 0, 350, D("float()", "Returns non-zero whenever the local console can directly affect the server (ie: listen servers or single-player). Compat note: DP returns 0 for single-player.")},//(EXT_CSQC)
{"SetListener", PF_Fixme, 0, 0, 0, 351, D("void(vector origin, vector forward, vector right, vector up, optional float reverbtype)", "Sets the position of the view, as far as the audio subsystem is concerned. This should be called once per CSQC_UpdateView as it will otherwise revert to default. For reverbtype, see setup_reverb or treat as 'underwater'.")},// (EXT_CSQC)
{"setup_reverb", PF_Fixme, 0, 0, 0, 0, D("typedef struct {\n\tfloat flDensity;\n\tfloat flDiffusion;\n\tfloat flGain;\n\tfloat flGainHF;\n\tfloat flGainLF;\n\tfloat flDecayTime;\n\tfloat flDecayHFRatio;\n\tfloat flDecayLFRatio;\n\tfloat flReflectionsGain;\n\tfloat flReflectionsDelay;\n\tvector flReflectionsPan;\n\tfloat flLateReverbGain;\n\tfloat flLateReverbDelay;\n\tvector flLateReverbPan;\n\tfloat flEchoTime;\n\tfloat flEchoDepth;\n\tfloat flModulationTime;\n\tfloat flModulationDepth;\n\tfloat flAirAbsorptionGainHF;\n\tfloat flHFReference;\n\tfloat flLFReference;\n\tfloat flRoomRolloffFactor;\n\tint iDecayHFLimit;\n} reverbinfo_t;\nvoid(float reverbslot, reverbinfo_t *reverbinfo, int sizeofreverinfo_t)", "Reconfigures a reverb slot for weird effects. Slot 0 is reserved for no effects. Slot 1 is reserved for underwater effects. Reserved slots will be reinitialised on snd_restart, but can otherwise be changed. These reverb slots can be activated with SetListener. Note that reverb will currently only work when using OpenAL.")},
{"registercommand", PF_Fixme, 0, 0, 0, 352, D("void(string cmdname)", "Register the given console command, for easy console use.\nConsole commands that are later used will invoke CSQC_ConsoleCommand.")},//(EXT_CSQC)

View File

@ -682,7 +682,7 @@ void SV_Map_f (void)
else
#endif
{
char *exts[] = {"maps/%s", "maps/%s.bsp", "maps/%s.cm", "maps/%s.hmp", /*"maps/%s.map",*/ NULL};
char *exts[] = {"maps/%s", "maps/%s.bsp", "maps/%s.cm", "maps/%s.hmp", /*"maps/%s.map",*/ /*"maps/%s.ent",*/ NULL};
int i, j;
for (i = 0; exts[i]; i++)

View File

@ -3536,6 +3536,7 @@ void SV_SendClientMessages (void)
cmd.buttons = c->lastcmd.buttons;
SV_RunCmd (&cmd, true);
SV_PostRunCmd();
c->lastruncmd = sv.time*1000;
if (stepmsec > c->msecs)
c->msecs = 0;
else

View File

@ -2139,10 +2139,9 @@ void SV_Begin_Core(client_t *split)
SV_RunCmd(&cmd, false);
}
SV_PostRunCmd();
split->lastruncmd = sv.time*1000;
host_client = oh;
sv_player = oh?oh->edict:NULL;
host_client->lastruncmd = sv.time*1000;
}
}
}
@ -5658,6 +5657,7 @@ static void SVNQ_Begin_f (void)
host_client->lastcmd.msec = 0;
SV_RunCmd (&host_client->lastcmd, false);
SV_PostRunCmd();
host_client->lastruncmd = sv.time*1000;
}
static void SVNQ_PreSpawn_f (void)
{
@ -6810,7 +6810,6 @@ size_t playertouchmax;
void SV_PreRunCmd(void)
{
size_t max = MAX_EDICTS;//(sv.world.num_edicts+7)&~7;
host_client->lastruncmd = sv.time*1000;
if (max > playertouchmax)
{
playertouchmax = max;
@ -7868,6 +7867,7 @@ void SV_ExecuteClientMessage (client_t *cl)
if (!SV_PlayerPhysicsQC || host_client->spectator)
SV_PostRunCmd();
host_client->lastruncmd = sv.time*1000;
}
}
@ -8320,6 +8320,7 @@ void SVNQ_ReadClientMove (usercmd_t *move, qboolean forceangle16)
SV_RunCmd (move, false);
SV_PostRunCmd();
move->impulse = 0;
host_client->lastruncmd = sv.time*1000;
}
else
{

View File

@ -295,6 +295,7 @@ void main ()
#ifdef BUMPMODELSPACE
deluxe = normalize(deluxe*invsurface);
#else
deluxe = normalize(deluxe);
lightmaps *= 2.0 / max(0.25, deluxe.z); //counter the darkening from deluxemaps
#endif
lightmaps *= dot(norm, deluxe);

View File

@ -4137,7 +4137,7 @@ void VK_UploadLightmap(lightmapinfo_t *lm)
mips.mip[0].width = lm->width;
mips.mip[0].height = lm->height;
mips.mip[0].depth = 1;
switch(lightmap_fmt)
switch(lm->fmt)
{
default:
case PTI_A2BGR10:
@ -4145,7 +4145,7 @@ void VK_UploadLightmap(lightmapinfo_t *lm)
case PTI_RGBA16F:
case PTI_RGBA32F:
case PTI_L8:
mips.encoding = lightmap_fmt;
mips.encoding = lm->fmt;
break;
case PTI_BGRA8:
mips.encoding = PTI_BGRX8;
@ -5957,7 +5957,9 @@ qboolean VKBE_BeginShadowmap(qboolean isspot, uint32_t width, uint32_t height)
VkMemoryAllocateInfo memAllocInfo = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
vkGetImageMemoryRequirements(vk.device, shad->image, &mem_reqs);
memAllocInfo.allocationSize = mem_reqs.size;
memAllocInfo.memoryTypeIndex = vk_find_memory_require(mem_reqs.memoryTypeBits, 0);
memAllocInfo.memoryTypeIndex = vk_find_memory_try(mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (memAllocInfo.memoryTypeIndex == ~0)
memAllocInfo.memoryTypeIndex = vk_find_memory_require(mem_reqs.memoryTypeBits, 0);
VkAssert(vkAllocateMemory(vk.device, &memAllocInfo, vkallocationcb, &shad->memory));
VkAssert(vkBindImageMemory(vk.device, shad->image, shad->memory, 0));
}

View File

@ -2969,8 +2969,23 @@ qboolean VK_SCR_GrabBackBuffer(void)
//wait for the queued acquire to actually finish
if (vk_busywait.ival)
{ //busy wait, to try to get the highest fps possible
while (VK_TIMEOUT == vkGetFenceStatus(vk.device, vk.acquirefences[vk.aquirenext%ACQUIRELIMIT]))
;
for (;;)
{
switch(vkGetFenceStatus(vk.device, vk.acquirefences[vk.aquirenext%ACQUIRELIMIT]))
{
case VK_SUCCESS:
break; //hurrah
case VK_NOT_READY:
continue; //keep going until its actually signaled. submission thread is probably just slow.
case VK_TIMEOUT:
continue; //erk? this isn't a documented result here.
case VK_ERROR_DEVICE_LOST:
Sys_Error("Vulkan device lost");
default:
return false;
}
break;
}
}
else
{
@ -3616,17 +3631,24 @@ void VK_Submit_Work(VkCommandBuffer cmdbuf, VkSemaphore semwait, VkPipelineStage
work->fencedwork = fencedwork;
Sys_LockConditional(vk.submitcondition);
#ifdef MULTITHREAD
if (vk.neednewswapchain && vk.submitthread)
{ //if we're trying to kill the submission thread, don't post work to it - instead wait for it to die cleanly then do it ourselves.
Sys_ConditionSignal(vk.submitcondition);
Sys_UnlockConditional(vk.submitcondition);
Sys_WaitOnThread(vk.submitthread);
vk.submitthread = NULL;
Sys_LockConditional(vk.submitcondition); //annoying, but required for it to be reliable with respect to other things.
}
#endif
//add it on the end in a lazy way.
for (link = &vk.work; *link; link = &(*link)->next)
;
*link = work;
#ifdef MULTITHREAD
if (vk.neednewswapchain && vk.submitthread)
{ //if we're trying to kill the submission thread, don't post work to it - instead wait for it to die cleanly then do it ourselves.
Sys_WaitOnThread(vk.submitthread);
vk.submitthread = NULL;
}
if (vk.submitthread)
Sys_ConditionSignal(vk.submitcondition);
else

View File

@ -289,7 +289,7 @@ extern struct vulkaninfo_s
VkCommandPool cmdpool;
VkPhysicalDeviceLimits limits;
#define ACQUIRELIMIT 8
#define ACQUIRELIMIT 8 //don't run more than this many frames behind
VkSemaphore acquiresemaphores[ACQUIRELIMIT];
VkFence acquirefences[ACQUIRELIMIT];
uint32_t acquirebufferidx[ACQUIRELIMIT];