diff mbox series

[FFmpeg-devel,06/11] lavfi/metal: simplify fallback

Message ID D2NQZKJWIOMG.3EKZXX29QHLYQ@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/11] avdevice/audiotoolbox: fix mixed declaration and code | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz July 12, 2024, 4:21 p.m. UTC
Instead of using a fallback variable, just do an early return.
---
 libavfilter/metal/utils.m | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

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);