There is a memory leak

This commit is contained in:
Dynamitos
2023-11-30 11:51:53 +01:00
parent d1475d506e
commit 1493627ceb
20 changed files with 91 additions and 102 deletions
+2 -1
View File
@@ -165,8 +165,9 @@ void BasePass::render()
{
if (meshData.numIndices > 0)
{
command->drawIndexed(meshData.numIndices, 1, meshData.firstIndex, meshData.indicesOffset, instanceOffset++);
command->drawIndexed(meshData.numIndices, 1, meshData.firstIndex, meshData.indicesOffset, instanceOffset);
}
instanceOffset++;
}
}
}
+2 -2
View File
@@ -10,7 +10,7 @@
using namespace Seele;
constexpr static uint64 NUM_DEFAULT_ELEMENTS = 16 * 1024;
constexpr static uint64 NUM_DEFAULT_ELEMENTS = 1024 * 1024;
void VertexData::resetMeshData()
{
@@ -166,7 +166,7 @@ MeshId VertexData::allocateVertexData(uint64 numVertices)
head += numVertices;
if (head > verticesAllocated)
{
verticesAllocated = head;
verticesAllocated = std::max(head, verticesAllocated + NUM_DEFAULT_ELEMENTS);
resizeBuffers();
}
return res;
+9 -5
View File
@@ -62,12 +62,10 @@ void DescriptorLayout::create()
PipelineLayout::~PipelineLayout()
{
if (layoutHandle != VK_NULL_HANDLE)
{
vkDestroyPipelineLayout(graphics->getDevice(), layoutHandle, nullptr);
}
}
Map<uint32, VkPipelineLayout> cachedLayouts;
void PipelineLayout::create()
{
vulkanDescriptorLayouts.resize(descriptorSetLayouts.size());
@@ -105,7 +103,14 @@ void PipelineLayout::create()
layoutHash = CRC::Calculate(createInfo.pPushConstantRanges, sizeof(VkPushConstantRange) * createInfo.pushConstantRangeCount, CRC::CRC_32());
layoutHash = CRC::Calculate(createInfo.pSetLayouts, sizeof(VkDescriptorSetLayout) * createInfo.setLayoutCount, CRC::CRC_32(), layoutHash);
if (cachedLayouts.contains(layoutHash))
{
layoutHandle = cachedLayouts[layoutHash];
return;
}
VK_CHECK(vkCreatePipelineLayout(graphics->getDevice(), &createInfo, nullptr, &layoutHandle));
cachedLayouts[layoutHash] = layoutHandle;
}
void PipelineLayout::reset()
@@ -391,7 +396,6 @@ Gfx::PDescriptorSet DescriptorPool::allocateDescriptorSet()
{
//If it hasnt been initialized, allocate it
VK_CHECK(vkAllocateDescriptorSets(graphics->getDevice(), &allocInfo, &cachedHandles[setIndex]->setHandle));
std::cout << "New descriptor " << cachedHandles[setIndex]->setHandle << std::endl;
}
cachedHandles[setIndex]->allocate();