redo some syncronization stuff
This commit is contained in:
@@ -10,5 +10,6 @@ typedef struct gnPlatformFence_t {
|
||||
|
||||
gnReturnCode createMetalFence(gnFence fence, gnDevice device);
|
||||
void waitForMetalFence(gnFence fence, uint64_t timeout);
|
||||
void signalMetalFence(gnFence fence);
|
||||
void resetMetalFence(gnFence fence);
|
||||
void destroyMetalFence(gnFence fence);
|
||||
|
||||
@@ -2,16 +2,20 @@
|
||||
#include "devices/metal_output_devices.h"
|
||||
|
||||
gnReturnCode createMetalFence(gnFence fence, gnDevice device) {
|
||||
if (device == GN_NULL_HANDLE) return GN_INVALID_HANDLE;
|
||||
|
||||
fence->fence = malloc(sizeof(gnPlatformFence));
|
||||
fence->fence->event = [device->outputDevice->device newSharedEvent];
|
||||
fence->fence->currentValue = 0;
|
||||
fence->fence->event = [[device->outputDevice->device newSharedEvent] retain];
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void waitForMetalFence(gnFence fence, uint64_t timeout) {
|
||||
[fence->fence->event waitUntilSignaledValue:fence->fence->currentValue timeoutMS:timeout];
|
||||
[fence->fence->event waitUntilSignaledValue:1 timeoutMS:timeout];
|
||||
}
|
||||
void signalMetalFence(gnFence fence) {
|
||||
[fence->fence->event setSignaledValue:1];
|
||||
}
|
||||
void resetMetalFence(gnFence fence) {
|
||||
fence->fence->currentValue++;
|
||||
[fence->fence->event setSignaledValue:0];
|
||||
}
|
||||
void destroyMetalFence(gnFence fence) {
|
||||
[fence->fence->event release];
|
||||
|
||||
Reference in New Issue
Block a user