Started input system

This commit is contained in:
antopilo
2025-01-08 00:19:09 -05:00
parent 3e92a6c7f4
commit e60c114acf
2 changed files with 19 additions and 3 deletions

View File

@@ -188,6 +188,11 @@ void RenderPass::AddInput(const std::string& name)
InputNames.push_back(name);
}
std::vector<std::string> Nuake::RenderPass::GetInputs()
{
return InputNames;
}
void RenderPass::SetInput(const std::string& name, TextureAttachment& attachment)
{
Inputs[name] = attachment;
@@ -276,14 +281,23 @@ RenderPass& RenderPipeline::GetRenderPass(const std::string& name)
return RenderPasses[0];
}
void RenderPipeline::Build()
bool RenderPipeline::Build()
{
std::map<std::string, TextureAttachment&> attachments;
for (auto& pass : RenderPasses)
{
pass.Build();
for (auto& input : pass.GetInputs())
{
if (attachments.find(input) == attachments.end())
{
Logger::Log("Failed to build RenderPipeline. input " + input + " not found in previous passes.", "vulkan", CRITICAL);
return false;
}
pass.SetInput(input, attachments[input]);
}
for (auto& attachment : pass.GetAttachments())
{

View File

@@ -82,6 +82,8 @@ namespace Nuake
std::vector<TextureAttachment&> GetAttachments();
void AddInput(const std::string& name);
std::vector<std::string> GetInputs();
void SetInput(const std::string& name, TextureAttachment& attachment);
void SetShaders(Ref<VulkanShader> vertShader, Ref<VulkanShader> fragShader);
@@ -119,7 +121,7 @@ namespace Nuake
RenderPass& AddPass(const std::string& name);
RenderPass& GetRenderPass(const std::string& name);
void Build();
bool Build();
void Execute(PassRenderContext& ctx);
};