Fixed memory corruption in SHSubpass
This commit is contained in:
parent
fe91f58d28
commit
8869b42db2
|
@ -129,11 +129,11 @@ namespace SHADE
|
||||||
for (auto& predResource : prereq->attResources)
|
for (auto& predResource : prereq->attResources)
|
||||||
{
|
{
|
||||||
// if a predecessor's resource is used by this node, we want to copy the final layout from the pred to the initial of this node
|
// if a predecessor's resource is used by this node, we want to copy the final layout from the pred to the initial of this node
|
||||||
if (uint64_t resourceID = predResource.GetId().Raw; node->resourceAttachmentMapping.contains(resourceID))
|
if (uint64_t resourceID = predResource.GetId().Raw; node->resourceAttachmentMapping->contains(resourceID))
|
||||||
{
|
{
|
||||||
// Get the resource's attachment index in BOTH the predecessor and the current node
|
// Get the resource's attachment index in BOTH the predecessor and the current node
|
||||||
uint32_t prereqResourceAttIndex = prereq->resourceAttachmentMapping[resourceID];
|
uint32_t prereqResourceAttIndex = prereq->resourceAttachmentMapping->at(resourceID);
|
||||||
uint32_t resourceAttIndex = node->resourceAttachmentMapping[resourceID];
|
uint32_t resourceAttIndex = node->resourceAttachmentMapping->at(resourceID);
|
||||||
|
|
||||||
// Use the resource attachment index to get the attachment description in the renderpass
|
// Use the resource attachment index to get the attachment description in the renderpass
|
||||||
auto& attDesc = node->attachmentDescriptions[resourceAttIndex];
|
auto& attDesc = node->attachmentDescriptions[resourceAttIndex];
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace SHADE
|
||||||
, framebuffers{}
|
, framebuffers{}
|
||||||
, prereqNodes{ std::move(predecessors) }
|
, prereqNodes{ std::move(predecessors) }
|
||||||
, attachmentDescriptions{}
|
, attachmentDescriptions{}
|
||||||
, resourceAttachmentMapping{}
|
, resourceAttachmentMapping { new std::unordered_map<uint64_t, uint32_t> }
|
||||||
, attResources{ }
|
, attResources{ }
|
||||||
, subpasses{}
|
, subpasses{}
|
||||||
, executed{ false }
|
, executed{ false }
|
||||||
|
@ -163,7 +163,7 @@ namespace SHADE
|
||||||
if (attResources[i]->resourceTypeFlags & static_cast<uint32_t>(SH_ATT_DESC_TYPE_FLAGS::COLOR_PRESENT))
|
if (attResources[i]->resourceTypeFlags & static_cast<uint32_t>(SH_ATT_DESC_TYPE_FLAGS::COLOR_PRESENT))
|
||||||
containsSwapchainImage = true;
|
containsSwapchainImage = true;
|
||||||
|
|
||||||
resourceAttachmentMapping.try_emplace(attResources[i].GetId().Raw, i);
|
resourceAttachmentMapping->try_emplace(attResources[i].GetId().Raw, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!containsSwapchainImage)
|
if (!containsSwapchainImage)
|
||||||
|
@ -254,7 +254,7 @@ namespace SHADE
|
||||||
(
|
(
|
||||||
subpassName,
|
subpassName,
|
||||||
graphStorage, GetHandle(), static_cast<uint32_t>(subpasses.size()),
|
graphStorage, GetHandle(), static_cast<uint32_t>(subpasses.size()),
|
||||||
&resourceAttachmentMapping
|
resourceAttachmentMapping.get()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
subpassIndexing.try_emplace(subpassName, static_cast<uint32_t>(subpasses.size()) - 1u);
|
subpassIndexing.try_emplace(subpassName, static_cast<uint32_t>(subpasses.size()) - 1u);
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace SHADE
|
||||||
std::vector<vk::SubpassDependency> spDeps;
|
std::vector<vk::SubpassDependency> spDeps;
|
||||||
|
|
||||||
//! For indexing resources fast
|
//! For indexing resources fast
|
||||||
std::unordered_map<uint64_t, uint32_t> resourceAttachmentMapping;
|
std::unique_ptr<std::unordered_map<uint64_t, uint32_t>> resourceAttachmentMapping;
|
||||||
|
|
||||||
//! For indexing subpasses
|
//! For indexing subpasses
|
||||||
std::map<std::string, uint32_t> subpassIndexing;
|
std::map<std::string, uint32_t> subpassIndexing;
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace SHADE
|
||||||
colorReferences = std::move(rhs.colorReferences);
|
colorReferences = std::move(rhs.colorReferences);
|
||||||
depthReferences = std::move(rhs.depthReferences);
|
depthReferences = std::move(rhs.depthReferences);
|
||||||
inputReferences = std::move(rhs.inputReferences);
|
inputReferences = std::move(rhs.inputReferences);
|
||||||
resourceAttachmentMapping = rhs.resourceAttachmentMapping;
|
resourceAttachmentMapping = std::move(rhs.resourceAttachmentMapping);
|
||||||
descriptorSetLayout = rhs.descriptorSetLayout;
|
descriptorSetLayout = rhs.descriptorSetLayout;
|
||||||
exteriorDrawCalls = std::move(rhs.exteriorDrawCalls);
|
exteriorDrawCalls = std::move(rhs.exteriorDrawCalls);
|
||||||
graphStorage = rhs.graphStorage;
|
graphStorage = rhs.graphStorage;
|
||||||
|
|
Loading…
Reference in New Issue