Edit

kc3-lang/angle/src/tests/test_utils/angle_test_instantiate_apple.mm

Branch :

  • Show log

    Commit

  • Author : Kenneth Russell
    Date : 2022-07-21 16:40:59
    Hash : 448e2275
    Message : (Reland) [Metal] Disable ANGLE's Metal backend on older GPUs. Disable creation of EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE displays on: iOS: MTLGPUFamilyApple2 and older (A8 and older GPUs) macOS and Mac Catalyst: MTLGPUFamilyMac1 and older This is a partial integration of this recent WebKit fix: https://bugs.webkit.org/show_bug.cgi?id=242764 Refactored to eliminate duplicate copies of this code between libANGLE and the test suites. Changes since initial landing: - Explicitly link the angle_common static library against Metal.framework for the definition of MTLCreateSystemDefaultDevice, which was missing on the iOS Simulator. Fixed: angleproject:7514 Change-Id: I25028a298f1235db5b717ac6a1999552121d60c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3806252 Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>

  • src/tests/test_utils/angle_test_instantiate_apple.mm
  • //
    // Copyright 2019 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // This file includes APIs to detect whether certain Apple renderer is available for testing.
    //
    
    #include "test_utils/angle_test_instantiate_apple.h"
    
    #include "common/apple_platform_utils.h"
    #include "test_utils/angle_test_instantiate.h"
    
    namespace angle
    {
    
    bool IsMetalTextureSwizzleAvailable()
    {
        // NOTE(hqle): This might not be accurate, since the capabilities also depend on underlying
        // hardwares, however, it is OK for testing.
        if (ANGLE_APPLE_AVAILABLE_XCI(10.15, 13.0, 13))
        {
            // All NVIDIA and older Intel don't support swizzle because they are GPU family 1.
            // We don't have a way to detect Metal family here, so skip all Intel for now.
            return !IsIntel() && !IsNVIDIA();
        }
        return false;
    }
    
    bool IsMetalCompressedTexture3DAvailable()
    {
        if (ANGLE_APPLE_AVAILABLE_XCI(10.15, 13.0, 13.0))
        {
            return true;
        }
        return false;
    }
    
    }  // namespace angle