Nameless Engine
Loading...
Searching...
No Matches
GlobalShaderResourceBinding.h
1#pragma once
2
3// Standard.
4#include <variant>
5#include <memory>
6#include <optional>
7#include <array>
8
9// Custom.
10#include "render/general/resource/frame/FrameResourceManager.h"
11#include "misc/Error.h"
12
13namespace ne {
14 class Pipeline;
15 class Renderer;
16 class GpuResource;
17 class GlobalShaderResourceBindingManager;
18
28 // Only manager is allowed to create such objects.
30
31 public:
33
36
39
40 virtual ~GlobalShaderResourceBinding() = default;
41
42 protected:
58 [[nodiscard]] static std::optional<Error> create(
59 Renderer* pRenderer,
61 const std::string& sShaderResourceName,
62 const std::array<GpuResource*, FrameResourceManager::getFrameResourceCount()>& vResourcesToBind);
63
78 const std::string& sShaderResourceName,
79 const std::array<GpuResource*, FrameResourceManager::getFrameResourceCount()>& vResourcesToBind);
80
89 [[nodiscard]] virtual std::optional<Error> bindToPipelines(Pipeline* pSpecificPipeline) = 0;
90
92 void unregisterBinding();
93
99 const std::string& getShaderResourceName() const;
100
107
108 private:
110 const std::string sShaderResourceName;
111
119
122 };
123}
static constexpr unsigned int getFrameResourceCount()
Definition: FrameResourceManager.h:74
Definition: GlobalShaderResourceBindingManager.h:21
Definition: GlobalShaderResourceBinding.h:27
const std::string & getShaderResourceName() const
Definition: GlobalShaderResourceBinding.cpp:22
GlobalShaderResourceBindingManager *const pManager
Definition: GlobalShaderResourceBinding.h:121
const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> vBindedResources
Definition: GlobalShaderResourceBinding.h:118
const std::string sShaderResourceName
Definition: GlobalShaderResourceBinding.h:110
static std::optional< Error > create(Renderer *pRenderer, GlobalShaderResourceBindingManager *pManager, const std::string &sShaderResourceName, const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &vResourcesToBind)
Definition: GlobalShaderResourceBinding.cpp:31
void unregisterBinding()
Definition: GlobalShaderResourceBinding.cpp:20
std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> getBindedResources() const
Definition: GlobalShaderResourceBinding.cpp:27
virtual std::optional< Error > bindToPipelines(Pipeline *pSpecificPipeline)=0
Definition: GpuResource.h:16
Definition: Pipeline.h:20
Definition: Renderer.h:43