[FFmpeg-devel] [PATCH 06/11] lavfi/metal: simplify fallback
Marvin Scholz
epirat07 at gmail.com
Fri Jul 12 19:21:21 EEST 2024
Instead of using a fallback variable, just do an early return.
---
libavfilter/metal/utils.m | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m
index d5c85e619d..6a9e5ef7cf 100644
--- a/libavfilter/metal/utils.m
+++ b/libavfilter/metal/utils.m
@@ -24,7 +24,6 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
id<MTLComputeCommandEncoder> encoder,
NSUInteger width, NSUInteger height)
{
- BOOL fallback = YES;
MTLSize threadsPerThreadgroup;
NSUInteger w, h;
@@ -39,11 +38,13 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
if ([device supportsFamily:MTLGPUFamilyCommon3]) {
MTLSize threadsPerGrid = MTLSizeMake(width, height, 1);
[encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup];
- fallback = NO;
+ return;
}
}
#endif
- if (fallback) {
+
+ // Fallback path, if we took the above one we already returned so none of this is reached
+ {
MTLSize threadgroups = MTLSizeMake((width + w - 1) / w,
(height + h - 1) / h,
1);
--
2.39.3 (Apple Git-146)
More information about the ffmpeg-devel
mailing list