From 2609e02c9a30a1ad5ec1230a62f25e11fce46d75 Mon Sep 17 00:00:00 2001 From: Alexey Knyazev Date: Tue, 20 Aug 2024 00:00:00 +0000 Subject: [PATCH] Metal: Remove unused branches from StartFrameCapture The used APIs are supported on all deployment targets. Bug: angleproject:360147119 Change-Id: Ieaa8662e97b71e97bdab3cd0f5c5ef6db3d1b305 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5817150 Reviewed-by: Kimmo Kinnunen Commit-Queue: Alexey Knyazev Reviewed-by: Geoff Lang --- src/libANGLE/renderer/metal/mtl_utils.mm | 67 +++++++++--------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/src/libANGLE/renderer/metal/mtl_utils.mm b/src/libANGLE/renderer/metal/mtl_utils.mm index 2265bb0be8c..299bd710627 100644 --- a/src/libANGLE/renderer/metal/mtl_utils.mm +++ b/src/libANGLE/renderer/metal/mtl_utils.mm @@ -188,51 +188,34 @@ void StartFrameCapture(id metalDevice, id metalCmdQu return; } -# ifdef __MAC_10_15 - if (ANGLE_APPLE_AVAILABLE_XCI(10.15, 13.1, 13)) - { - auto captureDescriptor = mtl::adoptObjCObj([[MTLCaptureDescriptor alloc] init]); - captureDescriptor.get().captureObject = metalDevice; - const std::string filePath = GetMetalCaptureFile(); - NSString *frameCapturePath = nil; - if (filePath != "") - { - frameCapturePath = - [NSString stringWithFormat:@"%s%zu.gputrace", filePath.c_str(), gFrameCaptured - 1]; - captureDescriptor.get().destination = MTLCaptureDestinationGPUTraceDocument; - captureDescriptor.get().outputURL = [NSURL fileURLWithPath:frameCapturePath - isDirectory:false]; - } - else - { - // This will pause execution only if application is being debugged inside Xcode - captureDescriptor.get().destination = MTLCaptureDestinationDeveloperTools; - } - - NSError *error; - if ([captureManager startCaptureWithDescriptor:captureDescriptor.get() error:&error]) - { - ASSERT(!gFrameCapturePath); - gFrameCapturePath = frameCapturePath; - } - else - { - NSLog(@"Failed to start capture, error %@", error); - } + auto captureDescriptor = mtl::adoptObjCObj([[MTLCaptureDescriptor alloc] init]); + captureDescriptor.get().captureObject = metalDevice; + const std::string filePath = GetMetalCaptureFile(); + NSString *frameCapturePath = nil; + if (filePath != "") + { + frameCapturePath = + [NSString stringWithFormat:@"%s%zu.gputrace", filePath.c_str(), gFrameCaptured - 1]; + captureDescriptor.get().destination = MTLCaptureDestinationGPUTraceDocument; + captureDescriptor.get().outputURL = [NSURL fileURLWithPath:frameCapturePath + isDirectory:false]; } else -# endif // __MAC_10_15 - if (ANGLE_APPLE_AVAILABLE_XCI(10.15, 13.1, 13)) - { - auto captureDescriptor = mtl::adoptObjCObj([[MTLCaptureDescriptor alloc] init]); - captureDescriptor.get().captureObject = metalDevice; + { + // This will pause execution only if application is being debugged inside Xcode + captureDescriptor.get().destination = MTLCaptureDestinationDeveloperTools; + } - NSError *error; - if (![captureManager startCaptureWithDescriptor:captureDescriptor.get() error:&error]) - { - NSLog(@"Failed to start capture, error %@", error); - } - } + NSError *error; + if ([captureManager startCaptureWithDescriptor:captureDescriptor.get() error:&error]) + { + ASSERT(!gFrameCapturePath); + gFrameCapturePath = frameCapturePath; + } + else + { + NSLog(@"Failed to start capture, error %@", error); + } #endif // ANGLE_METAL_FRAME_CAPTURE_ENABLED }