1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-03-21 12:29:15 +01:00

added some allocation checks

This commit is contained in:
Unknown 2019-02-08 00:33:51 +00:00
parent 53da52251d
commit ff143f8f55
3 changed files with 20 additions and 0 deletions

View File

@ -128,12 +128,19 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(
_bufferView* bv = ALLOCATE(sizeof(_bufferView), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!bv)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
bv->buffer = pCreateInfo->buffer;
bv->format = pCreateInfo->format;
bv->offset = pCreateInfo->offset;
bv->range = pCreateInfo->range;
*pView = bv;
return VK_SUCCESS;
}
/*
@ -200,7 +207,9 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(
{
i->queueFamiliesWithAccess = ALLOCATE(sizeof(uint32_t) * i->numQueueFamiliesWithAccess, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!i->queueFamiliesWithAccess)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
memcpy(i->queueFamiliesWithAccess, pCreateInfo->pQueueFamilyIndices, sizeof(uint32_t) * i->numQueueFamiliesWithAccess);
}

View File

@ -298,10 +298,17 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(
_fence* f = ALLOCATE(sizeof(_fence), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!f)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
f->seqno = 0;
f->signaled = pCreateInfo->flags & VK_FENCE_CREATE_SIGNALED_BIT;
*pFence = f;
return VK_SUCCESS;
}
/*

View File

@ -219,6 +219,10 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
if(s->images[c].concurrentAccess)
{
s->images[c].queueFamiliesWithAccess = ALLOCATE(sizeof(uint32_t)*s->images[c].numQueueFamiliesWithAccess, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!s->images[c].queueFamiliesWithAccess)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
memcpy(s->images[c].queueFamiliesWithAccess, pCreateInfo->pQueueFamilyIndices, sizeof(uint32_t)*s->images[c].numQueueFamiliesWithAccess);
}
s->images[c].preTransformMode = pCreateInfo->preTransform;