command pool+buffer handles

This commit is contained in:
Greg Wells
2025-06-04 22:08:24 -04:00
parent 9faa96d5f5
commit 4349f76ede
11 changed files with 56 additions and 47 deletions

View File

@@ -2,9 +2,9 @@
#include "core/commands/command_pool/metal_command_pool.h"
#import <Metal/Metal.h>
gnReturnCode gnCommandPoolAllocateCommandBuffersFn(struct gnCommandBuffer_t* commandBuffers, uint32_t count, struct gnCommandPool_t* pool) {
gnReturnCode gnCommandPoolAllocateCommandBuffersFn(gnCommandBufferHandle* commandBuffers, uint32_t count, struct gnCommandPool_t* pool) {
for (int i = 0; i < count; i++) {
commandBuffers[i].commandBuffer = malloc(sizeof(gnPlatformCommandBuffer));
commandBuffers[i]->commandBuffer = malloc(sizeof(gnPlatformCommandBuffer));
}
return GN_SUCCESS;

View File

@@ -15,8 +15,8 @@ gnReturnCode gnSubmitFn(struct gnOutputDevice_t* device, struct gnSubmitInfo_t i
__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) {
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;
}