just create transfer queue for metal
This commit is contained in:
@@ -8,11 +8,12 @@
|
||||
gnReturnCode gnCreateOutputDeviceFn(gnOutputDeviceHandle outputDevice, gnInstanceHandle instance, struct gnOutputDeviceInfo_t deviceInfo) {
|
||||
outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice));
|
||||
outputDevice->outputDevice->device = deviceInfo.physicalDevice.physicalDevice->device.retain;
|
||||
outputDevice->outputDevice->queueCount = deviceInfo.queueInfoCount;
|
||||
outputDevice->outputDevice->queues = malloc(sizeof(id<MTLCommandQueue>) * deviceInfo.queueInfoCount);
|
||||
for (int i = 0; i < deviceInfo.queueInfoCount; i++) {
|
||||
outputDevice->outputDevice->queues[i] = outputDevice->outputDevice->device.newCommandQueue;
|
||||
}
|
||||
outputDevice->outputDevice->transferQueue = outputDevice->outputDevice->device.newCommandQueue;
|
||||
// outputDevice->outputDevice->queueCount = deviceInfo.queueInfoCount;
|
||||
// outputDevice->outputDevice->queues = malloc(sizeof(id<MTLCommandQueue>) * deviceInfo.queueInfoCount);
|
||||
// for (int i = 0; i < deviceInfo.queueInfoCount; i++) {
|
||||
// outputDevice->outputDevice->queues[i] = outputDevice->outputDevice->device.newCommandQueue;
|
||||
// }
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
@@ -22,9 +23,10 @@ void gnWaitForDeviceFn(gnOutputDeviceHandle device) {
|
||||
}
|
||||
|
||||
void gnDestroyOutputDeviceFn(gnOutputDeviceHandle device) {
|
||||
for (int i = 0; i < device->outputDevice->queueCount; i++) {
|
||||
[device->outputDevice->queues[i] release];
|
||||
}
|
||||
// for (int i = 0; i < device->outputDevice->queueCount; i++) {
|
||||
// [device->outputDevice->queues[i] release];
|
||||
// }
|
||||
[device->outputDevice->transferQueue release];
|
||||
[device->outputDevice->device release];
|
||||
free(device->outputDevice);
|
||||
}
|
||||
|
@@ -12,10 +12,7 @@ struct gnPlatformOutputDevice_t {
|
||||
id<MTLDevice> device;
|
||||
MTKView* contentView;
|
||||
|
||||
int queueCount;
|
||||
id<MTLCommandQueue>* queues;
|
||||
|
||||
id<MTLCommandBuffer> executingCommandBuffer;
|
||||
|
||||
id<MTLRenderPipelineState> framebuffer;
|
||||
id<MTLCommandQueue> transferQueue;
|
||||
// id<MTLRenderPipelineState> framebuffer;
|
||||
} gnPlatformOutputDevice;
|
||||
|
@@ -20,7 +20,7 @@ gnReturnCode gnPresentFn(gnOutputDeviceHandle device, struct gnPresentInfo_t inf
|
||||
return GN_FAILED_TO_CREATE_FRAMEBUFFER;
|
||||
}
|
||||
|
||||
id<MTLCommandBuffer> commandBuffer = [device->outputDevice->queues[info.queueIndex] commandBuffer];
|
||||
id<MTLCommandBuffer> commandBuffer = [device->outputDevice->transferQueue commandBuffer];
|
||||
|
||||
MTLRenderPassDescriptor* passDesc = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||
passDesc.colorAttachments[0].texture = drawable.texture;
|
||||
|
Reference in New Issue
Block a user