diff --git a/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp b/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp index d382451d..adb1fe51 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp @@ -92,11 +92,17 @@ namespace SHADE if (vertShader && fragShader && gfxSystem) { // - Retrieve pipeline from pipeline library - auto renderPass = gfxSystem->GetPrimaryRenderpass(); - auto subPass = renderPass->GetSubpass(currentMatSpec->subpassName); - auto pipeline = renderPass->GetOrCreatePipeline({ vertShader, fragShader }, subPass); - // - Set Pipeline - matHandle->SetPipeline(pipeline); + auto subPass = gfxSystem->GetUsableSubpass(currentMatSpec->subpassName); + if (subPass) + { + // Set Pipeline if valid + auto pipeline = subPass->GetParentNode()->GetOrCreatePipeline({vertShader, fragShader}, subPass); + matHandle->SetPipeline(pipeline); + } + else + { + SHLOG_ERROR("[SHMaterialInspector] Failed to find material subpass of type \"{}\"", currentMatSpec->subpassName); + } } } diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp index 5205b44d..96207d7a 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp @@ -474,7 +474,7 @@ namespace SHADE */ /***************************************************************************/ - Handle const& SHSubpass::GetParentNode(void) const noexcept + Handle SHSubpass::GetParentNode(void) const noexcept { return parentNode; } diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h index f84d4dee..811cc70c 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h @@ -159,7 +159,7 @@ namespace SHADE /*-----------------------------------------------------------------------*/ void SetCompanionSubpass (Handle companion, Handle pipeline) noexcept; - Handle const& GetParentNode(void) const noexcept; + Handle GetParentNode(void) const noexcept; SHSubPassIndex GetIndex() const noexcept; Handle GetSuperBatch(void) const noexcept; std::vector const& GetColorAttachmentReferences (void) const noexcept; diff --git a/SHADE_Engine/src/Resource/SHResourceManager.hpp b/SHADE_Engine/src/Resource/SHResourceManager.hpp index 51ee356a..8e2b3309 100644 --- a/SHADE_Engine/src/Resource/SHResourceManager.hpp +++ b/SHADE_Engine/src/Resource/SHResourceManager.hpp @@ -270,14 +270,8 @@ namespace SHADE return {}; } - // Grab subpass from worldRenderer - auto renderPass = gfxSystem->GetPrimaryRenderpass(); - if (!renderPass) - { - SHLOG_ERROR("[SHResourceManager] Failed to load material as RenderPass could not be found."); - return {}; - } - auto subPass = renderPass->GetSubpass(assetData.subpassName); + // Grab subpass + auto subPass = gfxSystem->GetUsableSubpass(assetData.subpassName); if (!subPass) { SHLOG_ERROR("[SHResourceManager] Failed to load material as SubPass could not be found.");