You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Local = main array of lights in ForwardLightData (which currently translates to visibible in view frustum) - Grid = cell inside the light grid. #rb Krzysztof.Narkowicz [CL 29717147 by tiago costa in ue5-main branch]
31 lines
1.3 KiB
Plaintext
31 lines
1.3 KiB
Plaintext
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
VirtualShadowMapLightGrid.ush:
|
|
=============================================================================*/
|
|
#pragma once
|
|
|
|
#include "../Common.ush"
|
|
#include "../LightGridCommon.ush"
|
|
|
|
FCulledLightsGridData VirtualShadowMapGetLightsGrid(uint2 PixelPos, float SceneDepth)
|
|
{
|
|
// Has no effect unless INSTANCED_STEREO is enabled. Used in GetLightGridData to select ForwardLightData or ForwardLightDataISR, but then only uses redundant parameters anyway.
|
|
uint EyeIndex = 0U;
|
|
|
|
uint GridLinearIndex = ComputeLightGridCellIndex(PixelPos, SceneDepth, EyeIndex);
|
|
FCulledLightsGridData CulledLightGridData = GetCulledLightsGrid(GridLinearIndex, EyeIndex);
|
|
|
|
// Replace light count with our pruned count
|
|
CulledLightGridData.NumLights = VirtualShadowMap.NumCulledLightsGrid[GridLinearIndex];
|
|
return CulledLightGridData;
|
|
}
|
|
|
|
FLocalLightData VirtualShadowMapGetLocalLightData(FCulledLightsGridData GridData, uint Index)
|
|
{
|
|
const uint ListIndex = GridData.DataStartIndex + Index;
|
|
checkStructuredBufferAccessSlow(VirtualShadowMap.LightGridData, ListIndex);
|
|
const uint LightGridLightIndex = VirtualShadowMap.LightGridData[ListIndex];
|
|
return GetLocalLightDataNonStereo(LightGridLightIndex);
|
|
}
|