Nameless Engine
Loading...
Searching...
No Matches
ShaderResourceBinding.h
1#pragma once
2
3// Standard.
4#include <string>
5#include <memory>
6#include <unordered_set>
7#include <optional>
8
9// Custom.
10#include "material/TextureManager.h"
11#include "misc/Error.h"
12
13namespace ne {
14 class Pipeline;
15 class GpuResource;
16 class UploadBuffer;
17 class ShaderCpuWriteResourceBindingManager;
18
28 // Only pipeline manager is expected to call `onAfterAllPipelinesRefreshedResources`.
29 friend class PipelineManager;
30
31 public:
32 virtual ~ShaderResourceBindingBase() = default;
33
50 [[nodiscard]] virtual std::optional<Error>
51 changeUsedPipelines(const std::unordered_set<Pipeline*>& pipelinesToUse) = 0;
52
58 std::string getShaderResourceName() const;
59
60 protected:
68
78 [[nodiscard]] virtual std::optional<Error> onAfterAllPipelinesRefreshedResources() = 0;
79
80 private:
82 const std::string sShaderResourceName;
83 };
84
87 public:
88 virtual ~ShaderTextureResourceBinding() override = default;
89
101 [[nodiscard]] virtual std::optional<Error>
102 useNewTexture(std::unique_ptr<TextureHandle> pTextureToUse) = 0;
103
104 protected:
112 };
113} // namespace ne
Definition: PipelineManager.h:54
Definition: ShaderResourceBinding.h:27
std::string getShaderResourceName() const
Definition: ShaderResourceBinding.cpp:11
virtual std::optional< Error > changeUsedPipelines(const std::unordered_set< Pipeline * > &pipelinesToUse)=0
const std::string sShaderResourceName
Definition: ShaderResourceBinding.h:82
virtual std::optional< Error > onAfterAllPipelinesRefreshedResources()=0
Definition: ShaderResourceBinding.h:86
virtual std::optional< Error > useNewTexture(std::unique_ptr< TextureHandle > pTextureToUse)=0