- fixed: instead of checking gl_lights, better check Level->HasDynamicLights.

Especially in the thinker code this is needed for software rendering.
Strictly speaking, the software renderer should do the same, but it checks r_dynlight in so many places deep in the logic where the level is not available.
This commit is contained in:
Christoph Oelckers 2021-08-11 14:09:00 +02:00
parent 26d00e14c7
commit 1097bd6c73
4 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,8 @@ bool IShadowMap::PerformUpdate()
LightsProcessed = 0;
LightsShadowmapped = 0;
if (gl_lights && gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER) && CollectLights != nullptr)
// CollectLights will be null if the calling code decides that shadowmaps are not needed.
if (CollectLights != nullptr)
{
UpdateCycles.Clock();
UploadAABBTree();

View File

@ -279,7 +279,6 @@ extern DFrameBuffer *screen;
#define SCREENPITCH (screen->GetPitch ())
EXTERN_CVAR (Float, vid_gamma)
EXTERN_CVAR(Bool, gl_lights)
// Allocates buffer screens, call before R_Init.

View File

@ -125,7 +125,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
}
} while (count != 0);
if (gl_lights)
if (Level->HasDynamicLights)
{
for (auto light = Level->lights; light;)
{
@ -154,7 +154,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
}
} while (count != 0);
if (Level->lights && gl_lights)
if (Level->lights && Level->HasDynamicLights)
{
// Also profile the internal dynamic lights, even though they are not implemented as thinkers.
auto &prof = Profiles[NAME_InternalDynamicLight];

View File

@ -108,7 +108,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
R_SetupFrame(mainvp, r_viewwindow, camera);
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && gl_lights && gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && camera->Level->HasDynamicLights && gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
{
screen->SetAABBTree(camera->Level->aabbTree);
screen->mShadowMap.SetCollectLights([=] {