From b76d139a582d6017b6617075a43ba2619eca474a Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 9 Aug 2021 23:06:23 +0000 Subject: [PATCH] Show relight times, cos why not. Fix hdr pre-relight levels. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6014 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_model.c | 2 +- engine/gl/ltface.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 4eacc556c..f783cd882 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -1950,7 +1950,7 @@ void Mod_LoadLighting (model_t *loadmodel, bspx_header_t *bspx, qbyte *mod_base, if (lumdata) { for (i = 0; i < samples; i++) - ergb[i] = 15<<27 | lumdata[i]<<18 | lumdata[i]<<9 << lumdata[i]<<0; + ergb[i] = (17u<<27) | (lumdata[i]<<18) | (lumdata[i]<<9) | (lumdata[i]<<0); lumdata = NULL; } } diff --git a/engine/gl/ltface.c b/engine/gl/ltface.c index 2f93cfe77..13b230dd7 100644 --- a/engine/gl/ltface.c +++ b/engine/gl/ltface.c @@ -23,6 +23,7 @@ struct relight_ctx_s qboolean parsed; //ents have been parsed okay. qboolean loaded; //needed models are all loaded. + double starttime; float minlight; qboolean skiplit; //lux only qboolean shadows; @@ -139,6 +140,7 @@ struct relight_ctx_s *LightStartup(struct relight_ctx_s *ctx, model_t *model, qb } if (ctx->nummodels < countof(ctx->models)) ctx->models[ctx->nummodels++] = model; + ctx->starttime = Sys_DoubleTime(); return ctx; } void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles) @@ -1132,17 +1134,16 @@ void RelightTerminate(model_t *mod) qboolean RelightSetup (model_t *model, size_t lightsamples, qboolean generatelit) { + qboolean ret = false; Sys_LockMutex(com_resourcemutex); //models can be loaded on different threads, so no race conditions please. if (!lightcontext) { lightcontext = LightStartup(NULL, model, true, !generatelit); lightcontext->lightmapsamples = lightsamples; - Sys_UnlockMutex(com_resourcemutex); - return true; + ret = true; } Sys_UnlockMutex(com_resourcemutex); - - return false; + return ret; } const char *RelightGetProgress(float *progress) @@ -1231,9 +1232,9 @@ void RelightThink (void) #endif if (lightcontext->nextface >= lightmodel->numsurfaces) { - Con_Printf("Finished lighting %s\n", lightmodel->name); - + double starttime = lightcontext->starttime; RelightTerminate(lightmodel); + Con_Printf("Finished lighting %s, took %.1f seconds\n", lightmodel->name, Sys_DoubleTime()-starttime); } } }