Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::LightCullPass Class Reference

Forward+ tile-based light culling compute pass. More...

#include <LightCullPass.h>

Public Member Functions

FRAMEWORK_API void Init (u32 width, u32 height, Ref< StorageBuffer > lightSSBO, Ref< Image2D > depthImage)
 Allocates the tile light list SSBO and initialises the compute pass.
FRAMEWORK_API void Shutdown ()
 Releases all GPU resources owned by this pass.
FRAMEWORK_API void Execute (const Crux::mat4 &view, const Crux::mat4 &projection, u32 width, u32 height)
 Uploads cull settings and dispatches the compute shader.
Ref< StorageBufferGetTileLightList () const
 Returns the per-tile light index list SSBO written by Execute.
bool ShouldRecreateResources () const
 Returns true if the tile count changed this frame and dependent passes must be rebuilt.
u32 GetTileCountX () const
 Returns the number of tiles along the X axis for the current resolution.
u32 GetTileCountY () const
 Returns the number of tiles along the Y axis for the current resolution.

Detailed Description

Forward+ tile-based light culling compute pass.

Divides the screen into FORWARD_PLUS_TILE_SIZE × FORWARD_PLUS_TILE_SIZE pixel tiles and, for each tile, determines which of the scene's point lights overlap its depth range. The resulting per-tile light index lists are written to GetTileLightList and consumed by GeometryPass.

Must execute after Prepass and before GeometryPass.

Member Function Documentation

◆ Execute()

void Raven::LightCullPass::Execute ( const Crux::mat4 & view,
const Crux::mat4 & projection,
u32 width,
u32 height )

Uploads cull settings and dispatches the compute shader.

Must be called after Prepass::Execute and before GeometryPass::Execute. If the screen resolution has changed, signals ShouldRecreateResources so that SceneRenderer can rebuild dependent passes.

Parameters
viewCamera view matrix for this frame.
projectionCamera projection matrix for this frame.
widthCurrent render target width in pixels.
heightCurrent render target height in pixels.

◆ GetTileCountX()

u32 Raven::LightCullPass::GetTileCountX ( ) const
inline

Returns the number of tiles along the X axis for the current resolution.

◆ GetTileCountY()

u32 Raven::LightCullPass::GetTileCountY ( ) const
inline

Returns the number of tiles along the Y axis for the current resolution.

◆ GetTileLightList()

Ref< StorageBuffer > Raven::LightCullPass::GetTileLightList ( ) const
inline

Returns the per-tile light index list SSBO written by Execute.

Returns
SSBO consumed by GeometryPass to look up per-tile lights.

◆ Init()

void Raven::LightCullPass::Init ( u32 width,
u32 height,
Ref< StorageBuffer > lightSSBO,
Ref< Image2D > depthImage )

Allocates the tile light list SSBO and initialises the compute pass.

Parameters
widthRender target width in pixels.
heightRender target height in pixels.
lightSSBOLightEnvironment SSBO built by the scene each frame.
depthImageDepth prepass output image (DEPTH32F, ShaderRead layout).

◆ ShouldRecreateResources()

bool Raven::LightCullPass::ShouldRecreateResources ( ) const
inline

Returns true if the tile count changed this frame and dependent passes must be rebuilt.

◆ Shutdown()

void Raven::LightCullPass::Shutdown ( )

Releases all GPU resources owned by this pass.


The documentation for this class was generated from the following files: