Files
UnrealEngineUWP/Engine/Shaders/Shared/VirtualShadowMapDefinitions.h
andrew lauritzen 090b64dcc2 Significant changes and refactoring to VSM physical page allocation to support more persistent allocations:
- Support keeping pages that are not requested in a given frame, disabled to start but will be enabled soon. r.Shadow.Virtual.Cache.KeepOnlyRequestedPages
- Support LRU allocation of new pages. Only particularly meaningful with persistent allocations. Also disabled to start. r.Shadow.Virtual.Cache.AllocateViaLRU
- Lots of cleanup and refactoring of page allocation passes and shaders.
- Move page marking shaders into their own file as they are relatively independent from the allocation/caching and have dependencies on other systems (hair, water, etc)
- Clean up various cases of cache enabled/available/etc.
- Some minor cleanup of invalidations in prep for future work

#rb ola.olsson
#jira UE-147454
#preflight 642cad58da7f9583709d3172

[CL 24932187 by andrew lauritzen in ue5-main branch]
2023-04-05 13:48:25 -04:00

64 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
/*================================================================================================
VirtualShadowMapDefinitions.h: used in virtual shadow map shaders and C++ code to define common constants
!!! Changing this file requires recompilation of the engine !!!
=================================================================================================*/
#pragma once
#define VIRTUAL_SHADOW_MAP_VISUALIZE_NONE 0
#define VIRTUAL_SHADOW_MAP_VISUALIZE_SHADOW_FACTOR (1 << 0)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_CLIPMAP_OR_MIP (1 << 1)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_VIRTUAL_PAGE (1 << 2)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_CACHED_PAGE (1 << 3)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_SMRT_RAY_COUNT (1 << 4)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_CLIPMAP_VIRTUAL_SPACE (1 << 5)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_GENERAL_DEBUG (1 << 6)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_DIRTY_PAGE (1 << 7)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_GPU_INVALIDATED_PAGE (1 << 8)
#define VIRTUAL_SHADOW_MAP_VISUALIZE_MERGED_PAGE (1 << 9)
#define VSM_PROJ_FLAG_CURRENT_DISTANT_LIGHT (1U << 0)
#define VSM_PROJ_FLAG_UNCACHED (1U << 1) // Used to indicate that the light is uncached and should only render to dynamic pages
// Hard limit for max distant lights supported 8k for now - we may revise later. We need to keep them in a fixed range for now to make allocation easy and minimize overhead for indexing.
#define VSM_MAX_SINGLE_PAGE_SHADOW_MAPS (1024U * 8U)
#ifdef __cplusplus
#include "HLSLTypeAliases.h"
namespace UE::HLSL
{
#endif
struct FVSMVisibleInstanceCmd
{
uint PackedPageInfo;
uint InstanceIdAndFlags;
uint IndirectArgIndex;
};
struct FVSMCullingBatchInfo
{
uint FirstPrimaryView;
uint NumPrimaryViews;
uint PrimitiveRevealedOffset;
uint PrimitiveRevealedNum;
};
struct FNextVirtualShadowMapData
{
int NextVirtualShadowMapId;
int2 PageAddressOffset;
int _Padding;
};
#ifdef __cplusplus
} // namespace UE::HLSL
using FVSMVisibleInstanceCmd = UE::HLSL::FVSMVisibleInstanceCmd;
using FVSMCullingBatchInfo = UE::HLSL::FVSMCullingBatchInfo;
using FNextVirtualShadowMapData = UE::HLSL::FNextVirtualShadowMapData;
#endif