get all the commands to work
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -6,3 +6,6 @@ typedef struct gnPlatformSemaphore_t {
|
||||
id<MTLEvent> event;
|
||||
bool eventTriggered;
|
||||
} gnPlatformSemaphore;
|
||||
|
||||
gnReturnCode createMetalSemaphore(gnSemaphore semaphore, gnOutputDevice device);
|
||||
void destroyMetalSemaphore(gnSemaphore semaphore);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user