Commit dea86294 by James Darpinian Committed by Commit Bot

iOS build support

libGLESv2 builds with these changes on iOS, iOS Simulator, and Mac Catalyst, using CGL or EAGL as appropriate. Tests will require more work. Fixed several errors in the EAGL code which hadn't been detected because the code wasn't built. Bug: angleproject:4256 Bug: angleproject:5417 Change-Id: I29072d82607ef2500732c5cc00318fdab4a46b31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2570211Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: James Darpinian <jdarpinian@chromium.org>
parent 4277f2f0
...@@ -169,7 +169,6 @@ config("extra_warnings") { ...@@ -169,7 +169,6 @@ config("extra_warnings") {
cflags += [ cflags += [
"-Wbad-function-cast", "-Wbad-function-cast",
"-Wconditional-uninitialized", "-Wconditional-uninitialized",
"-Wdeprecated-copy",
"-Wextra-semi-stmt", "-Wextra-semi-stmt",
"-Wfloat-conversion", "-Wfloat-conversion",
"-Winconsistent-missing-destructor-override", "-Winconsistent-missing-destructor-override",
...@@ -179,8 +178,6 @@ config("extra_warnings") { ...@@ -179,8 +178,6 @@ config("extra_warnings") {
"-Wredundant-parens", "-Wredundant-parens",
"-Wreturn-std-move-in-c++11", "-Wreturn-std-move-in-c++11",
"-Wshadow-field", "-Wshadow-field",
"-Wsuggest-destructor-override",
"-Wsuggest-override",
"-Wtautological-type-limit-compare", "-Wtautological-type-limit-compare",
"-Wundefined-reinterpret-cast", "-Wundefined-reinterpret-cast",
"-Wunneeded-internal-declaration", "-Wunneeded-internal-declaration",
...@@ -194,6 +191,14 @@ config("extra_warnings") { ...@@ -194,6 +191,14 @@ config("extra_warnings") {
"-Wunreachable-code", "-Wunreachable-code",
"-Wshorten-64-to-32", "-Wshorten-64-to-32",
] ]
if (!use_xcode_clang) {
# Mac catalyst uses a clang version that doesn't have these.
cflags += [
"-Wdeprecated-copy",
"-Wsuggest-destructor-override",
"-Wsuggest-override",
]
}
} }
if (angle_is_winuwp) { if (angle_is_winuwp) {
...@@ -435,14 +440,23 @@ angle_static_library("angle_gpu_info_util") { ...@@ -435,14 +440,23 @@ angle_static_library("angle_gpu_info_util") {
libs += [ "pci" ] libs += [ "pci" ]
} }
if (is_mac) { if (is_mac || is_ios) {
sources += libangle_gpu_info_util_mac_sources
frameworks = [ frameworks = [
"IOKit.framework", "IOKit.framework",
"CoreFoundation.framework", "CoreFoundation.framework",
"CoreGraphics.framework", "CoreGraphics.framework",
"OpenGL.framework",
] ]
if (angle_enable_eagl) {
frameworks += [ "OpenGLES.framework" ]
} else if (angle_enable_cgl) {
frameworks += [ "OpenGL.framework" ]
}
if (is_mac || angle_enable_cgl) {
sources += libangle_gpu_info_util_mac_sources
}
if (is_ios && !angle_enable_cgl) {
sources += libangle_gpu_info_util_ios_sources
}
} }
} }
...@@ -732,11 +746,11 @@ angle_source_set("libANGLE_base") { ...@@ -732,11 +746,11 @@ angle_source_set("libANGLE_base") {
} }
# Enable extra Chromium style warnings for libANGLE. # Enable extra Chromium style warnings for libANGLE.
if (is_clang && angle_has_build) { if (is_clang && angle_has_build && !use_xcode_clang) {
suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ] suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
} }
if (is_mac) { if (is_mac || is_ios) {
sources += libangle_mac_sources sources += libangle_mac_sources
} }
...@@ -835,7 +849,7 @@ angle_source_set("libANGLE_with_capture") { ...@@ -835,7 +849,7 @@ angle_source_set("libANGLE_with_capture") {
} }
config("shared_library_public_config") { config("shared_library_public_config") {
if (is_mac && !is_component_build) { if ((is_ios || is_mac) && !is_component_build) {
# Executable targets that depend on the shared libraries below need to have # Executable targets that depend on the shared libraries below need to have
# the rpath setup in non-component build configurations. # the rpath setup in non-component build configurations.
ldflags = [ ldflags = [
...@@ -1125,7 +1139,7 @@ if (angle_has_build) { ...@@ -1125,7 +1139,7 @@ if (angle_has_build) {
"${angle_jsoncpp_dir}:jsoncpp_config", "${angle_jsoncpp_dir}:jsoncpp_config",
] ]
if (is_mac && !is_component_build) { if ((is_ios || is_mac) && !is_component_build) {
ldflags = [ ldflags = [
"-install_name", "-install_name",
"@rpath/${target_name}.dylib", "@rpath/${target_name}.dylib",
......
...@@ -145,9 +145,17 @@ declare_args() { ...@@ -145,9 +145,17 @@ declare_args() {
# Disable performance counter output by default # Disable performance counter output by default
angle_enable_perf_counter_output = false angle_enable_perf_counter_output = false
# We should use EAGL (ES) on iOS except on Mac Catalyst on Intel CPUs, which uses CGL (desktop GL).
angle_enable_eagl = angle_enable_gl && is_ios &&
!(target_environment == "catalyst" &&
(target_cpu == "x86" || target_cpu == "x64"))
} }
declare_args() { declare_args() {
# TODO(jdarpinian): Support enabling CGL and EAGL at the same time using the soft linking code. Also support disabling both for Metal-only builds.
angle_enable_cgl = angle_enable_gl && !angle_enable_eagl && (is_mac || is_ios)
angle_has_histograms = angle_has_build angle_has_histograms = angle_has_build
} }
......
...@@ -19,8 +19,9 @@ bool GetSystemInfo_ios(SystemInfo *info) ...@@ -19,8 +19,9 @@ bool GetSystemInfo_ios(SystemInfo *info)
{ {
{ {
// TODO(anglebug.com/4275): Get the actual system version and GPU info. // TODO(anglebug.com/4275): Get the actual system version and GPU info.
info->machineModelVersion = "0.0"; info->machineModelVersion = "0.0";
info->gpus.emplace_back().vendorId = kVendorID_Apple; info->gpus.emplace_back();
info->gpus[0].vendorId = kVendorID_Apple;
} }
return true; return true;
......
...@@ -178,7 +178,7 @@ if (is_android) { ...@@ -178,7 +178,7 @@ if (is_android) {
] ]
} }
if (is_mac) { if (angle_enable_cgl) {
_gl_backend_sources += [ _gl_backend_sources += [
"cgl/ContextCGL.cpp", "cgl/ContextCGL.cpp",
"cgl/ContextCGL.h", "cgl/ContextCGL.h",
...@@ -197,6 +197,27 @@ if (is_mac) { ...@@ -197,6 +197,27 @@ if (is_mac) {
] ]
} }
if (angle_enable_eagl) {
_gl_backend_sources += [
"eagl/ContextEAGL.cpp",
"eagl/ContextEAGL.h",
"eagl/DeviceEAGL.cpp",
"eagl/DeviceEAGL.h",
"eagl/DisplayEAGL.h",
"eagl/DisplayEAGL.mm",
"eagl/FunctionsEAGL.h",
"eagl/FunctionsEAGL.mm",
"eagl/IOSurfaceSurfaceEAGL.h",
"eagl/IOSurfaceSurfaceEAGL.mm",
"eagl/PbufferSurfaceEAGL.cpp",
"eagl/PbufferSurfaceEAGL.h",
"eagl/RendererEAGL.cpp",
"eagl/RendererEAGL.h",
"eagl/WindowSurfaceEAGL.h",
"eagl/WindowSurfaceEAGL.mm",
]
}
if (angle_enable_gl_null) { if (angle_enable_gl_null) {
_gl_backend_sources += [ _gl_backend_sources += [
"null_functions.cpp", "null_functions.cpp",
...@@ -209,6 +230,9 @@ config("angle_gl_backend_config") { ...@@ -209,6 +230,9 @@ config("angle_gl_backend_config") {
if (angle_enable_gl_null) { if (angle_enable_gl_null) {
defines += [ "ANGLE_ENABLE_OPENGL_NULL" ] defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
} }
if (is_mac || is_ios) {
defines += [ "GL_SILENCE_DEPRECATION" ]
}
include_dirs = [ "../../../third_party/khronos" ] include_dirs = [ "../../../third_party/khronos" ]
} }
...@@ -235,13 +259,19 @@ angle_source_set("angle_gl_backend") { ...@@ -235,13 +259,19 @@ angle_source_set("angle_gl_backend") {
"Xext", "Xext",
] ]
} }
if (is_mac) { if (is_mac || is_ios) {
frameworks = [ frameworks = [
"Cocoa.framework",
"IOSurface.framework", "IOSurface.framework",
"OpenGL.framework",
"QuartzCore.framework", "QuartzCore.framework",
] ]
if (angle_enable_eagl) {
frameworks += [ "OpenGLES.framework" ]
} else if (angle_enable_cgl) {
frameworks += [ "OpenGL.framework" ]
}
if (is_mac) {
frameworks += [ "Cocoa.framework" ]
}
} }
if (ozone_platform_gbm) { if (ozone_platform_gbm) {
configs += [ ":libdrm" ] configs += [ ":libdrm" ]
......
...@@ -56,4 +56,4 @@ void DeviceEAGL::generateExtensions(egl::DeviceExtensions *outExtensions) const ...@@ -56,4 +56,4 @@ void DeviceEAGL::generateExtensions(egl::DeviceExtensions *outExtensions) const
} // namespace rx } // namespace rx
#endif // defined(ANGLE_ENABLE_EAGL) #endif // defined(ANGLE_ENABLE_EAGL)
\ No newline at end of file
...@@ -309,7 +309,6 @@ void DisplayEAGL::generateExtensions(egl::DisplayExtensions *outExtensions) cons ...@@ -309,7 +309,6 @@ void DisplayEAGL::generateExtensions(egl::DisplayExtensions *outExtensions) cons
{ {
outExtensions->iosurfaceClientBuffer = true; outExtensions->iosurfaceClientBuffer = true;
outExtensions->surfacelessContext = true; outExtensions->surfacelessContext = true;
outExtensions->deviceQuery = true;
// Contexts are virtualized so textures ans semaphores can be shared globally // Contexts are virtualized so textures ans semaphores can be shared globally
outExtensions->displayTextureShareGroup = true; outExtensions->displayTextureShareGroup = true;
......
...@@ -20,4 +20,4 @@ SOFT_LINK_FRAMEWORK_SOURCE(OpenGLES) ...@@ -20,4 +20,4 @@ SOFT_LINK_FRAMEWORK_SOURCE(OpenGLES)
SOFT_LINK_CLASS(OpenGLES, EAGLContext) SOFT_LINK_CLASS(OpenGLES, EAGLContext)
#endif // defined(ANGLE_ENABLE_EAGL) #endif // defined(ANGLE_ENABLE_EAGL)
\ No newline at end of file
...@@ -83,8 +83,8 @@ IOSurfaceSurfaceEAGL::IOSurfaceSurfaceEAGL(const egl::SurfaceState &state, ...@@ -83,8 +83,8 @@ IOSurfaceSurfaceEAGL::IOSurfaceSurfaceEAGL(const egl::SurfaceState &state,
mWidth(0), mWidth(0),
mHeight(0), mHeight(0),
mPlane(0), mPlane(0),
mRowStrideInPixels(0),
mFormatIndex(-1), mFormatIndex(-1),
mRowStrideInPixels(0),
mAlphaInitialized(false) mAlphaInitialized(false)
{ {
// Keep reference to the IOSurface so it doesn't get deleted while the pbuffer exists. // Keep reference to the IOSurface so it doesn't get deleted while the pbuffer exists.
...@@ -113,6 +113,7 @@ IOSurfaceSurfaceEAGL::IOSurfaceSurfaceEAGL(const egl::SurfaceState &state, ...@@ -113,6 +113,7 @@ IOSurfaceSurfaceEAGL::IOSurfaceSurfaceEAGL(const egl::SurfaceState &state,
mAlphaInitialized = !hasEmulatedAlphaChannel(); mAlphaInitialized = !hasEmulatedAlphaChannel();
# if defined(ANGLE_PLATFORM_IOS_SIMULATOR) # if defined(ANGLE_PLATFORM_IOS_SIMULATOR)
ANGLE_UNUSED_VARIABLE(mEAGLContext);
mBoundTextureID = 0; mBoundTextureID = 0;
EGLAttrib usageHint = EGLAttrib usageHint =
attribs.get(EGL_IOSURFACE_USAGE_HINT_ANGLE, attribs.get(EGL_IOSURFACE_USAGE_HINT_ANGLE,
......
...@@ -77,7 +77,7 @@ if (is_linux || is_chromeos || is_android || is_fuchsia) { ...@@ -77,7 +77,7 @@ if (is_linux || is_chromeos || is_android || is_fuchsia) {
] ]
} }
if (is_mac) { if (is_mac || is_ios) {
libangle_common_sources += [ libangle_common_sources += [
"src/common/apple/SoftLinking.h", "src/common/apple/SoftLinking.h",
"src/common/gl/cgl/FunctionsCGL.cpp", "src/common/gl/cgl/FunctionsCGL.cpp",
...@@ -145,6 +145,11 @@ libangle_gpu_info_util_mac_sources = [ ...@@ -145,6 +145,11 @@ libangle_gpu_info_util_mac_sources = [
"src/gpu_info_util/SystemInfo_macos.mm", "src/gpu_info_util/SystemInfo_macos.mm",
] ]
libangle_gpu_info_util_ios_sources = [
"src/gpu_info_util/SystemInfo_apple.mm",
"src/gpu_info_util/SystemInfo_ios.cpp",
]
libangle_includes = [ libangle_includes = [
"include/angle_gl.h", "include/angle_gl.h",
"include/export.h", "include/export.h",
......
...@@ -12,8 +12,8 @@ declare_args() { ...@@ -12,8 +12,8 @@ declare_args() {
build_angle_deqp_tests = false build_angle_deqp_tests = false
build_angle_gles1_conform_tests = false build_angle_gles1_conform_tests = false
build_angle_trace_perf_tests = false build_angle_trace_perf_tests = false
build_angle_perftests = build_angle_perftests = is_win || is_linux || is_chromeos || is_android ||
is_win || is_linux || is_chromeos || is_android || is_mac || is_fuchsia is_mac || is_fuchsia || is_ios
} }
angle_test("test_utils_unittest_helper") { angle_test("test_utils_unittest_helper") {
...@@ -80,7 +80,7 @@ template("angle_common_test_utils") { ...@@ -80,7 +80,7 @@ template("angle_common_test_utils") {
"test_utils/angle_test_platform.h", "test_utils/angle_test_platform.h",
"test_utils/gl_raii.h", "test_utils/gl_raii.h",
] ]
if (is_mac) { if (is_mac || is_ios) {
sources += [ sources += [
"test_utils/angle_test_instantiate_apple.h", "test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm", "test_utils/angle_test_instantiate_apple.mm",
...@@ -135,7 +135,8 @@ angle_test("angle_unittests") { ...@@ -135,7 +135,8 @@ angle_test("angle_unittests") {
} }
} }
if (is_win || is_linux || is_chromeos || is_mac || is_android || is_fuchsia) { if (is_win || is_linux || is_chromeos || is_mac || is_android || is_fuchsia ||
is_ios) {
import("angle_end2end_tests.gni") import("angle_end2end_tests.gni")
angle_test("angle_end2end_tests") { angle_test("angle_end2end_tests") {
...@@ -144,7 +145,7 @@ if (is_win || is_linux || is_chromeos || is_mac || is_android || is_fuchsia) { ...@@ -144,7 +145,7 @@ if (is_win || is_linux || is_chromeos || is_mac || is_android || is_fuchsia) {
sources = angle_end2end_tests_sources + [ "angle_end2end_tests_main.cpp" ] sources = angle_end2end_tests_sources + [ "angle_end2end_tests_main.cpp" ]
libs = [] libs = []
if (is_mac) { if (is_mac || (is_ios && target_environment != "simulator")) {
sources += angle_end2end_tests_mac_sources sources += angle_end2end_tests_mac_sources
frameworks = [ frameworks = [
"CoreFoundation.framework", "CoreFoundation.framework",
...@@ -191,7 +192,7 @@ if (is_win || is_linux || is_chromeos || is_mac || is_android || is_fuchsia) { ...@@ -191,7 +192,7 @@ if (is_win || is_linux || is_chromeos || is_mac || is_android || is_fuchsia) {
} }
} }
if (is_win || is_linux || is_chromeos || is_mac || is_android) { if (is_win || is_linux || is_chromeos || is_mac || is_android || is_ios) {
import("angle_white_box_tests.gni") import("angle_white_box_tests.gni")
angle_test("angle_white_box_tests") { angle_test("angle_white_box_tests") {
...@@ -265,7 +266,7 @@ angle_perftests_common("angle_perftests_static") { ...@@ -265,7 +266,7 @@ angle_perftests_common("angle_perftests_static") {
test_utils = ":angle_common_test_utils_static" test_utils = ":angle_common_test_utils_static"
} }
if (is_win || is_linux || is_chromeos || is_android || is_mac) { if (is_win || is_linux || is_chromeos || is_android || is_mac || is_ios) {
import("angle_perftests.gni") import("angle_perftests.gni")
# This test suite is for perf tests that use ANGLE's internals in some direct way. # This test suite is for perf tests that use ANGLE's internals in some direct way.
...@@ -283,7 +284,7 @@ if (is_win || is_linux || is_chromeos || is_android || is_mac) { ...@@ -283,7 +284,7 @@ if (is_win || is_linux || is_chromeos || is_android || is_mac) {
# These tests depend on vulkan_command_buffer_utils, which is # These tests depend on vulkan_command_buffer_utils, which is
# not yet compatible with mac # not yet compatible with mac
if (angle_enable_vulkan && !is_mac) { if (angle_enable_vulkan && !is_mac && !is_ios) {
sources += angle_white_box_perf_tests_vulkan_sources sources += angle_white_box_perf_tests_vulkan_sources
deps += [ deps += [
"$angle_glslang_dir:glslang_lib_sources", "$angle_glslang_dir:glslang_lib_sources",
...@@ -383,7 +384,7 @@ if (build_angle_gles1_conform_tests) { ...@@ -383,7 +384,7 @@ if (build_angle_gles1_conform_tests) {
] ]
# This is used by the tests to typedef uint32_t. For some reason only needed on mac. # This is used by the tests to typedef uint32_t. For some reason only needed on mac.
if (is_mac) { if (is_mac || is_ios) {
defines += [ "__linux" ] defines += [ "__linux" ]
} }
...@@ -584,7 +585,7 @@ if (build_angle_gles1_conform_tests) { ...@@ -584,7 +585,7 @@ if (build_angle_gles1_conform_tests) {
] ]
} }
if (!is_win && !is_mac) { if (!is_win && !is_mac && !is_ios) {
source_set("angle_gles1_covgl_no_gtest") { source_set("angle_gles1_covgl_no_gtest") {
configs += [ configs += [
":angle_gles1_conform_support", ":angle_gles1_conform_support",
...@@ -886,7 +887,7 @@ if (build_angle_deqp_tests && !is_fuchsia) { ...@@ -886,7 +887,7 @@ if (build_angle_deqp_tests && !is_fuchsia) {
# This has to be GNU_SOURCE as on Linux dEQP uses syscall() # This has to be GNU_SOURCE as on Linux dEQP uses syscall()
defines += [ "_GNU_SOURCE" ] defines += [ "_GNU_SOURCE" ]
} }
if (is_android || is_mac) { if (is_android || is_mac || is_ios) {
# _XOPEN_SOURCE=600 is what is used in deqp/src/Android.mk # _XOPEN_SOURCE=600 is what is used in deqp/src/Android.mk
defines += [ "_XOPEN_SOURCE=600" ] defines += [ "_XOPEN_SOURCE=600" ]
} }
...@@ -1017,7 +1018,7 @@ if (build_angle_deqp_tests && !is_fuchsia) { ...@@ -1017,7 +1018,7 @@ if (build_angle_deqp_tests && !is_fuchsia) {
if (is_win) { if (is_win) {
sources += deqp_framework_delibs_sources_win sources += deqp_framework_delibs_sources_win
} }
if (is_linux || is_chromeos || is_android || is_mac) { if (is_linux || is_chromeos || is_android || is_mac || is_ios) {
sources += deqp_framework_delibs_sources_unix sources += deqp_framework_delibs_sources_unix
} }
...@@ -1455,7 +1456,7 @@ group("angle_tests") { ...@@ -1455,7 +1456,7 @@ group("angle_tests") {
":angle_gles1_covegl_no_gtest", ":angle_gles1_covegl_no_gtest",
":angle_gles1_primtest_tests", ":angle_gles1_primtest_tests",
] ]
if (!is_win && !is_mac) { if (!is_win && !is_mac && !is_ios) {
deps += [ ":angle_gles1_covgl_tests" ] deps += [ ":angle_gles1_covgl_tests" ]
} }
} }
......
...@@ -184,11 +184,11 @@ foreach(is_shared_library, ...@@ -184,11 +184,11 @@ foreach(is_shared_library,
] ]
} }
if (is_mac) { if (is_mac || is_ios) {
frameworks = [ frameworks = [ "QuartzCore.framework" ]
"AppKit.framework", if (is_mac) {
"QuartzCore.framework", frameworks += [ "AppKit.framework" ]
] }
} }
if (is_android) { if (is_android) {
...@@ -221,7 +221,7 @@ foreach(is_shared_library, ...@@ -221,7 +221,7 @@ foreach(is_shared_library,
public_deps += [ ":angle_util_loader" ] public_deps += [ ":angle_util_loader" ]
if (is_mac && !is_component_build) { if ((is_ios || is_mac) && !is_component_build) {
ldflags = [ ldflags = [
"-install_name", "-install_name",
"@rpath/libangle_util.dylib", "@rpath/libangle_util.dylib",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment