get all the commands to work

This commit is contained in:
Greg Wells
2025-06-29 14:40:09 -04:00
parent 67e5e6e36a
commit 8211876837
37 changed files with 295 additions and 154 deletions

View File

@@ -3,6 +3,10 @@
#import <Metal/Metal.h>
#import <Metal/MTLEvent.h>
typedef struct gnPlatformFence_t {
typedef struct gnPlatformFence_t {} gnPlatformFence;
} gnPlatformFence;
gnReturnCode createMetalFence(gnFence fence, gnDevice device);
void singalMetalFence(gnFence fence);
void waitForMetalFence(gnFence fence, uint64_t timeout);
void resetMetalFence(gnFence fence);
void destroyMetalFence(gnFence fence);

View File

@@ -1,7 +1,7 @@
#include "metal_fence.h"
#include "devices/metal_output_devices.h"
gnReturnCode gnCreateFenceFn(struct gnFence_t* fence, struct gnOutputDevice_t* device) {
gnReturnCode createMetalFence(gnFence fence, struct gnOutputDevice_t* device) {
// fence->fence = malloc(sizeof(gnPlatformFence));
// fence->fence->fence = [device->outputDevice->device newSharedEvent];
@@ -10,14 +10,14 @@ gnReturnCode gnCreateFenceFn(struct gnFence_t* fence, struct gnOutputDevice_t* d
return GN_SUCCESS;
}
void gnSignalFenceFn(struct gnFence_t* fence) {
void singalMetalFence(gnFence fence) {
// dispatch_semaphore_signal(fence->fence->semaphore);
}
void gnWaitForFenceFn(struct gnFence_t* fence, uint64_t timeout) {
void waitForMetalFence(gnFence fence, uint64_t timeout) {
// dispatch_semaphore_wait(fence->fence->semaphore, timeout);
while (fence->signaled == gnFalse) {}
}
void gnResetFenceFn(struct gnFence_t* fence) {
void resetMetalFence(gnFence fence) {
// dispatch_semaphore_signal(fence->fence->semaphore);
// [fence->fence->fence setSignaledValue:0];
// [fence->fence->fence notifyListener:fence->fence->listener
@@ -26,7 +26,7 @@ void gnResetFenceFn(struct gnFence_t* fence) {
// dispatch_semaphore_signal(fence->fence->semaphore);
// }];
}
void gnDestroyFenceFn(struct gnFence_t* fence) {
void destroyMetalFence(gnFence fence) {
// [fence->fence->fence release];
// [fence->fence->listener release];
// free(fence->fence);

View File

@@ -6,3 +6,6 @@ typedef struct gnPlatformSemaphore_t {
id<MTLEvent> event;
bool eventTriggered;
} gnPlatformSemaphore;
gnReturnCode createMetalSemaphore(gnSemaphore semaphore, gnOutputDevice device);
void destroyMetalSemaphore(gnSemaphore semaphore);

View File

@@ -1,13 +1,13 @@
#include "metal_semaphore.h"
#include "devices/metal_output_devices.h"
gnReturnCode gnCreateSemaphoreFn(gnSemaphore semaphore, gnOutputDevice device) {
gnReturnCode createMetalSemaphore(gnSemaphore semaphore, gnOutputDevice device) {
semaphore->semaphore = malloc(sizeof(gnPlatformSemaphore));
semaphore->semaphore->event = [device->outputDevice->device newEvent];
return GN_SUCCESS;
}
void gnDestroySemaphoreFn(gnSemaphore semaphore) {
void destroyMetalSemaphore(gnSemaphore semaphore) {
[semaphore->semaphore->event release];
free(semaphore->semaphore);
}