You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If rectangle lights are before line lights, the compiler will duplicate light matrices in VGPR because they are used differently between the two types of lights.
657
-
// By keeping line lights first we avoid this behavior and save substantial register pressure.
658
-
// TODO: This is based on the current Lit.shader and can be different for any other way of implementing area lights, how to be generic and ensure performance ?
655
+
bool fastPath = false;
656
+
#if SCALARIZE_LIGHT_LOOP
657
+
uint lightStartLane0;
658
+
fastPath = IsFastPath(lightStart, lightStartLane0); // True if all pixels belong to the same tile (or cluster)
659
659
660
-
if (lightCount > 0)
660
+
if (fastPath)
661
661
{
662
-
i = 0;
663
-
664
-
uint last = lightCount - 1;
665
-
LightData lightData = FetchLight(lightStart, i);
662
+
lightStart = lightStartLane0;
663
+
}
664
+
#endif
666
665
667
-
while (i <= last && lightData.lightType == GPULIGHTTYPE_TUBE)
// Scalarized loop. All lights that are in a tile/cluster touched by any pixel in the wave are loaded (scalar load), only the one relevant to current thread/pixel are processed.
667
+
// For clarity, the following code will follow the convention: variables starting with s_ are meant to be wave uniform (meant for scalar register),
668
+
// v_ are variables that might have different value for each thread in the wave (meant for vector registers).
669
+
// This will perform more loads than it is supposed to, however, the benefits should offset the downside, especially given that light data accessed should be largely coherent.
670
+
// Note that the above is valid only if wave intriniscs are supported.
671
+
uint v_lightListOffset = 0;
672
+
uint v_lightIdx = lightStart;
671
673
672
-
if (IsMatchingLightLayer(lightData.lightLayers, builtinData.renderingLayers))
0 commit comments