Hi, I have a follow-up question regarding the following post: [Stale GPU Scene Lighting Update [Content removed]
Our team is frequently encountering the same “Data for Id = %d in GPU Scene Lights is stale” ensure when modifying the attenuation radius of point lights from level sequences.
We’ve been getting around this issue by adding/moving around transform and other property keys on the same lights, but it’s costing us a non-negligible amount of time and doesn’t appear to be an actual indicator of lighting issues; visually, the scene seems to play out as expected.
Rather than continue tip-toeing around the ensure, we’d like to remove it, but is it truly safe to ignore?
・\Engine\Source\Runtime\Renderer\Private\GPUScene.cpp
#if DO_CHECK
for (int32 Index = 0; Index < NumGPULights; ++Index)
{
FLightSceneData LightData;
if (Scene.Lights.IsAllocated(Index))
{
const FLightSceneInfoCompact& LightInfoCompact = Scene.Lights[Index];
InitLightData(LightInfoCompact, bAllowStaticLighting, Flags, LightData);
#if 0 // remove check
ensureMsgf(FMemory::Memcmp(&LightData, &LightDataArray[Index], sizeof(LightData)) == 0, TEXT("Data for Id = %d in GPU Scene Lights is stale."), Index);
#endi
}
We’re still not 100% sure what the cause or purpose of the ensure is, so we’d appreciate any insight you might be able to offer.
The point light in the level is modified by a level sequence playing in a loop.
We were able to trigger the ensure just once after leaving the level playing for up to day. The ensure didn’t reoccur after playing the level for another 2 to 3 days, so the probably of occurrence is extremely low.
It may also depend on how heavy other applications running on the machine are.
Hello! Given that you hit the ensure so infrequently and, on top of that, the game still continues to play when you skip it, I think it will be safe for you to remove it in this particular case. Let me know if you have any further questions.
From the Perforce history, it looks like we added the ensure to UE5-Main in CL 37874612 as part of an optimization effort to update only the Light Data in the GPUScene that was marked as actually needing an update. The ensure is hit if the data queued for upload is not identical to the light component proxy, meaning we missed recording an upload command from the game thread for a light that actually needs it.
In your case, that happens when you adjust the attenuation radius of a point light, but it’s not entirely clear which point light data field isn’t being updated properly. You could experiment with turning off the ensure, or investigate which data field is missing and patch it. If you want to find out which data field is not being updated, you can add extra logging at the call site of the ensure to figure out exactly which field is not being picked up properly. From there, you can then try to add a spot fix based on the extra details in the log. I pasted the code snippet below:
On a different note, we started deprecating some of the code that handles sending updates from the game thread to the renderer in 5.9, but I don’t know if you plan to upgrade to that version. There is also a likely fix for your issue in CL 54700219, but it depends on a few other fixes that are not in 5.6. Let me know if any of that helps or if you need any further clarification.
Ok, that is likely the most sound approach. If you need any further help tracking down the assert, please let me know. Otherwise, I will go ahead and close out this case.
We don’t have any plans to upgrade to 5.9 at the moment, so I think we will try investigating as you suggested what data field is not being properly updated before we decide how to proceed.