mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 23:43:34 +00:00
working on command lists
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include "Pulse.h"
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
#include "Vulkan.h"
|
||||
#include "VulkanDevice.h"
|
||||
#include "VulkanFence.h"
|
||||
@@ -45,15 +46,39 @@ bool VulkanIsFenceReady(PulseDevice device, PulseFence fence)
|
||||
VkResult res = vulkan_device->vkGetFenceStatus(vulkan_device->device, vulkan_fence);
|
||||
switch(res)
|
||||
{
|
||||
case VK_ERROR_DEVICE_LOST: PulseSetInternalError(PULSE_ERROR_DEVICE_LOST); return false;
|
||||
case VK_NOT_READY: return false;
|
||||
case VK_SUCCESS: return true;
|
||||
|
||||
case VK_NOT_READY: return false;
|
||||
case VK_ERROR_DEVICE_LOST: PulseSetInternalError(PULSE_ERROR_DEVICE_LOST); return false;
|
||||
|
||||
default: return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VulkanWaitForFences(PulseDevice device, PulseFence *const *fences, uint32_t fences_count, bool wait_for_all)
|
||||
bool VulkanWaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all)
|
||||
{
|
||||
if(fences_count == 0)
|
||||
return true;
|
||||
VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(device, VulkanDevice*);
|
||||
if(vulkan_device == PULSE_NULLPTR || vulkan_device->device == VK_NULL_HANDLE)
|
||||
return false;
|
||||
VkFence* vulkan_fences = (VkFence*)calloc(fences_count, sizeof(VkFence));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(vulkan_fences, false);
|
||||
for(uint32_t i = 0; i < fences_count; i++)
|
||||
vulkan_fences[i] = VULKAN_RETRIEVE_DRIVER_DATA_AS(((PulseFence)fences + i), VkFence);
|
||||
VkResult result = vulkan_device->vkWaitForFences(vulkan_device->device, fences_count, vulkan_fences, wait_for_all, UINT64_MAX);
|
||||
free(vulkan_fences);
|
||||
switch(result)
|
||||
{
|
||||
case VK_SUCCESS: break;
|
||||
case VK_TIMEOUT: break;
|
||||
|
||||
case VK_ERROR_DEVICE_LOST: PulseSetInternalError(PULSE_ERROR_DEVICE_LOST); return false;
|
||||
case VK_ERROR_OUT_OF_HOST_MEMORY: PulseSetInternalError(PULSE_ERROR_CPU_ALLOCATION_FAILED); return false;
|
||||
case VK_ERROR_OUT_OF_DEVICE_MEMORY: PulseSetInternalError(PULSE_ERROR_DEVICE_ALLOCATION_FAILED); return false;
|
||||
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user