Nameless Engine
Loading...
Searching...
No Matches
ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader Struct Reference

#include <LightingShaderResourceManager.h>

Public Member Functions

std::optional< Errorinitialize (Renderer *pRenderer, const FrustumGridComputeShader::ComputeShader &frustumGridShader)
 
std::variant< bool, ErrorcreateLightIndexListsAndLightGrid (Renderer *pRenderer, size_t iTileCountX, size_t iTileCountY)
 
std::optional< ErrorqueueExecutionForNextFrame (Renderer *pRenderer, FrameResource *pCurrentFrameResource, size_t iCurrentFrameResourceIndex, GpuResource *pGeneralLightingData, GpuResource *pPointLightArray, GpuResource *pSpotlightArray, GpuResource *pNonCulledPointLightsIndicesArray, GpuResource *pNonCulledSpotlightsIndicesArray) const
 

Public Attributes

std::unique_ptr< ComputeShaderInterfacepComputeInterface
 
ShaderResources resources
 
ThreadGroupCount threadGroupCount
 
bool bIsInitialized = false
 

Static Public Attributes

static const auto sDepthTextureShaderResourceName = "depthTexture"
 
static const auto sThreadGroupCountShaderResourceName = "threadGroupCount"
 
static const auto sGlobalCountersIntoLightIndexListShaderResourceName
 

Detailed Description

Groups compute interface and its resources.

Member Function Documentation

◆ createLightIndexListsAndLightGrid()

std::variant< bool, Error > ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::createLightIndexListsAndLightGrid ( Renderer pRenderer,
size_t  iTileCountX,
size_t  iTileCountY 
)

(Re)creates light index lists and light grid if tile count was changed and binds them to the shader.

Remarks
Does nothing if the tile count is the same as in the previous call to this function.
Parameters
pRendererRenderer.
iTileCountXThe current number of light grid tiles in the X direction.
iTileCountYThe current number of light grid tiles in the Y direction.
Returns
true if resources were re-created, false if not, otherwise error if something went wrong.

◆ initialize()

std::optional< Error > ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::initialize ( Renderer pRenderer,
const FrustumGridComputeShader::ComputeShader frustumGridShader 
)

Creates compute interface and resources and binds them to the interface.

Parameters
pRendererRenderer.
frustumGridShaderCompute shader that calculates grid of frustums for light culling. Its resources will be used in light culling.
Returns
Error if something went wrong.

◆ queueExecutionForNextFrame()

std::optional< Error > ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::queueExecutionForNextFrame ( Renderer pRenderer,
FrameResource pCurrentFrameResource,
size_t  iCurrentFrameResourceIndex,
GpuResource pGeneralLightingData,
GpuResource pPointLightArray,
GpuResource pSpotlightArray,
GpuResource pNonCulledPointLightsIndicesArray,
GpuResource pNonCulledSpotlightsIndicesArray 
) const

Called to queue compute shader to be executed on the next frame.

Warning
Expected to be called somewhere inside of the drawNextFrame function so that renderer's depth texture without multisampling pointer will not change.
Parameters
pRendererRenderer.
pCurrentFrameResourceCurrent frame resource that will be used to submit the next frame.
iCurrentFrameResourceIndexIndex of the frame resource that will be used to submit the next frame.
pGeneralLightingDataGPU resource that stores general lighting information.
pPointLightArrayArray that stores all spawned point lights.
pSpotlightArrayArray that stores all spawned spotlights.
pNonCulledPointLightsIndicesArrayArray that stores indices of point lights in camera's frustum.
pNonCulledSpotlightsIndicesArrayArray that stores indices of spotlights in camera's frustum.
Returns
Error if something went wrong.

Member Data Documentation

◆ bIsInitialized

bool ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::bIsInitialized = false

true if initialize was called, false otherwise.

◆ pComputeInterface

std::unique_ptr<ComputeShaderInterface> ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::pComputeInterface

Compute interface.

◆ resources

ShaderResources ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::resources

Shader resources that this compute shader "owns".

◆ sDepthTextureShaderResourceName

const auto ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::sDepthTextureShaderResourceName = "depthTexture"
inlinestatic

Name of the shader resource (name from shader code) that stores depth texture recorded on depth prepass.

◆ sGlobalCountersIntoLightIndexListShaderResourceName

const auto ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::sGlobalCountersIntoLightIndexListShaderResourceName
inlinestatic
Initial value:
=
"globalCountersIntoLightIndexList"

Name of the shader resource (name from shader code) that stores global counters into various light index lists.

◆ sThreadGroupCountShaderResourceName

const auto ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::sThreadGroupCountShaderResourceName = "threadGroupCount"
inlinestatic

Name of the shader resource (name from shader code) that stores additional information that might not be available as built-in semantics.

◆ threadGroupCount

ThreadGroupCount ne::LightingShaderResourceManager::ComputeShaderData::LightCullingComputeShader::ComputeShader::threadGroupCount

Stores the number of thread groups that we need to dispatch.


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