From 20b6624a88a599fec92cceaf7d80b0e1141449cf Mon Sep 17 00:00:00 2001 From: Kimmo Kinnunen Date: Mon, 17 Apr 2023 13:55:09 +0300 Subject: [PATCH] Metal: Support compiling on iOS without EAGL Makes EAGL and CGL compilation exclusive to each other. Catalyst would compile with both on ARM64, but only use EAGL. Remove use of GLSL generation in MSL. Generating GLSL for MSL compute and geometry shaders do not make sense. Remove compilation of RewriteRowMajorMatrices for Metal. It was removed from Metal in: b23bf47c9e999532a684beab9ac901552420b0b8 Reland "Metal: rewrite default uniforms and uniform blocks" Remove use of ANGLE_ENABLE_APPLE_WORKAROUNDS and gn variable angle_enable_apple_translator_workarounds. The workarounds are just unconditional business-as-usual implementation of ANGLE when ANGLE is compile for PLATFORM_APPLE. Fixed: angleproject:8129 Change-Id: I3af249708803fba816e2a7c92c35dddb84ce6946 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4428875 Auto-Submit: Kimmo Kinnunen Reviewed-by: Kyle Piddington Commit-Queue: Kimmo Kinnunen Reviewed-by: Dan Glastonbury Reviewed-by: Kenneth Russell --- BUILD.gn | 7 ++- gni/angle.gni | 3 +- include/platform/FeaturesMtl_autogen.h | 7 --- include/platform/mtl_features.json | 7 --- .../ANGLE_features.json | 4 +- scripts/export_targets.py | 1 - src/compiler.gni | 2 +- .../translator/TranslatorMetalDirect.cpp | 16 ------ .../apple/AddAndTrueToLoopCondition.h | 2 +- .../tree_ops/apple/RewriteDoWhile.h | 2 +- .../tree_ops/apple/RewriteRowMajorMatrices.h | 3 +- .../apple/RewriteUnaryMinusOperatorFloat.h | 2 +- .../tree_ops/apple/UnfoldShortCircuitAST.h | 2 +- src/gpu_info_util/SystemInfo.cpp | 1 - src/gpu_info_util/SystemInfo.h | 2 - src/gpu_info_util/SystemInfo_macos.mm | 4 -- src/libANGLE/Display.cpp | 14 ++++-- src/libANGLE/formatutils.cpp | 18 ++----- .../renderer/gl/apple/DisplayApple_api.cpp | 49 ------------------- .../renderer/gl/apple/DisplayApple_api.h | 22 --------- src/libANGLE/renderer/gl/renderergl_utils.cpp | 18 +++---- src/libANGLE/renderer/metal/BUILD.gn | 8 +-- src/libANGLE/renderer/metal/DisplayMtl.mm | 1 - src/libANGLE/renderer/metal/ShaderMtl.mm | 5 -- src/libGLESv2.gni | 6 +-- 25 files changed, 37 insertions(+), 169 deletions(-) delete mode 100644 src/libANGLE/renderer/gl/apple/DisplayApple_api.cpp delete mode 100644 src/libANGLE/renderer/gl/apple/DisplayApple_api.h diff --git a/BUILD.gn b/BUILD.gn index 8da4a02ce..62674e550 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -678,11 +678,10 @@ template("translator_lib") { _needs_glsl_and_vulkan_base = true sources += angle_translator_glsl_sources defines += [ "ANGLE_ENABLE_GLSL" ] - } - if (angle_enable_apple_translator_workarounds) { - sources += angle_translator_apple_sources - defines += [ "ANGLE_ENABLE_APPLE_WORKAROUNDS" ] + if (is_apple) { + sources += angle_translator_glsl_apple_sources + } } if (angle_enable_hlsl || use_fuzzing_engine) { diff --git a/gni/angle.gni b/gni/angle.gni index 48c73a04c..72012380d 100644 --- a/gni/angle.gni +++ b/gni/angle.gni @@ -287,8 +287,7 @@ declare_args() { angle_enable_cgl = angle_enable_gl && !angle_enable_eagl && is_apple angle_enable_apple_translator_workarounds = - is_apple && - (angle_enable_glsl || angle_enable_metal || use_fuzzing_engine) + is_apple && (angle_enable_glsl || use_fuzzing_engine) angle_has_histograms = angle_has_build diff --git a/include/platform/FeaturesMtl_autogen.h b/include/platform/FeaturesMtl_autogen.h index 8892a4ede..6bf2bf33b 100644 --- a/include/platform/FeaturesMtl_autogen.h +++ b/include/platform/FeaturesMtl_autogen.h @@ -170,13 +170,6 @@ struct FeaturesMtl : FeatureSetBase &members, }; - FeatureInfo rewriteRowMajorMatrices = { - "rewriteRowMajorMatrices", - FeatureCategory::MetalFeatures, - "Rewrite row major matrices in shaders as column major.", - &members, - }; - FeatureInfo intelExplicitBoolCastWorkaround = { "intelExplicitBoolCastWorkaround", FeatureCategory::MetalWorkarounds, diff --git a/include/platform/mtl_features.json b/include/platform/mtl_features.json index 370f594fd..1ab6649ab 100644 --- a/include/platform/mtl_features.json +++ b/include/platform/mtl_features.json @@ -157,13 +157,6 @@ "Turn this on to allow transform feedback in Metal using a 2-pass VS for GLES3." ] }, - { - "name": "rewrite_row_major_matrices", - "category": "Features", - "description": [ - "Rewrite row major matrices in shaders as column major." - ] - }, { "name": "intel_explicit_bool_cast_workaround", "category": "Workarounds", diff --git a/scripts/code_generation_hashes/ANGLE_features.json b/scripts/code_generation_hashes/ANGLE_features.json index 1bc4af110..e6a6469a4 100644 --- a/scripts/code_generation_hashes/ANGLE_features.json +++ b/scripts/code_generation_hashes/ANGLE_features.json @@ -4,7 +4,7 @@ "include/platform/FeaturesGL_autogen.h": "331b1660b3982f6540e362764df26021", "include/platform/FeaturesMtl_autogen.h": - "8ac8af62087b103ce3744d55c18a41f5", + "4c7e4b74b49b88542820b8ab76b131ca", "include/platform/FeaturesVk_autogen.h": "38ce2b494fac31f1b866d75be8330bea", "include/platform/FrontendFeatures_autogen.h": @@ -18,7 +18,7 @@ "include/platform/gl_features.json": "cef92e7ede4c824b8bae37123401d354", "include/platform/mtl_features.json": - "e859b9d81f83924af68a3154ff86463e", + "2472b8a7eb65fc243fc9380b8a1d8dcd", "include/platform/vk_features.json": "bc04d0a45f9ecb1bec30aef49d73b583", "util/angle_features_autogen.cpp": diff --git a/scripts/export_targets.py b/scripts/export_targets.py index f77111ad0..203c70e4d 100755 --- a/scripts/export_targets.py +++ b/scripts/export_targets.py @@ -192,7 +192,6 @@ IGNORED_INCLUDES = { b'libANGLE/renderer/d3d/DeviceD3D.h', b'libANGLE/renderer/d3d/DisplayD3D.h', b'libANGLE/renderer/d3d/RenderTargetD3D.h', - b'libANGLE/renderer/gl/apple/DisplayApple_api.h', b'libANGLE/renderer/gl/cgl/DisplayCGL.h', b'libANGLE/renderer/gl/eagl/DisplayEAGL.h', b'libANGLE/renderer/gl/egl/android/DisplayAndroid.h', diff --git a/src/compiler.gni b/src/compiler.gni index 059103c78..81d5ac116 100644 --- a/src/compiler.gni +++ b/src/compiler.gni @@ -269,7 +269,7 @@ angle_translator_glsl_sources = [ "src/compiler/translator/tree_ops/gl/RewriteRepeatedAssignToSwizzled.cpp", "src/compiler/translator/tree_ops/gl/UseInterfaceBlockFields.cpp", ] -angle_translator_apple_sources = [ +angle_translator_glsl_apple_sources = [ "src/compiler/translator/tree_ops/apple/AddAndTrueToLoopCondition.cpp", "src/compiler/translator/tree_ops/apple/RewriteDoWhile.cpp", "src/compiler/translator/tree_ops/apple/RewriteRowMajorMatrices.cpp", diff --git a/src/compiler/translator/TranslatorMetalDirect.cpp b/src/compiler/translator/TranslatorMetalDirect.cpp index c3cbbe29d..5fffe9504 100644 --- a/src/compiler/translator/TranslatorMetalDirect.cpp +++ b/src/compiler/translator/TranslatorMetalDirect.cpp @@ -8,10 +8,8 @@ #include "angle_gl.h" #include "common/utilities.h" -#include "compiler/translator/BuiltinsWorkaroundGLSL.h" #include "compiler/translator/DriverUniformMetal.h" #include "compiler/translator/ImmutableStringBuilder.h" -#include "compiler/translator/OutputGLSLBase.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/TranslatorMetalDirect/AddExplicitTypeCasts.h" #include "compiler/translator/TranslatorMetalDirect/AstHelpers.h" @@ -43,7 +41,6 @@ #include "compiler/translator/tree_ops/RewriteDfdy.h" #include "compiler/translator/tree_ops/RewriteStructSamplers.h" #include "compiler/translator/tree_ops/SeparateStructFromUniformDeclarations.h" -#include "compiler/translator/tree_ops/apple/RewriteRowMajorMatrices.h" #include "compiler/translator/tree_util/BuiltIn.h" #include "compiler/translator/tree_util/DriverUniform.h" #include "compiler/translator/tree_util/FindFunction.h" @@ -1344,17 +1341,6 @@ bool TranslatorMetalDirect::translateImpl(TInfoSinkBase &sink, return false; } } - else if (getShaderType() == GL_GEOMETRY_SHADER) - { - WriteGeometryShaderLayoutQualifiers( - sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(), - getGeometryShaderOutputPrimitiveType(), getGeometryShaderMaxVertices()); - } - else - { - ASSERT(getShaderType() == GL_COMPUTE_SHADER); - EmitWorkGroupSizeGLSL(*this, sink); - } if (getShaderType() == GL_VERTEX_SHADER) { @@ -1419,8 +1405,6 @@ bool TranslatorMetalDirect::translateImpl(TInfoSinkBase &sink, return false; } - // Note: ReduceInterfaceBlocks removes row_major matrix layout specifiers - // so it must come after RewriteRowMajorMatrices. if (!ReduceInterfaceBlocks(*this, *root, idGen, &getSymbolTable())) { return false; diff --git a/src/compiler/translator/tree_ops/apple/AddAndTrueToLoopCondition.h b/src/compiler/translator/tree_ops/apple/AddAndTrueToLoopCondition.h index 1e4caf1e4..10c5b4c32 100644 --- a/src/compiler/translator/tree_ops/apple/AddAndTrueToLoopCondition.h +++ b/src/compiler/translator/tree_ops/apple/AddAndTrueToLoopCondition.h @@ -17,7 +17,7 @@ namespace sh class TCompiler; class TIntermNode; -#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_ENABLE_APPLE_WORKAROUNDS) +#if ANGLE_ENABLE_GLSL && ANGLE_PLATFORM_APPLE [[nodiscard]] bool AddAndTrueToLoopCondition(TCompiler *compiler, TIntermNode *root); #else [[nodiscard]] ANGLE_INLINE bool AddAndTrueToLoopCondition(TCompiler *compiler, TIntermNode *root) diff --git a/src/compiler/translator/tree_ops/apple/RewriteDoWhile.h b/src/compiler/translator/tree_ops/apple/RewriteDoWhile.h index 067b00060..334d8750f 100644 --- a/src/compiler/translator/tree_ops/apple/RewriteDoWhile.h +++ b/src/compiler/translator/tree_ops/apple/RewriteDoWhile.h @@ -20,7 +20,7 @@ class TCompiler; class TIntermNode; class TSymbolTable; -#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_ENABLE_APPLE_WORKAROUNDS) +#if ANGLE_ENABLE_GLSL && ANGLE_PLATFORM_APPLE [[nodiscard]] bool RewriteDoWhile(TCompiler *compiler, TIntermNode *root, TSymbolTable *symbolTable); diff --git a/src/compiler/translator/tree_ops/apple/RewriteRowMajorMatrices.h b/src/compiler/translator/tree_ops/apple/RewriteRowMajorMatrices.h index d20f1cb42..a94c25165 100644 --- a/src/compiler/translator/tree_ops/apple/RewriteRowMajorMatrices.h +++ b/src/compiler/translator/tree_ops/apple/RewriteRowMajorMatrices.h @@ -18,8 +18,7 @@ class TCompiler; class TIntermBlock; class TSymbolTable; -#if (defined(ANGLE_ENABLE_GLSL) || defined(ANGLE_ENABLE_METAL)) && \ - defined(ANGLE_ENABLE_APPLE_WORKAROUNDS) +#if ANGLE_ENABLE_GLSL && ANGLE_PLATFORM_APPLE [[nodiscard]] bool RewriteRowMajorMatrices(TCompiler *compiler, TIntermBlock *root, TSymbolTable *symbolTable); diff --git a/src/compiler/translator/tree_ops/apple/RewriteUnaryMinusOperatorFloat.h b/src/compiler/translator/tree_ops/apple/RewriteUnaryMinusOperatorFloat.h index 8d3b05409..60d6b97a2 100644 --- a/src/compiler/translator/tree_ops/apple/RewriteUnaryMinusOperatorFloat.h +++ b/src/compiler/translator/tree_ops/apple/RewriteUnaryMinusOperatorFloat.h @@ -16,7 +16,7 @@ namespace sh class TCompiler; class TIntermNode; -#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_ENABLE_APPLE_WORKAROUNDS) +#if ANGLE_ENABLE_GLSL && ANGLE_PLATFORM_APPLE [[nodiscard]] bool RewriteUnaryMinusOperatorFloat(TCompiler *compiler, TIntermNode *root); #else [[nodiscard]] ANGLE_INLINE bool RewriteUnaryMinusOperatorFloat(TCompiler *compiler, diff --git a/src/compiler/translator/tree_ops/apple/UnfoldShortCircuitAST.h b/src/compiler/translator/tree_ops/apple/UnfoldShortCircuitAST.h index 101e04ccd..cf1d101e0 100644 --- a/src/compiler/translator/tree_ops/apple/UnfoldShortCircuitAST.h +++ b/src/compiler/translator/tree_ops/apple/UnfoldShortCircuitAST.h @@ -19,7 +19,7 @@ namespace sh class TCompiler; class TIntermBlock; -#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_ENABLE_APPLE_WORKAROUNDS) +#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE) [[nodiscard]] bool UnfoldShortCircuitAST(TCompiler *compiler, TIntermBlock *root); #else [[nodiscard]] ANGLE_INLINE bool UnfoldShortCircuitAST(TCompiler *compiler, TIntermBlock *root) diff --git a/src/gpu_info_util/SystemInfo.cpp b/src/gpu_info_util/SystemInfo.cpp index 8b0d061a2..a49aadf05 100644 --- a/src/gpu_info_util/SystemInfo.cpp +++ b/src/gpu_info_util/SystemInfo.cpp @@ -368,7 +368,6 @@ void PrintSystemInfo(const SystemInfo &info) std::cout << "Optimus: " << (info.isOptimus ? "true" : "false") << "\n"; std::cout << "AMD Switchable: " << (info.isAMDSwitchable ? "true" : "false") << "\n"; std::cout << "Mac Switchable: " << (info.isMacSwitchable ? "true" : "false") << "\n"; - std::cout << "Needs EAGL on Mac: " << (info.needsEAGLOnMac ? "true" : "false") << "\n"; std::cout << "\n"; if (!info.machineManufacturer.empty()) diff --git a/src/gpu_info_util/SystemInfo.h b/src/gpu_info_util/SystemInfo.h index e85f63b8b..2eab740a6 100644 --- a/src/gpu_info_util/SystemInfo.h +++ b/src/gpu_info_util/SystemInfo.h @@ -78,8 +78,6 @@ struct SystemInfo bool isAMDSwitchable = false; // Only true on dual-GPU Mac laptops. bool isMacSwitchable = false; - // Only true on Apple Silicon Macs when running in macCatalyst. - bool needsEAGLOnMac = false; // Only available on Android std::string machineManufacturer; diff --git a/src/gpu_info_util/SystemInfo_macos.mm b/src/gpu_info_util/SystemInfo_macos.mm index dd5b4d520..aa2645357 100644 --- a/src/gpu_info_util/SystemInfo_macos.mm +++ b/src/gpu_info_util/SystemInfo_macos.mm @@ -391,10 +391,6 @@ bool GetSystemInfo_mac(SystemInfo *info) info->isMacSwitchable = true; } -#if defined(ANGLE_PLATFORM_MACCATALYST) && defined(ANGLE_ENABLE_EAGL) - info->needsEAGLOnMac = true; -#endif - return true; } diff --git a/src/libANGLE/Display.cpp b/src/libANGLE/Display.cpp index e0683745f..970f61b81 100644 --- a/src/libANGLE/Display.cpp +++ b/src/libANGLE/Display.cpp @@ -53,8 +53,10 @@ #if defined(ANGLE_ENABLE_OPENGL) # if defined(ANGLE_PLATFORM_WINDOWS) # include "libANGLE/renderer/gl/wgl/DisplayWGL.h" -# elif defined(ANGLE_PLATFORM_APPLE) -# include "libANGLE/renderer/gl/apple/DisplayApple_api.h" +# elif ANGLE_ENABLE_CGL +# include "libANGLE/renderer/gl/cgl/DisplayCGL.h" +# elif ANGLE_ENABLE_EAGL +# include "libANGLE/renderer/gl/eagl/DisplayEAGL.h" # elif defined(ANGLE_PLATFORM_LINUX) # include "libANGLE/renderer/gl/egl/DisplayEGL.h" # if defined(ANGLE_USE_X11) @@ -342,8 +344,12 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, impl = new rx::DisplayWGL(state); break; -# elif defined(ANGLE_PLATFORM_APPLE) - impl = rx::CreateDisplayCGLOrEAGL(state); +# elif ANGLE_ENABLE_CGL + impl = new rx::DisplayCGL(state); + break; + +# elif ANGLE_ENABLE_EAGL + impl = new rx::DisplayEAGL(state); break; # elif defined(ANGLE_PLATFORM_LINUX) diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp index 648205145..f2845dc9f 100644 --- a/src/libANGLE/formatutils.cpp +++ b/src/libANGLE/formatutils.cpp @@ -1394,21 +1394,9 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() AddRGBAXFormat(&map, GL_RGBA, false, FB< 8, 8, 8, 8, 0, 0>(), GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported, NeverSupported); AddRGBAXFormat(&map, GL_SRGB, false, FB< 8, 8, 8, 0, 0, 0>(), GL_SRGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGBEXT>, AlwaysSupported, NeverSupported, NeverSupported, NeverSupported); AddRGBAXFormat(&map, GL_SRGB_ALPHA_EXT, false, FB< 8, 8, 8, 8, 0, 0>(), GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGBEXT>, AlwaysSupported, RequireExt<&Extensions::sRGBEXT>, NeverSupported, NeverSupported); -#if (ANGLE_PLATFORM_IOS_FAMILY && !ANGLE_PLATFORM_MACCATALYST) || (ANGLE_PLATFORM_MACCATALYST && ANGLE_ENABLE_EAGL) - angle::SystemInfo info; - if (angle::GetSystemInfo(&info)) - { - if (info.needsEAGLOnMac) - { - // Using OpenGLES.framework. - AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, RequireES<2, 0>, NeverSupported, NeverSupported); - } - else - { - // Using OpenGL.framework. - AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888EXT>, AlwaysSupported, RequireExt<&Extensions::textureFormatBGRA8888EXT>, NeverSupported, NeverSupported); - } - } +#if ANGLE_ENABLE_EAGL + // Using OpenGLES.framework. + AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, RequireES<2, 0>, NeverSupported, NeverSupported); #else AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888EXT>, AlwaysSupported, RequireExt<&Extensions::textureFormatBGRA8888EXT>, NeverSupported, NeverSupported); #endif diff --git a/src/libANGLE/renderer/gl/apple/DisplayApple_api.cpp b/src/libANGLE/renderer/gl/apple/DisplayApple_api.cpp deleted file mode 100644 index 2fcd45264..000000000 --- a/src/libANGLE/renderer/gl/apple/DisplayApple_api.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright 2020 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. -// -// DisplayApple_api.cpp: -// Chooses CGL or EAGL either at compile time or runtime based on the platform. -// - -#include "libANGLE/renderer/gl/apple/DisplayApple_api.h" - -#include "gpu_info_util/SystemInfo.h" -#include "libANGLE/renderer/DisplayImpl.h" - -#if defined(ANGLE_ENABLE_CGL) -# include "libANGLE/renderer/gl/cgl/DisplayCGL.h" -#endif -#if defined(ANGLE_ENABLE_EAGL) -# include "libANGLE/renderer/gl/eagl/DisplayEAGL.h" -#endif - -namespace rx -{ - -DisplayImpl *CreateDisplayCGLOrEAGL(const egl::DisplayState &state) -{ -#if defined(ANGLE_ENABLE_EAGL) && defined(ANGLE_ENABLE_CGL) - angle::SystemInfo info; - if (!angle::GetSystemInfo(&info)) - { - return nullptr; - } - - if (info.needsEAGLOnMac) - { - return new rx::DisplayEAGL(state); - } - else - { - return new rx::DisplayCGL(state); - } -#elif defined(ANGLE_ENABLE_CGL) - return new rx::DisplayCGL(state); -#elif defined(ANGLE_ENABLE_EAGL) - return new rx::DisplayEAGL(state); -#endif -} - -} // namespace rx diff --git a/src/libANGLE/renderer/gl/apple/DisplayApple_api.h b/src/libANGLE/renderer/gl/apple/DisplayApple_api.h deleted file mode 100644 index 6c3d7d719..000000000 --- a/src/libANGLE/renderer/gl/apple/DisplayApple_api.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright 2020 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. -// -// DisplayApple_api.h: -// Chooses CGL or EAGL either at compile time or runtime based on the platform. -// - -#ifndef LIBANGLE_RENDERER_GL_APPLE_DISPLAYAPPLE_API_H_ -#define LIBANGLE_RENDERER_GL_APPLE_DISPLAYAPPLE_API_H_ - -#include "libANGLE/renderer/DisplayImpl.h" - -namespace rx -{ - -DisplayImpl *CreateDisplayCGLOrEAGL(const egl::DisplayState &state); - -} // namespace rx - -#endif /* LIBANGLE_RENDERER_GL_APPLE_DISPLAYAPPLE_API_H_ */ diff --git a/src/libANGLE/renderer/gl/renderergl_utils.cpp b/src/libANGLE/renderer/gl/renderergl_utils.cpp index 6b100097d..14ceccc3f 100644 --- a/src/libANGLE/renderer/gl/renderergl_utils.cpp +++ b/src/libANGLE/renderer/gl/renderergl_utils.cpp @@ -1770,18 +1770,14 @@ void GenerateCaps(const FunctionsGL *functions, extensions->compressedETC2RGB8TextureOES || functions->isAtLeastGLES(gl::Version(3, 0)) || functions->hasGLESExtension("GL_EXT_compressed_ETC1_RGB8_sub_texture"); -#if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) - angle::SystemInfo info; - if (angle::GetSystemInfo(&info) && !info.needsEAGLOnMac) +#if ANGLE_ENABLE_CGL + VendorID vendor = GetVendorID(functions); + if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0)) { - VendorID vendor = GetVendorID(functions); - if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0)) - { - // Apple Intel/AMD drivers do not correctly use the TEXTURE_SRGB_DECODE property of - // sampler states. Disable this extension when we would advertise any ES version - // that has samplers. - extensions->textureSRGBDecodeEXT = false; - } + // Apple Intel/AMD drivers do not correctly use the TEXTURE_SRGB_DECODE property of + // sampler states. Disable this extension when we would advertise any ES version + // that has samplers. + extensions->textureSRGBDecodeEXT = false; } #endif diff --git a/src/libANGLE/renderer/metal/BUILD.gn b/src/libANGLE/renderer/metal/BUILD.gn index b14efdb57..bb2adc1dd 100644 --- a/src/libANGLE/renderer/metal/BUILD.gn +++ b/src/libANGLE/renderer/metal/BUILD.gn @@ -46,13 +46,13 @@ angle_source_set("angle_metal_backend") { cflags_objc += objc_flags cflags_objcc += objc_flags - if (is_mac) { + if (is_apple) { frameworks = [ - "Cocoa.framework", "IOSurface.framework", "QuartzCore.framework", ] + if (is_mac) { + frameworks += [ "Cocoa.framework" ] + } } - - # TODO(hqle): iOS support. } diff --git a/src/libANGLE/renderer/metal/DisplayMtl.mm b/src/libANGLE/renderer/metal/DisplayMtl.mm index 260b486c4..95b596dfa 100644 --- a/src/libANGLE/renderer/metal/DisplayMtl.mm +++ b/src/libANGLE/renderer/metal/DisplayMtl.mm @@ -1250,7 +1250,6 @@ void DisplayMtl::initializeFeatures() ANGLE_FEATURE_CONDITION((&mFeatures), allowSeparateDepthStencilBuffers, !isOSX && !isCatalyst && !isSimulator); - ANGLE_FEATURE_CONDITION((&mFeatures), rewriteRowMajorMatrices, true); ANGLE_FEATURE_CONDITION((&mFeatures), emulateTransformFeedback, true); ANGLE_FEATURE_CONDITION((&mFeatures), intelExplicitBoolCastWorkaround, diff --git a/src/libANGLE/renderer/metal/ShaderMtl.mm b/src/libANGLE/renderer/metal/ShaderMtl.mm index 1bcff9132..029b6f2d2 100644 --- a/src/libANGLE/renderer/metal/ShaderMtl.mm +++ b/src/libANGLE/renderer/metal/ShaderMtl.mm @@ -123,11 +123,6 @@ std::shared_ptr ShaderMtl::compile(const gl::Context *cont options->clampFragDepth = true; #endif - if (displayMtl->getFeatures().rewriteRowMajorMatrices.enabled) - { - options->rewriteRowMajorMatrices = true; - } - if (displayMtl->getFeatures().emulateAlphaToCoverage.enabled) { options->emulateAlphaToCoverage = true; diff --git a/src/libGLESv2.gni b/src/libGLESv2.gni index 54bc55f88..b5efa0d5f 100644 --- a/src/libGLESv2.gni +++ b/src/libGLESv2.gni @@ -562,11 +562,7 @@ libangle_cl_sources = [ "src/libANGLE/validationCL.cpp", ] -libangle_mac_sources = [ - "src/libANGLE/renderer/driver_utils_mac.mm", - "src/libANGLE/renderer/gl/apple/DisplayApple_api.cpp", - "src/libANGLE/renderer/gl/apple/DisplayApple_api.h", -] +libangle_mac_sources = [ "src/libANGLE/renderer/driver_utils_mac.mm" ] # The frame capture headers are always visible to libANGLE. libangle_sources += [