sync primative handles
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
#include "core/texture/metal_texture.h"
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) {
|
||||
gnReturnCode gnPresentFn(gnOutputDeviceHandle device, struct gnPresentInfo_t info) {
|
||||
for (int i = 0; i < info.waitCount; i++) {
|
||||
while (!info.waitSemaphores[i].semaphore->eventTriggered) {}
|
||||
while (!info.waitSemaphores[i]->semaphore->eventTriggered) {}
|
||||
}
|
||||
|
||||
for (int i =0 ; i < info.presentationQueueCount; i++) {
|
||||
|
@@ -6,19 +6,19 @@
|
||||
|
||||
gnReturnCode gnSubmitFn(struct gnOutputDevice_t* device, struct gnSubmitInfo_t info) {
|
||||
for (int i = 0; i < info.waitCount; i++) {
|
||||
while (!info.waitSemaphores[i].semaphore->eventTriggered) {}
|
||||
while (!info.waitSemaphores[i]->semaphore->eventTriggered) {}
|
||||
}
|
||||
|
||||
|
||||
__block gnSemaphore* semsToSignal = info.signalSemaphores;
|
||||
__block int semsToSignalCount = info.signalCount;
|
||||
__block gnFence* fenceToSignal = info.fence;
|
||||
__block gnFence fenceToSignal = info.fence;
|
||||
|
||||
for (int i = 0; i < info.commandBufferCount; i++) {
|
||||
id<MTLCommandBuffer> commandBuffer = info.commandBuffers[i]->commandBuffer->commandBuffer;
|
||||
[info.commandBuffers[i]->commandBuffer->commandBuffer addCompletedHandler:^(id<MTLCommandBuffer> buffer) {
|
||||
for (int c = 0; c < semsToSignalCount; c++) {
|
||||
semsToSignal[c].semaphore->eventTriggered = gnTrue;
|
||||
semsToSignal[c]->semaphore->eventTriggered = gnTrue;
|
||||
}
|
||||
}];
|
||||
fenceToSignal->signaled = gnTrue;
|
||||
|
@@ -4,5 +4,5 @@
|
||||
|
||||
typedef struct gnPlatformSemaphore_t {
|
||||
id<MTLEvent> event;
|
||||
gnBool eventTriggered;
|
||||
bool eventTriggered;
|
||||
} gnPlatformSemaphore;
|
||||
|
Reference in New Issue
Block a user