Added map to retrieve usable subpasses

This commit is contained in:
Brandon Mak 2023-01-30 16:35:12 +08:00
parent 8a4a469abf
commit f8bde9fc35
2 changed files with 8 additions and 2 deletions

View File

@ -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<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> 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);

View File

@ -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<std::string, Handle<SHSubpass>> const& GetUsableSubpasses(void) const noexcept {return usableSubpassesMapping;};
/*-----------------------------------------------------------------------------*/
/* Getters */
@ -507,6 +508,8 @@ namespace SHADE
uint32_t resizeHeight = 1;
bool restoredFromMinimize = false;
std::unordered_map<std::string, Handle<SHSubpass>> usableSubpassesMapping{};
/*---------------------------------------------------------------------------------*/
/* Helper Functions */
/*---------------------------------------------------------------------------------*/