Skip to content

Commit

Permalink
lavfi/metal: fix build on pre-10.15 SDKs
Browse files Browse the repository at this point in the history
  • Loading branch information
rcombs committed Dec 23, 2021
1 parent 62ad427 commit 0f77ee9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libavfilter/metal/utils.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
NSUInteger h = pipeline.maxTotalThreadsPerThreadgroup / w;
MTLSize threadsPerThreadgroup = MTLSizeMake(w, h, 1);
BOOL fallback = YES;
// MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc)
#ifdef MAC_OS_X_VERSION_10_15
if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) {
if ([device supportsFamily:MTLGPUFamilyCommon3]) {
MTLSize threadsPerGrid = MTLSizeMake(width, height, 1);
[encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup];
fallback = NO;
}
}
#endif
if (fallback) {
MTLSize threadgroups = MTLSizeMake((width + w - 1) / w,
(height + h - 1) / h,
Expand Down

0 comments on commit 0f77ee9

Please sign in to comment.