4#include <unordered_map>
11#include "render/general/resource/frame/FrameResourceManager.h"
12#include "shader/general/resource/cpuwrite/DynamicCpuWriteShaderResourceArray.h"
13#include "render/general/pipeline/PipelineShaderConstantsManager.hpp"
14#include "shader/general/resource/binding/ShaderResourceBinding.h"
15#include "misc/Error.h"
42 size_t iCurrentFrameResourceIndex) {
51 Error error(std::format(
52 "shader resource \"{}\" was requested to set its push constant "
53 "index but this shader resource does not reference the specified pipeline",
63 offsetIt->second,
vResourceData[iCurrentFrameResourceIndex]->getIndexIntoArray());
89 [[nodiscard]]
virtual std::optional<Error>
110 static std::variant<std::unique_ptr<ShaderCpuWriteResourceBinding>,
Error>
create(
112 const std::string& sResourceAdditionalInfo,
113 size_t iResourceSizeInBytes,
114 const std::unordered_set<Pipeline*>& pipelinesToUse,
127 static std::variant<std::unordered_map<Pipeline*, size_t>,
Error>
129 const std::unordered_set<Pipeline*>& pipelines,
const std::string& sFieldName);
152 const std::unordered_map<Pipeline*, size_t>& uintShaderConstantOffsets);
173 std::unique_ptr<DynamicCpuWriteShaderResourceArraySlot>,
191 vResourceData[iCurrentFrameResourceIndex]->updateDataBecauseGpuUnused(pDataToCopy);
std::string getFullErrorMessage() const
Definition: Error.cpp:84
void showError() const
Definition: Error.cpp:102
static constexpr unsigned int getFrameResourceCount()
Definition: FrameResourceManager.h:74
Definition: PipelineShaderConstantsManager.hpp:14
void copyValueToShaderConstant(size_t iShaderConstantIndex, unsigned int iValueToCopy)
Definition: PipelineShaderConstantsManager.hpp:75
Definition: Pipeline.h:20
Definition: ShaderCpuWriteResourceBindingManager.h:21
Definition: ShaderCpuWriteResourceBinding.h:25
const std::function< void *()> onStartedUpdatingResource
Definition: ShaderCpuWriteResourceBinding.h:201
void updateResource(size_t iCurrentFrameResourceIndex)
Definition: ShaderCpuWriteResourceBinding.h:188
const std::function< void()> onFinishedUpdatingResource
Definition: ShaderCpuWriteResourceBinding.h:204
virtual std::optional< Error > onAfterAllPipelinesRefreshedResources() override
Definition: ShaderCpuWriteResourceBinding.cpp:138
virtual std::optional< Error > changeUsedPipelines(const std::unordered_set< Pipeline * > &pipelinesToUse) override
Definition: ShaderCpuWriteResourceBinding.cpp:83
static std::variant< std::unique_ptr< ShaderCpuWriteResourceBinding >, Error > create(const std::string &sShaderResourceName, const std::string &sResourceAdditionalInfo, size_t iResourceSizeInBytes, const std::unordered_set< Pipeline * > &pipelinesToUse, const std::function< void *()> &onStartedUpdatingResource, const std::function< void()> &onFinishedUpdatingResource)
Definition: ShaderCpuWriteResourceBinding.cpp:12
std::array< std::unique_ptr< DynamicCpuWriteShaderResourceArraySlot >, FrameResourceManager::getFrameResourceCount()> vResourceData
Definition: ShaderCpuWriteResourceBinding.h:175
const size_t iResourceDataSizeInBytes
Definition: ShaderCpuWriteResourceBinding.h:207
size_t getResourceDataSizeInBytes() const
Definition: ShaderCpuWriteResourceBinding.h:71
void copyResourceIndexToShaderConstants(PipelineShaderConstantsManager *pShaderConstantsManager, Pipeline *pUsedPipeline, size_t iCurrentFrameResourceIndex)
Definition: ShaderCpuWriteResourceBinding.h:39
std::pair< std::recursive_mutex, std::unordered_map< Pipeline *, size_t > > mtxUintShaderConstantOffsets
Definition: ShaderCpuWriteResourceBinding.h:166
static std::variant< std::unordered_map< Pipeline *, size_t >, Error > getUintShaderConstantOffsetsFromPipelines(const std::unordered_set< Pipeline * > &pipelines, const std::string &sFieldName)
Definition: ShaderCpuWriteResourceBinding.cpp:100
Definition: ShaderResourceBinding.h:27
std::string getShaderResourceName() const
Definition: ShaderResourceBinding.cpp:11
const std::string sShaderResourceName
Definition: ShaderResourceBinding.h:82