From a67e65ff765c6fab0898ea9495145ea728dec4c2 Mon Sep 17 00:00:00 2001 From: Brandon Mak Date: Mon, 30 Jan 2023 15:34:22 +0800 Subject: [PATCH] Made array for usable subpasses --- .../Graphics/MiddleEnd/Interface/SHGraphicsConstants.h | 8 ++++++++ .../src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsConstants.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsConstants.h index b3945689..45f91ae6 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsConstants.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsConstants.h @@ -13,6 +13,7 @@ of DigiPen Institute of Technology is prohibited. // STL Includes #include +#include namespace SHADE { @@ -114,7 +115,14 @@ namespace SHADE static constexpr std::string_view DEFERRED_COMPOSITE_COMPUTE = "Deferred Composite"; + static constexpr std::string_view GBUFFER_WRITE_SUBPASS = "G-Buffer Write"; + static constexpr std::string_view UI_SUBPASS = "UI"; + static constexpr std::array USABLE_SUBPASSES = + { + GBUFFER_WRITE_SUBPASS, + UI_SUBPASS + }; }; struct DescriptorSetBindings diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index c4990153..437dd9a8 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -231,7 +231,7 @@ namespace SHADE /*-----------------------------------------------------------------------*/ /* G-BUFFER SUBPASS INIT */ /*-----------------------------------------------------------------------*/ - auto gBufferSubpass = gBufferNode->AddSubpass("G-Buffer Write", worldViewport, worldRenderer); + auto gBufferSubpass = gBufferNode->AddSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_SUBPASS.data(), worldViewport, worldRenderer); gBufferSubpass->AddColorOutput("Position"); gBufferSubpass->AddColorOutput("Entity ID"); gBufferSubpass->AddColorOutput("Light Layer Indices"); @@ -447,7 +447,7 @@ namespace SHADE defaultMaterial = AddMaterial ( defaultVertShader, defaultFragShader, - renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass("G-Buffer Write") + renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_SUBPASS) ); defaultMaterial->SetProperty("data.textureIndex", defaultTexture->TextureArrayIndex); } @@ -765,7 +765,7 @@ namespace SHADE auto const& EVENT_DATA = reinterpret_cast*>(eventPtr.get())->data; auto* lightComp = SHComponentManager::GetComponent(EVENT_DATA->lightEntity); std::string resourceName = "ShadowMap " + std::to_string(EVENT_DATA->lightEntity); - Handle companionSubpass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass("G-Buffer Write"); + Handle companionSubpass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_SUBPASS); if (EVENT_DATA->generateRenderer) {