vulkan+gryphn sync impl
This commit is contained in:
23
rendering_api/vulkan/src/sync/fence/vulkan_fence.c
Normal file
23
rendering_api/vulkan/src/sync/fence/vulkan_fence.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "vulkan_fence.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCreateFenceFn(struct gnFence_t* fence, struct gnOutputDevice_t* device) {
|
||||
fence->fence = malloc(sizeof(gnPlatformFence));
|
||||
VkFenceCreateInfo fenceInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
|
||||
};
|
||||
if (vkCreateFence(device->outputDevice->device, &fenceInfo, NULL, &fence->fence->fence) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_FENCE;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void gnSignalFenceFn(struct gnFence_t* fence) {}
|
||||
void gnWaitForFenceFn(struct gnFence_t* fence, uint64_t timeout) {
|
||||
vkWaitForFences(fence->device->outputDevice->device, 1, &fence->fence->fence, VK_TRUE, timeout);
|
||||
}
|
||||
void gnResetFenceFn(struct gnFence_t* fence) {
|
||||
vkResetFences(fence->device->outputDevice->device, 1, &fence->fence->fence);
|
||||
}
|
||||
void gnDestroyFenceFn(struct gnFence_t* fence) {
|
||||
vkDestroyFence(fence->device->outputDevice->device, fence->fence->fence, NULL);
|
||||
free(fence->fence);
|
||||
}
|
7
rendering_api/vulkan/src/sync/fence/vulkan_fence.h
Normal file
7
rendering_api/vulkan/src/sync/fence/vulkan_fence.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "core/sync/fence/gryphn_fence.h"
|
||||
|
||||
typedef struct gnPlatformFence_t {
|
||||
VkFence fence;
|
||||
} gnPlatformFence;
|
17
rendering_api/vulkan/src/sync/semaphore/vulkan_semaphore.c
Normal file
17
rendering_api/vulkan/src/sync/semaphore/vulkan_semaphore.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "vulkan_semaphore.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCreateSemaphoreFn(struct gnSemaphore_t* semaphore, struct gnOutputDevice_t* device) {
|
||||
semaphore->semaphore = malloc(sizeof(gnPlatformSemaphore));
|
||||
VkSemaphoreCreateInfo semaphoreInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
|
||||
};
|
||||
|
||||
if (vkCreateSemaphore(device->outputDevice->device, &semaphoreInfo, NULL, &semaphore->semaphore->semaphore))
|
||||
return GN_FAILED_TO_CREATE_SEMAPHORE;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void gnDestroySemaphoreFn(struct gnSemaphore_t* semaphore) {
|
||||
vkDestroySemaphore(semaphore->device->outputDevice->device, semaphore->semaphore->semaphore, NULL);
|
||||
free(semaphore->semaphore);
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "core/sync/semaphore/gryphn_semaphore.h"
|
||||
|
||||
typedef struct gnPlatformSemaphore_t {
|
||||
VkSemaphore semaphore;
|
||||
} gnPlatformSemaphore;
|
Reference in New Issue
Block a user