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
13
namespace
ne {
14
class
Pipeline;
15
class
GpuResource;
16
class
UploadBuffer;
17
class
ShaderCpuWriteResourceBindingManager;
18
27
class
ShaderResourceBindingBase
{
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
:
67
ShaderResourceBindingBase
(
const
std::string&
sShaderResourceName
);
68
78
[[nodiscard]]
virtual
std::optional<Error>
onAfterAllPipelinesRefreshedResources
() = 0;
79
80
private
:
82
const
std::string
sShaderResourceName
;
83
};
84
86
class
ShaderTextureResourceBinding
:
public
ShaderResourceBindingBase
{
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
:
111
ShaderTextureResourceBinding
(
const
std::string&
sShaderResourceName
);
112
};
113
}
// namespace ne
ne::PipelineManager
Definition:
PipelineManager.h:54
ne::ShaderResourceBindingBase
Definition:
ShaderResourceBinding.h:27
ne::ShaderResourceBindingBase::getShaderResourceName
std::string getShaderResourceName() const
Definition:
ShaderResourceBinding.cpp:11
ne::ShaderResourceBindingBase::changeUsedPipelines
virtual std::optional< Error > changeUsedPipelines(const std::unordered_set< Pipeline * > &pipelinesToUse)=0
ne::ShaderResourceBindingBase::sShaderResourceName
const std::string sShaderResourceName
Definition:
ShaderResourceBinding.h:82
ne::ShaderResourceBindingBase::onAfterAllPipelinesRefreshedResources
virtual std::optional< Error > onAfterAllPipelinesRefreshedResources()=0
ne::ShaderTextureResourceBinding
Definition:
ShaderResourceBinding.h:86
ne::ShaderTextureResourceBinding::useNewTexture
virtual std::optional< Error > useNewTexture(std::unique_ptr< TextureHandle > pTextureToUse)=0
src
engine_lib
private
shader
general
resource
binding
ShaderResourceBinding.h
Generated by
1.9.5