From bacd053b6a2e7ab287b18ed089cc7bcc092fd659 Mon Sep 17 00:00:00 2001 From: Gregory Wells Date: Tue, 5 Aug 2025 16:40:07 -0400 Subject: [PATCH] fixed some random crashes --- .../src/pipelines/graphics_pipeline/metal_graphics_pipeline.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/apis/metal/src/pipelines/graphics_pipeline/metal_graphics_pipeline.m b/projects/apis/metal/src/pipelines/graphics_pipeline/metal_graphics_pipeline.m index 5d86749..6449e5d 100644 --- a/projects/apis/metal/src/pipelines/graphics_pipeline/metal_graphics_pipeline.m +++ b/projects/apis/metal/src/pipelines/graphics_pipeline/metal_graphics_pipeline.m @@ -50,7 +50,7 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn mtlSubpass subpass = info.renderPassDescriptor->renderPassDescriptor->subpasses[info.subpassIndex]; mtlSubpassCopyInfo copyInfo = info.renderPassDescriptor->renderPassDescriptor->copyInfos[info.subpassIndex]; for (uint32_t i = 0; i < copyInfo.colorAttachmentCount; i++) { - descriptor.colorAttachments[i].pixelFormat = copyInfo.colorAttachments[i].format; + [descriptor.colorAttachments objectAtIndexedSubscript:i].pixelFormat = copyInfo.colorAttachments[i].format; if (info.colorBlending.enable == GN_TRUE) { [descriptor.colorAttachments objectAtIndexedSubscript:i].blendingEnabled = YES; [descriptor.colorAttachments objectAtIndexedSubscript:i].rgbBlendOperation = mtlGryphnBlendOperation(info.colorBlending.colorBlendOperation); @@ -85,7 +85,6 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){ .message = gnCombineStrings(gnCreateString("Failed to compile metal library "), errorString) }); - [shaderLib release]; free((void*)shaderCode); return GN_FAILED_CREATE_OBJECT; } @@ -134,7 +133,6 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn graphicsPipeline->graphicsPipeline->graphicsPipeline = [device->outputDevice->device newRenderPipelineStateWithDescriptor:descriptor error:&error]; [descriptor release]; [vertexDescriptor release]; - [error release]; if (graphicsPipeline->graphicsPipeline->graphicsPipeline == nil) return GN_FAILED_CREATE_OBJECT; return GN_SUCCESS; }