From b5095a47902a60f97fd6f984d5bd81bd59827008 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 30 Sep 2023 21:46:27 +0200 Subject: [PATCH] Group LightList variables --- src/common/rendering/hwrenderer/data/hw_levelmesh.h | 12 ++++++++---- .../rendering/vulkan/accelstructs/vk_lightmap.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/common/rendering/hwrenderer/data/hw_levelmesh.h b/src/common/rendering/hwrenderer/data/hw_levelmesh.h index 66b922e5a..c4fdd66e5 100644 --- a/src/common/rendering/hwrenderer/data/hw_levelmesh.h +++ b/src/common/rendering/hwrenderer/data/hw_levelmesh.h @@ -79,11 +79,15 @@ struct LevelMeshSurface // // Utility/Info // - inline uint32_t Area() const { return AtlasTile.Width * AtlasTile.Height; } + uint32_t Area() const { return AtlasTile.Width * AtlasTile.Height; } - int LightListPos = -1; - int LightListCount = 0; - int LightListResetCounter = -1; + // Light list location in the lightmapper GPU buffers + struct + { + int Pos = -1; + int Count = 0; + int ResetCounter = -1; + } LightList; }; inline float IsInFrontOfPlane(const FVector4& plane, const FVector3& point) diff --git a/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp b/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp index bc50bcec0..e93b61391 100644 --- a/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp +++ b/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp @@ -183,7 +183,7 @@ void VkLightmap::Render() // Paint all surfaces visible in the tile for (LevelMeshSurface* surface : targetSurface->tileSurfaces) { - if (surface->LightListResetCounter != lights.ResetCounter) + if (surface->LightList.ResetCounter != lights.ResetCounter) { int lightCount = mesh->AddSurfaceLights(surface, templightlist.Data(), (int)templightlist.Size()); @@ -194,9 +194,9 @@ void VkLightmap::Render() break; } - surface->LightListPos = lights.Pos; - surface->LightListCount = lightCount; - surface->LightListResetCounter = lights.ResetCounter; + surface->LightList.Pos = lights.Pos; + surface->LightList.Count = lightCount; + surface->LightList.ResetCounter = lights.ResetCounter; LightInfo* lightinfo = &lights.Lights[lights.Pos]; for (int i = 0; i < lightCount; i++) @@ -216,8 +216,8 @@ void VkLightmap::Render() lights.Pos += lightCount; } - pc.LightStart = surface->LightListPos; - pc.LightEnd = pc.LightStart + surface->LightListCount; + pc.LightStart = surface->LightList.Pos; + pc.LightEnd = pc.LightStart + surface->LightList.Count; #ifdef USE_DRAWINDIRECT VkDrawIndexedIndirectCommand cmd;