start the process of making sync objects an extension

This commit is contained in:
Gregory Wells
2025-07-09 19:02:40 -04:00
parent 4b8f854b1f
commit a393d7b5b7
26 changed files with 66 additions and 37 deletions

View File

@@ -1,8 +0,0 @@
#pragma once
#include <gryphn/gryphn_utils.h>
typedef enum gnFeature {
GN_DYNAMIC_STATES, GN_SYNC_OBJECTS
} gnFeature;
inline gnBool (*gnAPISupports)(gnFeature feature);

View File

@@ -3,6 +3,7 @@
#include <loader/src/gryphn_instance_functions.h>
#include "loader/src/gryphn_loader.h"
#include "debugger/gryphn_debugger.h"
#include "loader/src/gryphn_loader.h"
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
*instance = malloc(sizeof(struct gnInstance_t));

View File

@@ -3,7 +3,8 @@
#include "core/src/gryphn_handles.h"
#include "utils/gryphn_version.h"
#include "utils/gryphn_error_code.h"
#include "loader/src/gryphn_loader.h"
#include <loader/src/gryphn_loader.h>
#include <gryphn_extensions.h>
typedef struct gnInstanceInfo {
gnString applicationName;
@@ -14,6 +15,9 @@ typedef struct gnInstanceInfo {
gnRenderingAPI renderingAPI;
gnDebuggerHandle debugger;
uint32_t extensionCount;
gnExtension* extensions;
} gnInstanceInfo;
#ifdef GN_REVEAL_IMPL

View File

@@ -7,8 +7,8 @@ gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQu
return device->instance->callingLayer->deviceFunctions._gnCreatePresentationQueue(*presentationQueue, device, presentationInfo);
}
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
return presentationQueue->outputDevice->instance->callingLayer->deviceFunctions._gnPresentationQueueGetImage(presentationQueue, timeout, semaphore, imageIndex);
gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
return presentationQueue->outputDevice->instance->callingLayer->deviceFunctions._gnPresentationQueueGetImageAsync(presentationQueue, timeout, semaphore, imageIndex);
}
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue) { return presentationQueue->imageCount; }
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index) {

View File

@@ -2,7 +2,6 @@
#include <utils/gryphn_image_format.h>
#include <output_device/gryphn_output_device.h>
#include <window_surface/gryphn_surface.h>
#include <sync/semaphore/gryphn_semaphore.h>
#include "gryphn_handles.h"
typedef struct gnPresentationQueueInfo {
@@ -29,7 +28,8 @@ struct gnPresentationQueue_t {
#endif
gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQueue, gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
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);
void gnDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue);

View File

@@ -1,24 +0,0 @@
#include "gryphn_fence.h"
#include "output_device/gryphn_output_device.h"
#include "instance/gryphn_instance.h"
gnReturnCode gnCreateFence(gnFenceHandle* fence, gnDevice device) {
*fence = malloc(sizeof(struct gnFence_t));
(*fence)->device = device;
(*fence)->signaled = gnFalse;
return device->instance->callingLayer->deviceFunctions._gnCreateFence(*fence, device);
}
void gnSignalFence(gnFenceHandle fence) {
fence->signaled = gnTrue;
}
void gnWaitForFence(gnFenceHandle fence, uint64_t timeout) {
if (fence->signaled == gnTrue) return;
fence->device->instance->callingLayer->deviceFunctions._gnWaitForFence(fence, timeout);
}
void gnResetFence(gnFenceHandle fence) {
fence->signaled = gnFalse;
fence->device->instance->callingLayer->deviceFunctions._gnResetFence(fence);
}
void gnDestroyFence(gnFenceHandle fence) {
fence->device->instance->callingLayer->deviceFunctions._gnDestroyFence(fence);
}

View File

@@ -1,21 +0,0 @@
#pragma once
#include "stdint.h"
#include <utils/gryphn_bool.h>
#include "utils/gryphn_error_code.h"
#include "utils/lists/gryphn_array_list.h"
#include "gryphn_handles.h"
#ifdef GN_REVEAL_IMPL
struct gnFence_t {
struct gnPlatformFence_t* fence;
gnOutputDeviceHandle device;
gnBool signaled;
};
#endif
GN_ARRAY_LIST(gnFence);
gnReturnCode gnCreateFence(gnFenceHandle* fence, gnOutputDeviceHandle device);
void gnSignalFence(gnFenceHandle fence);
void gnWaitForFence(gnFenceHandle fence, uint64_t timeout);
void gnResetFence(gnFenceHandle fence);
void gnDestroyFence(gnFenceHandle fence);

View File

@@ -1,12 +0,0 @@
#include "gryphn_semaphore.h"
#include "output_device/gryphn_output_device.h"
#include "instance/gryphn_instance.h"
gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t* device) {
*semaphore = malloc(sizeof(struct gnSemaphore_t));
(*semaphore)->device = device;
return device->instance->callingLayer->deviceFunctions._gnCreateSemaphore((*semaphore), device);
}
void gnDestroySemaphore(struct gnSemaphore_t* semaphore) {
semaphore->device->instance->callingLayer->deviceFunctions._gnDestroySemaphore(semaphore);
}

View File

@@ -1,15 +0,0 @@
#pragma once
#include "utils/gryphn_error_code.h"
#include "utils/lists/gryphn_array_list.h"
#include "gryphn_handles.h"
#ifdef GN_REVEAL_IMPL
struct gnSemaphore_t {
struct gnPlatformSemaphore_t* semaphore;
gnOutputDeviceHandle device;
};
#endif
GN_ARRAY_LIST(gnSemaphore);
gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t* device);
void gnDestroySemaphore(gnSemaphore semaphore);