kinda a metal semaphore class

This commit is contained in:
Greg Wells
2025-05-30 11:21:49 -04:00
parent b00bd732a3
commit 27b9405eea
2 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
#pragma once
#include "core/sync/semaphore/gryphn_semaphore.h"
#import <Metal/MTLEvent.h>
typedef struct gnPlatformSemaphore_t {
id<MTLEvent> event;
} gnPlatformSemaphore;

View File

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