}
}
int GetNumTileFtplX ( Camera c amera)
int GetNumTileFtplX ( HDCamera hdC amera)
return ( camera . pixe lWidth + ( LightDefinitions . s_TileSizeFptl - 1 ) ) / LightDefinitions . s_TileSizeFptl ;
return ( hdCamera . actua lWidth + ( LightDefinitions . s_TileSizeFptl - 1 ) ) / LightDefinitions . s_TileSizeFptl ;
int GetNumTileFtplY ( Camera c amera)
int GetNumTileFtplY ( HDCamera hdC amera)
return ( camera . pixe lHeight + ( LightDefinitions . s_TileSizeFptl - 1 ) ) / LightDefinitions . s_TileSizeFptl ;
return ( hdCamera . actua lHeight + ( LightDefinitions . s_TileSizeFptl - 1 ) ) / LightDefinitions . s_TileSizeFptl ;
int GetNumTileClusteredX ( Camera c amera)
int GetNumTileClusteredX ( HDCamera hdC amera)
return ( camera . pixe lWidth + ( LightDefinitions . s_TileSizeClustered - 1 ) ) / LightDefinitions . s_TileSizeClustered ;
return ( hdCamera . actua lWidth + ( LightDefinitions . s_TileSizeClustered - 1 ) ) / LightDefinitions . s_TileSizeClustered ;
int GetNumTileClusteredY ( Camera c amera)
int GetNumTileClusteredY ( HDCamera hdC amera)
return ( camera . pixe lHeight + ( LightDefinitions . s_TileSizeClustered - 1 ) ) / LightDefinitions . s_TileSizeClustered ;
return ( hdCamera . actua lHeight + ( LightDefinitions . s_TileSizeClustered - 1 ) ) / LightDefinitions . s_TileSizeClustered ;
}
public bool GetFeatureVariantsEnabled ( )
return ( uint ) logVolume < < 2 0 | ( uint ) lightVolumeType < < 1 7 | listType < < 1 6 | ( ( uint ) probeIndex & 0 xFFFF ) ;
}
void VoxelLightListGeneration ( CommandBuffer cmd , Camera camera , Matrix4x4 projscr , Matrix4x4 invProjscr , RenderTargetIdentifier cameraDepthBufferRT )
void VoxelLightListGeneration ( CommandBuffer cmd , HDCamera hdCamera , Matrix4x4 projscr , Matrix4x4 invProjscr , RenderTargetIdentifier cameraDepthBufferRT )
Camera camera = hdCamera . camera ;
// clear atomic offset index
cmd . SetComputeBufferParam ( buildPerVoxelLightListShader , s_ClearVoxelAtomicKernel , HDShaderIDs . g_LayeredSingleIdxBuffer , s_GlobalLightListAtomic ) ;
cmd . DispatchCompute ( buildPerVoxelLightListShader , s_ClearVoxelAtomicKernel , 1 , 1 , 1 ) ;
cmd . SetComputeMatrixParam ( buildPerVoxelLightListShader , HDShaderIDs . g_mInvScrProjection , invProjscr ) ;
cmd . SetComputeIntParam ( buildPerVoxelLightListShader , HDShaderIDs . g_iLog2NumClusters , k_Log2NumClusters ) ;
cmd . SetComputeVectorParam ( buildPerVoxelLightListShader , HDShaderIDs . g_screenSize , hdCamera . screenSize ) ;
cmd . SetComputeIntParam ( buildPerVoxelLightListShader , HDShaderIDs . g_iNumSamplesMSAA , ( int ) hdCamera . msaaSamples ) ;
//Vector4 v2_near = invProjscr * new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
//Vector4 v2_far = invProjscr * new Vector4(0.0f, 0.0f, 1.0f, 1.0f);
cmd . SetComputeBufferParam ( buildPerVoxelLightListShader , s_GenListPerVoxelKernel , HDShaderIDs . _LightVolumeData , s_LightVolumeDataBuffer ) ;
cmd . SetComputeBufferParam ( buildPerVoxelLightListShader , s_GenListPerVoxelKernel , HDShaderIDs . g_data , s_ConvexBoundsBuffer ) ;
var numTilesX = GetNumTileClusteredX ( c amera) ;
var numTilesY = GetNumTileClusteredY ( c amera) ;
var numTilesX = GetNumTileClusteredX ( hdC amera) ;
var numTilesY = GetNumTileClusteredY ( hdC amera) ;
cmd . DispatchCompute ( buildPerVoxelLightListShader , s_GenListPerVoxelKernel , numTilesX , numTilesY , 1 ) ;
}
cmd . DispatchCompute ( buildPerBigTileLightListShader , s_GenListPerBigTileKernel , numBigTilesX , numBigTilesY , 1 ) ;
}
var numTilesX = GetNumTileFtplX ( c amera) ;
var numTilesY = GetNumTileFtplY ( c amera) ;
var numTilesX = GetNumTileFtplX ( hdC amera) ;
var numTilesY = GetNumTileFtplY ( hdC amera) ;
var numTiles = numTilesX * numTilesY ;
bool enableFeatureVariants = GetFeatureVariantsEnabled ( ) ;
}
// Cluster
VoxelLightListGeneration ( cmd , c amera, projscr , invProjscr , cameraDepthBufferRT ) ;
VoxelLightListGeneration ( cmd , hdC amera, projscr , invProjscr , cameraDepthBufferRT ) ;
if ( enableFeatureVariants )
{
cmd . SetRenderTarget ( BuiltinRenderTextureType . None ) ;
BuildGPULightListsCommon ( hdCamera , cmd , cameraDepthBufferRT , stencilTextureRT , skyEnabled ) ;
PushGlobalParams ( hdCamera . camera , cmd ) ;
PushGlobalParams ( hdCamera , cmd ) ;
}
public GPUFence BuildGPULightListsAsyncBegin ( HDCamera hdCamera , ScriptableRenderContext renderContext , RenderTargetIdentifier cameraDepthBufferRT , RenderTargetIdentifier stencilTextureRT , GPUFence startFence , bool skyEnabled )
return completeFence ;
}
public void BuildGPULightListAsyncEnd ( Camera c amera, CommandBuffer cmd , GPUFence doneFence )
public void BuildGPULightListAsyncEnd ( HDCamera hdC amera, CommandBuffer cmd , GPUFence doneFence )
PushGlobalParams ( c amera, cmd ) ;
PushGlobalParams ( hdC amera, cmd ) ;
}
private void UpdateDataBuffers ( )
return add ;
}
void PushGlobalParams ( Camera camera , CommandBuffer cmd )
void PushGlobalParams ( HDCamera hdCamera , CommandBuffer cmd )
Camera camera = hdCamera . camera ;
// Shadows
m_ShadowMgr . SyncData ( ) ;
m_ShadowMgr . BindResources ( cmd , null , 0 ) ;
cmd . SetGlobalInt ( HDShaderIDs . _EnvLightCount , m_lightList . envLights . Count ) ;
cmd . SetGlobalBuffer ( HDShaderIDs . _ShadowDatas , s_shadowDatas ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileFtplX , GetNumTileFtplX ( c amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileFtplY , GetNumTileFtplY ( c amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileFtplX , GetNumTileFtplX ( hdC amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileFtplY , GetNumTileFtplY ( hdC amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileClusteredX , GetNumTileClusteredX ( c amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileClusteredY , GetNumTileClusteredY ( c amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileClusteredX , GetNumTileClusteredX ( hdC amera) ) ;
cmd . SetGlobalInt ( HDShaderIDs . _NumTileClusteredY , GetNumTileClusteredY ( hdC amera) ) ;
if ( m_FrameSettings . lightLoopSettings . enableBigTilePrepass )
cmd . SetGlobalBuffer ( HDShaderIDs . g_vBigTileLightList , s_BigTileLightList ) ;
cmd . SetGlobalFloat ( HDShaderIDs . g_fNearPlane , camera . nearClipPlane ) ;
cmd . SetGlobalFloat ( HDShaderIDs . g_fFarPlane , camera . farClipPlane ) ;
cmd . SetGlobalInt ( HDShaderIDs . g_iLog2NumClusters , k_Log2NumClusters ) ;
cmd . SetGlobalInt ( HDShaderIDs . g_isLogBaseBufferEnabled , k_UseDepthBuffer ? 1 : 0 ) ;
cmd . SetGlobalBuffer ( HDShaderIDs . g_vLayeredOffsetsBuffer , s_PerVoxelOffset ) ;