9#include <unordered_set>
13#include "misc/Error.h"
14#include "render/general/resource/UploadBuffer.h"
15#include "render/general/resource/frame/FrameResourceManager.h"
16#include "shader/general/resource/ShaderLightsInFrustumSingleType.hpp"
21 class ShaderLightArray;
135 std::unordered_set<ShaderLightArraySlot*>,
164 static std::unique_ptr<ShaderLightArray>
create(
168 const std::optional<std::pair<std::function<
void(
size_t)>, std::string>>&
169 optionalOnLightsInCameraFrustumCulled);
193 Node* pSpawnedOwnerLightNode,
194 size_t iDataSizeInBytes,
195 const std::function<
void*()>& startUpdateCallback,
196 const std::function<
void()>& finishUpdateCallback);
237 const std::string& sIndicesLightsInFrustumShaderResourceName =
"");
258 [[nodiscard]] std::optional<Error>
recreateArray(
bool bIsInitialization =
false);
static constexpr unsigned int getFrameResourceCount()
Definition: FrameResourceManager.h:74
Definition: LightingShaderResourceManager.h:50
Definition: Pipeline.h:20
Definition: Renderer.h:43
Definition: ShaderLightArray.h:27
const std::function< void *()> startUpdateCallback
Definition: ShaderLightArray.h:86
void markAsNeedsUpdate()
Definition: ShaderLightArray.cpp:31
ShaderLightArray * pArray
Definition: ShaderLightArray.h:75
size_t iIndexIntoArray
Definition: ShaderLightArray.h:92
Node *const pSpawnedOwnerLightNode
Definition: ShaderLightArray.h:83
size_t getCurrentIndexIntoArray() const
Definition: ShaderLightArray.h:53
const std::function< void()> finishUpdateCallback
Definition: ShaderLightArray.h:89
Definition: ShaderLightArray.h:99
std::optional< Error > updateBindingsInAllPipelines()
Definition: ShaderLightArray.cpp:497
std::pair< std::recursive_mutex, Resources > mtxResources
Definition: ShaderLightArray.h:305
std::string getShaderResourceName() const
Definition: ShaderLightArray.cpp:214
std::pair< std::recursive_mutex, Resources > * getInternalResources()
Definition: ShaderLightArray.cpp:210
void freeSlot(ShaderLightArraySlot *pSlot)
Definition: ShaderLightArray.cpp:216
void markSlotAsNeedsUpdate(ShaderLightArraySlot *pSlot)
Definition: ShaderLightArray.cpp:279
void onLightsInCameraFrustumCulled(size_t iCurrentFrameResourceIndex)
Definition: ShaderLightArray.cpp:56
std::optional< Error > recreateArray(bool bIsInitialization=false)
Definition: ShaderLightArray.cpp:300
void updateSlotsMarkedAsNeedsUpdate(size_t iCurrentFrameResourceIndex)
Definition: ShaderLightArray.cpp:469
const std::optional< std::function< void(size_t)> > optionalCallbackOnLightsInCameraFrustumCulled
Definition: ShaderLightArray.h:318
std::optional< Error > updatePipelineBinding(Pipeline *pPipeline)
Definition: ShaderLightArray.cpp:543
Renderer * pRenderer
Definition: ShaderLightArray.h:308
std::variant< std::unique_ptr< ShaderLightArraySlot >, Error > reserveNewSlot(Node *pSpawnedOwnerLightNode, size_t iDataSizeInBytes, const std::function< void *()> &startUpdateCallback, const std::function< void()> &finishUpdateCallback)
Definition: ShaderLightArray.cpp:160
~ShaderLightArray()
Definition: ShaderLightArray.cpp:98
static std::unique_ptr< ShaderLightArray > create(Renderer *pRenderer, const std::string &sShaderLightResourceName, const std::function< void(size_t)> &onSizeChanged, const std::optional< std::pair< std::function< void(size_t)>, std::string > > &optionalOnLightsInCameraFrustumCulled)
Definition: ShaderLightArray.cpp:138
const std::function< void(size_t)> onSizeChanged
Definition: ShaderLightArray.h:324
size_t iElementSizeInBytes
Definition: ShaderLightArray.h:311
const std::string sShaderLightResourceName
Definition: ShaderLightArray.h:327
Definition: ShaderLightArray.h:112
std::unordered_set< ShaderLightArraySlot * > activeSlots
Definition: ShaderLightArray.h:140
ShaderLightsInFrustumSingleType lightsInFrustum
Definition: ShaderLightArray.h:131
std::array< std::unique_ptr< UploadBuffer >, FrameResourceManager::getFrameResourceCount()> vGpuArrayLightDataResources
Definition: ShaderLightArray.h:128
std::array< std::unordered_set< ShaderLightArraySlot * >, FrameResourceManager::getFrameResourceCount()> vSlotsToBeUpdated
Definition: ShaderLightArray.h:137
Definition: ShaderLightsInFrustumSingleType.hpp:18