var varianceInit3 = varianceInit ;
varianceInit3 . baseInit . shadowmapFormat = ShadowVariance . GetFormat ( true , false , true ) ;
m_Shadowmaps = new ShadowmapBase [ ] { new ShadowVariance ( ref varianceInit ) , new ShadowVariance ( ref varianceInit2 ) , new ShadowVariance ( ref varianceInit3 ) , new ShadowAtlas ( ref atlasInit ) } ;
m_Shadowmaps = new ShadowmapBase [ ] { new ShadowVariance ( ref varianceInit ) , new ShadowVariance ( ref varianceInit2 ) , new ShadowVariance ( ref varianceInit3 ) , new ShadowAtlas ( ref atlasInit ) } ;
ShadowContext . SyncDel syncer = ( ShadowContext sc ) = >
{
RenderTargetIdentifier [ ] tex ;
sc . GetTex2DArrays ( out tex , out offset , out count ) ;
// bind buffers
cb . SetGlobalBuffer ( HDShaderIDs . _ShadowDatasExp , s_ShadowDataBuffer ) ;
cb . SetGlobalBuffer ( HDShaderIDs . _ShadowPayloads , s_ShadowPayloadBuffer ) ;
// bind textures
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_VSM_0 , tex [ 0 ] ) ;
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_VSM_1 , tex [ 1 ] ) ;
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_VSM_2 , tex [ 2 ] ) ;
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_PCF , tex [ 3 ] ) ;
// bind buffers
cb . SetGlobalBuffer ( HDShaderIDs . _ShadowDatasExp , s_ShadowDataBuffer ) ;
cb . SetGlobalBuffer ( HDShaderIDs . _ShadowPayloads , s_ShadowPayloadBuffer ) ;
// bind textures
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_VSM_0 , tex [ 0 ] ) ;
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_VSM_1 , tex [ 1 ] ) ;
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_VSM_2 , tex [ 2 ] ) ;
cb . SetGlobalTexture ( HDShaderIDs . _ShadowmapExp_PCF , tex [ 3 ] ) ;
// TODO: Currently samplers are hard coded in ShadowContext.hlsl, so we can't really set them here
} ;
s_GlobalLightListAtomic = new ComputeBuffer ( 1 , sizeof ( uint ) ) ;
}
s_GenListPerBigTileKernel = buildPerBigTileLightListShader . FindKernel ( "BigTileLightListGen" ) ;
s_GenListPerBigTileKernel = buildPerBigTileLightListShader . FindKernel ( "BigTileLightListGen" ) ;
s_BuildDispatchIndirectKernel = buildDispatchIndirectShader . FindKernel ( "BuildDispatchIndirect" ) ;
s_ClearDispatchIndirectKernel = clearDispatchIndirectShader . FindKernel ( "ClearDispatchIndirect" ) ;
{
for ( int shadowMask = 0 ; shadowMask < 2 ; + + shadowMask )
{
for ( int debugDisplay = 0 ; debugDisplay < 2 ; + + debugDisplay )
{
for ( int debugDisplay = 0 ; debugDisplay < 2 ; + + debugDisplay )
{
}
}
CoreUtils . Destroy ( m_DebugViewTilesMaterial ) ;
}
s_GenListPerTileKernel = buildPerTileLightListShader . FindKernel ( m_FrameSettings . lightLoopSettings . enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags" : "TileLightListGen_FeatureFlags" ) ;
}
else
{
{
s_GenListPerTileKernel = buildPerTileLightListShader . FindKernel ( m_FrameSettings . lightLoopSettings . enableBigTilePrepass ? "TileLightListGen_SrcBigTile" : "TileLightListGen" ) ;
}
public bool PrepareLightsForGPU ( CommandBuffer cmd , ShadowSettings shadowSettings , CullResults cullResults , Camera camera )
{
using ( new ProfilingSample ( cmd , "Prepare Lights For GPU" ) )
{
{
// If any light require it, we need to enabled bake shadow mask feature
m_enableBakeShadowMask = false ;
s_LightVolumeDataBuffer . SetData ( m_lightList . lightVolumes ) ;
}
void PushGlobalParams ( Camera camera , CommandBuffer cmd )
void PushGlobalParams ( Camera camera , CommandBuffer cmd )
{
using ( new ProfilingSample ( cmd , "Push Global Parameters" , HDRenderPipeline . GetSampler ( CustomSamplerId . TPPushGlobalParameters ) ) )
{
cmd . SetGlobalBuffer ( HDShaderIDs . g_vBigTileLightList , s_BigTileLightList ) ;
// Cluster
{
{
cmd . SetGlobalFloat ( HDShaderIDs . g_fClustScale , m_ClustScale ) ;
cmd . SetGlobalFloat ( HDShaderIDs . g_fClustBase , k_ClustLogBase ) ;
cmd . SetGlobalFloat ( HDShaderIDs . g_fNearPlane , camera . nearClipPlane ) ;
cmd . SetGlobalBuffer ( HDShaderIDs . g_vLayeredOffsetsBuffer , s_PerVoxelOffset ) ;
if ( k_UseDepthBuffer )
{
if ( k_UseDepthBuffer )
{
}
}
}
}
}
}