metal sync extension

This commit is contained in:
Greg Wells
2025-07-09 21:37:22 -04:00
parent 8d0b9ce8bd
commit 7d22da040a
14 changed files with 109 additions and 21 deletions

View File

@@ -3,6 +3,7 @@
#include "commands/command_buffer/metal_command_buffer.h"
#include "debugger/gryphn_debugger.h"
#include "commands/command_pool/metal_command_pool.h"
#include "sync/fence/gryphn_fence.h"
#include "synchronization/commands/gryphn_sync_submit.h"
gnReturnCode metalSyncSubmit(gnOutputDevice device, gnSubmitSyncInfo info);
gnReturnCode metalSubmit(gnOutputDevice device, gnSubmitInfo info);

View File

@@ -1,6 +1,7 @@
#include "metal_submit.h"
#include "synchronization/fence/gryphn_fence.h"
gnReturnCode metalSubmit(gnOutputDevice device, gnSubmitInfo info) {
gnReturnCode metalSyncSubmit(gnOutputDevice device, gnSubmitSyncInfo info) {
for (int i = 0; i < info.waitCount; i++) {
while (!info.waitSemaphores[i]->semaphore->eventTriggered) {}
}
@@ -23,3 +24,13 @@ gnReturnCode metalSubmit(gnOutputDevice device, gnSubmitInfo info) {
return GN_SUCCESS;
}
gnReturnCode metalSubmit(gnOutputDevice device, gnSubmitInfo info) {
for (int i = 0; i < info.commandBufferCount; i++) {
id<MTLCommandBuffer> commandBuffer = info.commandBuffers[i]->commandBuffer->commandBuffer;
[commandBuffer commit];
}
[info.commandBuffers[info.commandBufferCount - 1]->commandBuffer->commandBuffer waitUntilCompleted];
return GN_SUCCESS;
}