Skip to content

Commit

Permalink
Metal: Remove unused branches from StartFrameCapture
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Alexey Knyazev <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
  • Loading branch information
lexaknyazev authored and Angle LUCI CQ committed Aug 27, 2024
1 parent 8cfb9ea commit 2609e02
Showing 1 changed file with 25 additions and 42 deletions.
67 changes: 25 additions & 42 deletions src/libANGLE/renderer/metal/mtl_utils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -188,51 +188,34 @@ void StartFrameCapture(id<MTLDevice> metalDevice, id<MTLCommandQueue> 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
}

Expand Down

0 comments on commit 2609e02

Please sign in to comment.