From 8c30e656f7b38697fb597e5d590ccda020c89114 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sun, 18 Sep 2022 14:58:32 +0800 Subject: [PATCH] Modified AddMaterial() to take in a subpass --- .../Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp | 11 ++++++----- .../Graphics/MiddleEnd/Interface/SHGraphicsSystem.h | 5 ++--- SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index d05ece2e..376f19a7 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -321,18 +321,19 @@ namespace SHADE viewports.erase(iter); } - Handle SHGraphicsSystem::AddMaterial(Handle vertShader, Handle fragShader) + Handle SHGraphicsSystem::AddMaterial(Handle vertShader, Handle fragShader, Handle subpass) { // Retrieve pipeline from pipeline storage or create if unavailable auto shaderPair = std::make_pair(vertShader, fragShader); Handle pipeline = pipelineLibrary.GetDrawPipline(shaderPair); if (!pipeline) - { - /*pipeline = pipelineLibrary.CreateDrawPipeline + { + pipeline = pipelineLibrary.CreateDrawPipeline ( shaderPair, - - );*/ + subpass->GetParentNode()->GetRenderpass(), + subpass->GetIndex() + ); } // Create material diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h index 7dcf12c0..8dad518f 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h @@ -25,11 +25,10 @@ of DigiPen Institute of Technology is prohibited. #include "ECS_Base/System/SHSystemRoutine.h" #include "Graphics/Descriptors/SHVkDescriptorPool.h" #include "Graphics/MiddleEnd/Pipeline/SHPipelineLibrary.h" +#include "Graphics/RenderGraph/SHRenderGraph.h" namespace SHADE { - - /*---------------------------------------------------------------------------------*/ /* Forward Declarations */ /*---------------------------------------------------------------------------------*/ @@ -112,7 +111,7 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ /* Material Creation Functions */ /*-----------------------------------------------------------------------------*/ - Handle AddMaterial(Handle vertShader, Handle fragShader); + Handle AddMaterial(Handle vertShader, Handle fragShader, Handle subpass); void RemoveMaterial(Handle material);; Handle AddMaterialInstance(Handle material); void RemoveMaterialInstance(Handle materialInstance); diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h index fb843bc2..377d4a76 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h @@ -105,6 +105,7 @@ namespace SHADE /* GETTERS AND SETTERS */ /*-----------------------------------------------------------------------*/ Handle const& GetParentNode (void) const noexcept; + SHSubPassIndex GetIndex() const noexcept { return 0; } // TODO private: /*---------------------------------------------------------------------*/