diff --git a/rendering_api/metal/src/core/devices/metal_output_device.m b/rendering_api/metal/src/core/devices/metal_output_device.m index 51aa72a..5f85f92 100644 --- a/rendering_api/metal/src/core/devices/metal_output_device.m +++ b/rendering_api/metal/src/core/devices/metal_output_device.m @@ -8,92 +8,19 @@ gnReturnCode gnCreateOutputDeviceFn(gnOutputDevice* outputDevice, gnInstance* 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) * deviceInfo.queueInfoCount); - for (int i = 0; i < deviceInfo.queueInfoCount; i++) { - outputDevice->outputDevice->queues[i] = outputDevice->outputDevice->device.newCommandQueue; - } - - // { - // NSError* error = nil; - // MTLCompileOptions* options = nil; - // NSString *shaderSource = @"#include \ - // using namespace metal;\ - // struct VertexOut {\ - // float4 position [[position]];\ - // float2 uv;\ - // };\ - // vertex VertexOut vs_main(uint vertexID [[vertex_id]]) {\ - // float2 positions[4] = {\ - // {-1.0, -1.0},\ - // { 1.0, -1.0},\ - // {-1.0, 1.0},\ - // { 1.0, 1.0}\ - // };\ - // float2 uvs[4] = {\ - // {0.0, 1.0},\ - // {1.0, 1.0},\ - // {0.0, 0.0},\ - // {1.0, 0.0}\ - // };\ - // VertexOut out;\ - // out.position = float4(positions[vertexID], 0.0, 1.0);\ - // out.uv = uvs[vertexID];\ - // return out;\ - // }\ - // fragment float4 fs_main(VertexOut in [[stage_in]],\ - // texture2d colorTex [[texture(0)]],\ - // sampler samp [[sampler(0)]]) {\ - // return colorTex.sample(samp, in.uv);\ - // }\ - // "; - // id library = [outputDevice->outputDevice->device newLibraryWithSource:shaderSource options:nil error:&error]; - - // if (!library) { - // gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ - // .message = gnCreateString("Failed to compile framebuffer shader") - // }); - // return GN_FAILED_TO_CREATE_DEVICE; - // } - // // id vs = library->newFunction(NS::String::string("vs_main", NS::UTF8StringEncoding)); - // id vs = [library newFunctionWithName:@"vs_main"]; - // id fs = [library newFunctionWithName:@"fs_main"]; - - // if (vs == nil) { - // gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ - // .message = gnCreateString("Failed to compile frambuffer vertex shader") - // }); - // return GN_FAILED_TO_CREATE_DEVICE; - // } - - // if (fs == nil) { - // gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ - // .message = gnCreateString("Failed to compile frambuffer fragment shader") - // }); - // return GN_FAILED_TO_CREATE_DEVICE; - // } - - // MTLRenderPipelineDescriptor* pipelineDesc =[[MTLRenderPipelineDescriptor alloc] init];; - // pipelineDesc.vertexFunction = vs; - // pipelineDesc.fragmentFunction = fs; - // pipelineDesc.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm_sRGB; - - // outputDevice->outputDevice->framebuffer = [outputDevice->outputDevice->device newRenderPipelineStateWithDescriptor:pipelineDesc error:&error]; - // if (!outputDevice->outputDevice->framebuffer) { - // gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ - // .message = gnCreateString("Failed to create frambuffer render pipeline") - // }); - // return GN_FAILED_TO_CREATE_DEVICE; - // } + // outputDevice->outputDevice->queueCount = deviceInfo.queueInfoCount; + // outputDevice->outputDevice->queues = malloc(sizeof(id) * deviceInfo.queueInfoCount); + // for (int i = 0; i < deviceInfo.queueInfoCount; i++) { + // outputDevice->outputDevice->queues[i] = outputDevice->outputDevice->device.newCommandQueue; // } return GN_SUCCESS; } void gnDestroyOutputDeviceFn(gnOutputDevice* 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->device release]; free(device->outputDevice); }