16 if (!textureId_.empty())
18 textureId = entt::hashed_string(textureId_.data(), textureId_.size());
24 wgpu::StoreOp
storeOp = wgpu::StoreOp::Store;
36 if (!textureId_.empty())
38 textureId = entt::hashed_string(textureId_.data(), textureId_.size());
41 wgpu::StoreOp
storeOp = wgpu::StoreOp::Store;
51 using std::map<uint32_t, std::string>::map;
62 _boundShader = entt::hashed_string(shaderName.data(), shaderName.size());
65 void AddInput(uint32_t groupIndex, std::string_view bindGroupName)
67 if (
_inputs.contains(groupIndex))
69 Log::Warning(fmt::format(
"RenderPass {}: Overwriting existing bind group at index {}",
_name, groupIndex));
71 _inputs[groupIndex] = bindGroupName;
76 if (
_outputs.colorBuffers.contains(
id))
78 Log::Warning(fmt::format(
"RenderPass {}: Overwriting existing color buffer at index {}",
_name,
id));
80 _outputs.colorBuffers[id] = std::move(output);
85 if (
_outputs.depthBuffer.has_value())
87 Log::Warning(fmt::format(
"RenderPass {}: Overwriting existing depth buffer",
_name));
94 std::vector<Utils::ValidationError> errors;
95 const std::string location = fmt::format(
"RenderPass({})",
_name);
101 .location = location,
109 .message = fmt::format(
"Bound shader '{}' does not exist in ShaderManager",
111 .location = location,
114 const auto &shader = shaderManager.Get(
_boundShader.value());
115 for (
const auto &[index, bindGroupName] :
_inputs)
117 const auto &bindGroupLayouts = shader.GetDescriptor().getBindGroupLayouts();
118 if (index >= bindGroupLayouts.size())
121 .message = fmt::format(
122 "Input bind group index {} exceeds number of bind groups ({}) in shader '{}'", index,
124 .location = location,
131 for (
const auto &[index, bindGroupName] :
_inputs)
133 if (!bindGroups.Contains(entt::hashed_string(bindGroupName.data(), bindGroupName.size())))
136 .message = fmt::format(
"Input bind group '{}' at index {} does not exist in BindGroupContainer",
137 bindGroupName, index),
138 .location = location,
The core is the place where all the data of the engine is stored. It contains the registry (entities)...
Definition Core.hpp:33
TResource & GetResource()
Get a reference of a resource.
Definition Core.inl:14
std::string _name
Definition ARenderPass.hpp:154
const auto & GetInputs(void) const
Definition ARenderPass.hpp:146
virtual void Execute(Engine::Core &core)=0
std::optional< entt::hashed_string > _boundShader
Definition ARenderPass.hpp:152
const auto & GetName(void) const
Definition ARenderPass.hpp:147
void AddInput(uint32_t groupIndex, std::string_view bindGroupName)
Definition ARenderPass.hpp:65
void AddOutput(uint32_t id, ColorOutput &&output)
Definition ARenderPass.hpp:74
void BindShader(std::string_view shaderName)
Definition ARenderPass.hpp:60
ARenderPass(std::string_view name)
Definition ARenderPass.hpp:56
OutputContainer _outputs
Definition ARenderPass.hpp:155
std::vector< Utils::ValidationError > validate(Engine::Core &core) const
Definition ARenderPass.hpp:92
const auto & GetBoundShader(void) const
Definition ARenderPass.hpp:145
auto & GetOutputs(void)
Definition ARenderPass.hpp:149
InputContainer _inputs
Definition ARenderPass.hpp:153
const auto & GetOutputs(void) const
Definition ARenderPass.hpp:148
void AddOutput(DepthOutput &&output)
Definition ARenderPass.hpp:83
Definition AGPUBuffer.hpp:6
Object::Resource::ResourceManager< Shader > ShaderContainer
ShaderContainer is a resource that stores Shader resources.
Definition ShaderContainer.hpp:17
Object::Resource::ResourceManager< BindGroup > BindGroupManager
BindGroupManager is a resource that stores BindGroup resources.
Definition BindGroupManager.hpp:17
void Warning(const T &msg) noexcept
Definition Logger.hpp:49
Definition ARenderPass.hpp:12
std::function< bool(Engine::Core &, glm::vec4 &)> getClearColorCallback
Definition ARenderPass.hpp:25
std::optional< std::string > textureResolveTargetName
Definition ARenderPass.hpp:22
uint32_t depthSlice
Definition ARenderPass.hpp:23
ColorOutput(std::string_view textureId_={})
Definition ARenderPass.hpp:14
wgpu::StoreOp storeOp
Definition ARenderPass.hpp:24
entt::hashed_string textureId
Definition ARenderPass.hpp:13
Definition ARenderPass.hpp:30
wgpu::StoreOp storeOp
Definition ARenderPass.hpp:41
entt::hashed_string textureId
Definition ARenderPass.hpp:32
std::function< bool(Engine::Core &, float &)> getClearDepthCallback
Definition ARenderPass.hpp:42
std::optional< wgpu::TextureView > depthTextureView
Definition ARenderPass.hpp:33
DepthOutput(std::string_view textureId_={})
Definition ARenderPass.hpp:34
Definition ARenderPass.hpp:45
std::optional< DepthOutput > depthBuffer
Definition ARenderPass.hpp:47
std::map< uint32_t, ColorOutput > colorBuffers
Definition ARenderPass.hpp:46
Definition IValidable.hpp:9
@ Error
Definition IValidable.hpp:14