finish moving some stuff over to the extension
This commit is contained in:
@@ -27,3 +27,4 @@
|
||||
// extenions
|
||||
#include <extensions/synchronization/fence/gryphn_fence.h>
|
||||
#include <extensions/synchronization/semaphore/gryphn_semaphore.h>
|
||||
#include <extensions/synchronization/gryphn_synced_presentation_queue.h>
|
||||
|
@@ -9,8 +9,6 @@
|
||||
#include <uniforms/vulkan_uniform.h>
|
||||
#include <commands/command_pool/vulkan_command_pool.h>
|
||||
#include <buffers/vulkan_buffer.h>
|
||||
#include <sync/semaphore/vulkan_semaphore.h>
|
||||
#include <sync/fence/vulkan_fence.h>
|
||||
#include <present/vulkan_present.h>
|
||||
#include <submit/vulkan_submit.h>
|
||||
#include <output_device/vulkan_output_devices.h>
|
||||
@@ -18,7 +16,7 @@
|
||||
gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
return (gnDeviceFunctions){
|
||||
._gnCreatePresentationQueue = createPresentationQueue,
|
||||
// ._gnPresentationQueueGetImageAsync = getPresentQueueImageAsync,
|
||||
._gnPresentationQueueGetImage = getVulkanPresentQueueImage,
|
||||
._gnDestroyPresentationQueue = destroyPresentationQueue,
|
||||
|
||||
._gnCreateShaderModule = createShaderModule,
|
||||
@@ -36,9 +34,6 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
._gnCreateCommandPool = createCommandPool,
|
||||
._gnDestroyCommandPool = destroyCommandPool,
|
||||
|
||||
// ._gnCreateSemaphore = createSemaphore,
|
||||
// ._gnDestroySemaphore = destroySemaphore,
|
||||
|
||||
._gnCreateBuffer = createBuffer,
|
||||
._gnBufferData = bufferData,
|
||||
._gnBufferSubData = vulkanBufferSubData,
|
||||
@@ -57,11 +52,6 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
._gnTextureData = textureData,
|
||||
._gnDestroyTexture = destroyTexture,
|
||||
|
||||
// ._gnCreateFence = createFence,
|
||||
// ._gnWaitForFence = waitForFence,
|
||||
// ._gnResetFence = resetFence,
|
||||
// ._gnDestroyFence = destroyFence,
|
||||
|
||||
._gnSubmit = submit,
|
||||
._gnPresent = present,
|
||||
|
||||
|
@@ -2,7 +2,9 @@
|
||||
#include "loader/src/gryphn_instance_functions.h"
|
||||
#include "loader/src/gryphn_device_functions.h"
|
||||
#include "loader/src/gryphn_command_functions.h"
|
||||
#include "extensions/synchronization/loader/sync_functions.h"
|
||||
|
||||
gnInstanceFunctions loadVulkanInstanceFunctions();
|
||||
gnDeviceFunctions loadVulkanDeviceFunctions();
|
||||
gnCommandFunctions loadVulkanCommandFunctions();
|
||||
gnSyncExtFunctions loadVulkanSyncFunctions();
|
||||
|
18
projects/apis/vulkan/loader/vulkan_sync_loader.c
Normal file
18
projects/apis/vulkan/loader/vulkan_sync_loader.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "vulkan_loader.h"
|
||||
#include <sync/semaphore/vulkan_semaphore.h>
|
||||
#include <sync/fence/vulkan_fence.h>
|
||||
#include "presentation_queue/vulkan_presentation_queue.h"
|
||||
|
||||
gnSyncExtFunctions loadVulkanSyncFunctions() {
|
||||
return (gnSyncExtFunctions){
|
||||
._gnPresentationQueueGetImageAsync = getPresentQueueImageAsync,
|
||||
|
||||
._gnCreateSemaphore = createSemaphore,
|
||||
._gnDestroySemaphore = destroySemaphore,
|
||||
|
||||
._gnCreateFence = createFence,
|
||||
._gnWaitForFence = waitForFence,
|
||||
._gnResetFence = resetFence,
|
||||
._gnDestroyFence = destroyFence,
|
||||
};
|
||||
}
|
@@ -81,6 +81,18 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
gnReturnCode getVulkanPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex) {
|
||||
VkResult result = vkAcquireNextImageKHR(
|
||||
presentationQueue->outputDevice->outputDevice->device,
|
||||
presentationQueue->presentationQueue->swapChain,
|
||||
UINT64_MAX, VK_NULL_HANDLE, VK_NULL_HANDLE, imageIndex);
|
||||
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE;
|
||||
if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
gnReturnCode getPresentQueueImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex) {
|
||||
VkResult result = vkAcquireNextImageKHR(
|
||||
presentationQueue->outputDevice->outputDevice->device,
|
||||
|
@@ -10,5 +10,6 @@ typedef struct gnPlatformPresentationQueue_t {
|
||||
} gnPlatformPresentationQueue;
|
||||
|
||||
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo);
|
||||
gnReturnCode getVulkanPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex);
|
||||
gnReturnCode getPresentQueueImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex);
|
||||
void destroyPresentationQueue(gnPresentationQueueHandle queue);
|
||||
|
@@ -28,7 +28,6 @@ struct gnPresentationQueue_t {
|
||||
#endif
|
||||
|
||||
gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQueue, gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
|
||||
// gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
||||
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueue presentationQueue, uint32_t* imageIndex);
|
||||
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue);
|
||||
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index);
|
||||
|
@@ -8,3 +8,4 @@ target_include_directories(GryphnExtensions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.
|
||||
target_include_directories(GryphnExtensions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../core/)
|
||||
target_include_directories(GryphnExtensions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../core/src/)
|
||||
target_include_directories(GryphnExtensions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
target_include_directories(GryphnExtensions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../platform/)
|
||||
|
@@ -0,0 +1,6 @@
|
||||
#include "gryphn_synced_presentation_queue.h"
|
||||
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
||||
|
||||
gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
||||
return presentationQueue->outputDevice->instance->callingLayer->syncFunctions._gnPresentationQueueGetImageAsync(presentationQueue, timeout, semaphore, imageIndex);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "core/src/gryphn_handles.h"
|
||||
|
||||
gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
@@ -67,6 +67,25 @@ gnCommandFunctions loadAPICommandFunctions(gnRenderingAPI api) {
|
||||
}
|
||||
}
|
||||
|
||||
gnSyncExtFunctions loadAPISyncFunctions(gnRenderingAPI api) {
|
||||
switch (api) {
|
||||
case GN_RENDERINGAPI_NONE: return (gnSyncExtFunctions){ NULL };
|
||||
#ifdef GN_API_VULKAN
|
||||
case GN_RENDERINGAPI_VULKAN: return loadVulkanSyncFunctions();
|
||||
#endif
|
||||
|
||||
case GN_RENDERINGAPI_SOFTWARE: return (gnSyncExtFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_DIRECTX11: return (gnSyncExtFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_DIRECTX12: return (gnSyncExtFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_OPENGL: return (gnSyncExtFunctions){ NULL };
|
||||
#ifdef GN_API_METAL
|
||||
case GN_RENDERINGAPI_METAL: return loadMetalSyncFunctions();
|
||||
#endif
|
||||
|
||||
default: return (gnSyncExtFunctions){NULL};
|
||||
}
|
||||
}
|
||||
|
||||
loaderLayer null_layer() {
|
||||
return (loaderLayer){
|
||||
.instanceFunctions = (gnInstanceFunctions){ NULL },
|
||||
@@ -79,7 +98,9 @@ loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
||||
return (loaderLayer){
|
||||
.instanceFunctions = loadAPIInstanceFunctions(api),
|
||||
.deviceFunctions = loadAPIDeviceFunctions(api),
|
||||
.commandFunctions = loadAPICommandFunctions(api)
|
||||
.commandFunctions = loadAPICommandFunctions(api),
|
||||
|
||||
.syncFunctions = loadAPISyncFunctions(api)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,7 +108,9 @@ loaderLayer function_check_layer() {
|
||||
return (loaderLayer){
|
||||
.instanceFunctions = loadFunctionLoaderInstanceFunctions(),
|
||||
.deviceFunctions = loadFunctionLoaderDeviceFunctions(),
|
||||
.commandFunctions = loadFunctionLoaderCommandFunctions()
|
||||
.commandFunctions = loadFunctionLoaderCommandFunctions(),
|
||||
|
||||
.syncFunctions = loadFunctionLoaderSyncExtFunctions()
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -2,8 +2,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS on)
|
||||
project(GryphnFunctionValidator)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS "src/*.c")
|
||||
file(GLOB_RECURSE EXT_FILES CONFIGURE_DEPENDS "extensions/*.c")
|
||||
file(GLOB_RECURSE LOADER_FILES CONFIGURE_DEPENDS "loader/*.c")
|
||||
add_library(GryphnFunctionValidator STATIC ${SOURCE_FILES} ${LOADER_FILES})
|
||||
add_library(GryphnFunctionValidator STATIC ${SOURCE_FILES} ${EXT_FILES} ${LOADER_FILES})
|
||||
target_include_directories(GryphnFunctionValidator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/)
|
||||
target_include_directories(GryphnFunctionValidator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
target_include_directories(GryphnFunctionValidator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../core/src/)
|
||||
|
@@ -40,7 +40,6 @@ gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
||||
gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
||||
return (gnDeviceFunctions){
|
||||
._gnCreatePresentationQueue = checkCreatePresentationQueue,
|
||||
// ._gnPresentationQueueGetImageAsync = checkPresentationQueueGetImageAsync,
|
||||
._gnPresentationQueueGetImage = checkPresentationQueueGetImage,
|
||||
._gnDestroyPresentationQueue = checkDestroyPresentationQueue,
|
||||
|
||||
@@ -59,9 +58,6 @@ gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
||||
._gnCreateCommandPool = checkCreateCommandPool,
|
||||
._gnDestroyCommandPool = checkDestroyCommandPool,
|
||||
|
||||
// ._gnCreateSemaphore = checkCreateSemaphore,
|
||||
// ._gnDestroySemaphore = checkDestroySemaphore,
|
||||
|
||||
._gnCreateBuffer = checkCreateBuffer,
|
||||
._gnBufferData = checkBufferData,
|
||||
._gnBufferSubData = checkBufferSubData,
|
||||
@@ -80,11 +76,6 @@ gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
||||
._gnTextureData = checkTextureData,
|
||||
._gnDestroyTexture = checkDestroyTexture,
|
||||
|
||||
// ._gnCreateFence = checkCreateFence,
|
||||
// ._gnWaitForFence = checkWaitForFence,
|
||||
// ._gnResetFence = checkResetFence,
|
||||
// ._gnDestroyFence = checkDestroyFence,
|
||||
|
||||
._gnSubmit = checkSubmit,
|
||||
._gnPresent = checkPresent,
|
||||
|
||||
@@ -112,3 +103,17 @@ gnCommandFunctions loadFunctionLoaderCommandFunctions() {
|
||||
._gnCommandDrawIndexed = checkCommandDrawIndexed,
|
||||
};
|
||||
}
|
||||
|
||||
gnSyncExtFunctions loadFunctionLoaderSyncExtFunctions() {
|
||||
return (gnSyncExtFunctions) {
|
||||
._gnPresentationQueueGetImageAsync = checkPresentationQueueGetImageAsync,
|
||||
|
||||
._gnCreateSemaphore = checkCreateSemaphore,
|
||||
._gnDestroySemaphore = checkDestroySemaphore,
|
||||
|
||||
._gnCreateFence = checkCreateFence,
|
||||
._gnWaitForFence = checkWaitForFence,
|
||||
._gnResetFence = checkResetFence,
|
||||
._gnDestroyFence = checkDestroyFence,
|
||||
};
|
||||
}
|
||||
|
@@ -6,3 +6,6 @@
|
||||
gnInstanceFunctions loadFunctionLoaderInstanceFunctions();
|
||||
gnDeviceFunctions loadFunctionLoaderDeviceFunctions();
|
||||
gnCommandFunctions loadFunctionLoaderCommandFunctions();
|
||||
|
||||
#include "extensions/synchronization/loader/sync_functions.h"
|
||||
gnSyncExtFunctions loadFunctionLoaderSyncExtFunctions();
|
||||
|
Reference in New Issue
Block a user