From f8bde9fc359bb18bc2f2660c26a725038556d365 Mon Sep 17 00:00:00 2001 From: Brandon Mak Date: Mon, 30 Jan 2023 16:35:12 +0800 Subject: [PATCH] Added map to retrieve usable subpasses --- .../src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp | 7 +++++-- .../src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index 437dd9a8..12f8f318 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -240,6 +240,7 @@ namespace SHADE gBufferSubpass->AddColorOutput("Position World Space"); gBufferSubpass->AddDepthOutput("Depth Buffer", SH_RENDER_GRAPH_RESOURCE_FLAGS::DEPTH_STENCIL); + usableSubpassesMapping.emplace (std::string (SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_SUBPASS.data()), gBufferSubpass); /*-----------------------------------------------------------------------*/ /* SSAO PASS AND DATA INIT */ @@ -318,7 +319,7 @@ namespace SHADE /* SCREEN SPACE PASS */ /*-----------------------------------------------------------------------*/ auto screenSpaceNode = renderGraph->AddNode(SHGraphicsConstants::RenderGraphEntityNames::SCREEN_SPACE_PASS.data(), {"Scene", "Entity ID"}, {SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_PASS.data(), SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data(), SHGraphicsConstants::RenderGraphEntityNames::DEBUG_DRAW.data()}); - auto uiSubpass = screenSpaceNode->AddSubpass("UI", worldViewport, screenRenderer); + auto uiSubpass = screenSpaceNode->AddSubpass(SHGraphicsConstants::RenderGraphEntityNames::UI_SUBPASS.data(), worldViewport, screenRenderer); uiSubpass->AddColorOutput("Scene"); uiSubpass->AddColorOutput("Entity ID"); uiSubpass->AddExteriorDrawCalls([=](Handle cmdBuffer, Handle renderer, uint32_t frameIndex) @@ -326,6 +327,8 @@ namespace SHADE textRenderingSubSystem->Render(cmdBuffer, renderer, frameIndex); }); + usableSubpassesMapping.emplace(SHGraphicsConstants::RenderGraphEntityNames::UI_SUBPASS.data(), uiSubpass); + /*-----------------------------------------------------------------------*/ /* RENDER TO SWAPCHAIN IMAGE FOR PRESENT PASS */ /*-----------------------------------------------------------------------*/ @@ -420,7 +423,7 @@ namespace SHADE // initialize the text renderer auto uiNode = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::SCREEN_SPACE_PASS.data()); - textRenderingSubSystem->Init(device, uiNode->GetRenderpass(), uiNode->GetSubpass("UI"), descPool, textVS, textFS); + textRenderingSubSystem->Init(device, uiNode->GetRenderpass(), uiNode->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::UI_SUBPASS), descPool, textVS, textFS); SHGlobalDescriptorSets::SetLightingSubSystem(lightingSubSystem); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h index c736599f..11aaf337 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h @@ -399,6 +399,7 @@ namespace SHADE uint32_t GetCurrentFrameIndex(void) const noexcept { return renderContext.GetCurrentFrame(); } SHFontLibrary const& GetFontLibrary (void) const noexcept; const SHMeshLibrary& GetMeshLibrary() const noexcept { return meshLibrary; }; + std::unordered_map> const& GetUsableSubpasses(void) const noexcept {return usableSubpassesMapping;}; /*-----------------------------------------------------------------------------*/ /* Getters */ @@ -507,6 +508,8 @@ namespace SHADE uint32_t resizeHeight = 1; bool restoredFromMinimize = false; + std::unordered_map> usableSubpassesMapping{}; + /*---------------------------------------------------------------------------------*/ /* Helper Functions */ /*---------------------------------------------------------------------------------*/