mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Fix for double delete in Vulkan DescSetLayout::Init
DescSetLayout::Init can crash when Immutable Samplers are provided. When the vector containing the Binding info is resized, the pointer to immutableSamplers is copied and then deleted in the old copy. A copy constructor has been added to the Binding struct. Fixed indexing in DescSetLayout::Init
This commit is contained in:
committed by
Baldur Karlsson
parent
8154b93e2a
commit
1426d1bbd9
@@ -55,7 +55,7 @@ void DescSetLayout::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo
|
||||
|
||||
if(pCreateInfo->pBindings[i].pImmutableSamplers)
|
||||
{
|
||||
bindings[b].immutableSampler = new ResourceId[bindings[i].descriptorCount];
|
||||
bindings[b].immutableSampler = new ResourceId[bindings[b].descriptorCount];
|
||||
|
||||
for(uint32_t s = 0; s < bindings[b].descriptorCount; s++)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,19 @@ struct DescSetLayout
|
||||
immutableSampler(NULL)
|
||||
{
|
||||
}
|
||||
// Copy the immutable sampler
|
||||
Binding(const Binding &b)
|
||||
: descriptorType(b.descriptorType),
|
||||
descriptorCount(b.descriptorCount),
|
||||
stageFlags(b.stageFlags),
|
||||
immutableSampler(NULL)
|
||||
{
|
||||
if(b.immutableSampler)
|
||||
{
|
||||
immutableSampler = new ResourceId[descriptorCount];
|
||||
memcpy(immutableSampler, b.immutableSampler, sizeof(ResourceId) * descriptorCount);
|
||||
}
|
||||
}
|
||||
~Binding() { SAFE_DELETE_ARRAY(immutableSampler); }
|
||||
VkDescriptorType descriptorType;
|
||||
uint32_t descriptorCount;
|
||||
|
||||
Reference in New Issue
Block a user