FIXED MY SHIT WHEE

This commit is contained in:
Brandon Mak 2022-09-26 00:37:58 +08:00
parent a5c804ca8b
commit 31dff230ef
2 changed files with 5 additions and 4 deletions

View File

@ -150,7 +150,7 @@ namespace SHADE
//compositeSubpass->AddInput("Position");
// TODO: Use macro to add this node when SH_EDITOR is enabled
auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, {});
auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, {"G-Buffer"});
auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
imguiSubpass->AddColorOutput("Present");

View File

@ -716,7 +716,7 @@ namespace SHADE
// First we want to take all the attachment descriptions and initialize the
// finalLayout to whatever layout is specified in the last subpass that references the attachment.
for (auto& node : nodes)
for (uint32_t i = 0; auto& node : nodes)
{
// key is handle ID, value is pair (first is initial layout, second is final layout).
std::unordered_map<uint32_t, vk::ImageLayout> resourceAttLayouts;
@ -730,7 +730,7 @@ namespace SHADE
{
for (auto& color : subpass->colorReferences)
{
if (node->attResources[color.attachment]->resourceType == SH_ATT_DESC_TYPE::COLOR_PRESENT)
if (i == nodes.size() - 1 && node->attResources[color.attachment]->resourceType == SH_ATT_DESC_TYPE::COLOR_PRESENT)
resourceAttLayouts[color.attachment] = vk::ImageLayout::ePresentSrcKHR;
else
resourceAttLayouts[color.attachment] = color.layout;
@ -749,6 +749,7 @@ namespace SHADE
att.initialLayout = vk::ImageLayout::eUndefined;
att.finalLayout = resourceAttLayouts[i];
}
++i;
}
// at this point all attachment descs will have their final layouts initialized as if they were standalone and did
@ -857,7 +858,7 @@ namespace SHADE
for (auto& inputAtt : subpass->inputReferences)
{
auto resource = node->attResources[inputAtt.attachment];
if (resource->resourceType == SH_ATT_DESC_TYPE::COLOR)
if (resource->resourceType == SH_ATT_DESC_TYPE::COLOR || resource->resourceType == SH_ATT_DESC_TYPE::COLOR_PRESENT)
colorRead |= (1 << i);
else if (resource->resourceType == SH_ATT_DESC_TYPE::DEPTH_STENCIL)
depthRead |= (1 << i);