metal queue submission

This commit is contained in:
Greg Wells
2025-05-31 06:14:33 -04:00
parent eb244447cc
commit 0d02d2e8fc
15 changed files with 120 additions and 35 deletions

View File

@@ -0,0 +1,28 @@
#include "core/submit/gryphn_submit.h"
#include "core/sync/semaphore/metal_semaphore.h"
#include "core/commands/command_buffer/metal_command_buffer.h"
#include "core/debugger/gryphn_debugger.h"
#include "core/commands/command_pool/metal_command_pool.h"
gnReturnCode gnSubmitFn(struct gnOutputDevice_t* device, struct gnSubmitInfo_t info) {
for (int i = 0; i < info.waitCount; i++) {
while (!info.waitSemaphores[i].semaphore->eventTriggered) {}
}
__block gnSemaphore* semsToSignal = info.signalSemaphores;
__block int semsToSignalCount = info.signalCount;
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;
}
}];
[commandBuffer commit];
}
return GN_SUCCESS;
}