From 7cb9aac41ec6087f18b67294d84f29aa62207cdb Mon Sep 17 00:00:00 2001 From: halx99 Date: Mon, 3 Jul 2023 20:35:55 +0800 Subject: [PATCH] Rename option `AX_USE_COMPAT_GL` to `AX_USE_ANGLE` --- CMakeOptions.md | 3 ++- cmake/Modules/AXBuildHelpers.cmake | 2 +- cmake/Modules/AXConfigDefine.cmake | 8 +++----- cmake/Modules/AXLinkHelpers.cmake | 6 +++--- core/CMakeLists.txt | 22 ++++++++++++++++------ core/platform/CMakeLists.txt | 2 +- core/platform/GL.h | 4 ++-- core/platform/PlatformConfig.h | 24 +++++++++++++----------- core/renderer/CMakeLists.txt | 2 +- 9 files changed, 42 insertions(+), 31 deletions(-) diff --git a/CMakeOptions.md b/CMakeOptions.md index a8af2ef256..bb2492f01e 100644 --- a/CMakeOptions.md +++ b/CMakeOptions.md @@ -10,9 +10,10 @@ - AX_USE_ALSOFT: whether use openal-soft for all platforms - Apple platform: Use openal-soft instead system deprecated: `OpenAL.framework` - Other platforms: Always use openal-soft even this option not enabled - - AX_USE_COMPAT_GL: whether use compat gl as renderer backend, default: `FALSE` + - AX_USE_ANGLE: whether use compat gl as renderer backend, default: `FALSE` - windows: whether use angleproject as GLES2 backend - apple: whether use GLES instead Metal backend + - AX_USE_COMPAT_GL: deprecated, use AX_USE_ANGLE instead - AX_USE_GLAD: - Android: use glad load for GLES API loads, default `FALSE` - Other platforms: Always use glad even this option not enabled diff --git a/cmake/Modules/AXBuildHelpers.cmake b/cmake/Modules/AXBuildHelpers.cmake index d4c76dfe65..827bae8b73 100644 --- a/cmake/Modules/AXBuildHelpers.cmake +++ b/cmake/Modules/AXBuildHelpers.cmake @@ -188,7 +188,7 @@ function(ax_copy_target_dll ax_target) ) # Copy windows angle binaries - if (AX_USE_COMPAT_GL) + if (WIN32 AND AX_USE_ANGLE) add_custom_command(TARGET ${ax_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_AX_ROOT_PATH}/${_AX_THIRDPARTY_NAME}/angle/prebuilt/${platform_name}/${ARCH_ALIAS}/libGLESv2.dll diff --git a/cmake/Modules/AXConfigDefine.cmake b/cmake/Modules/AXConfigDefine.cmake index 2847172b33..39fcd29fa5 100644 --- a/cmake/Modules/AXConfigDefine.cmake +++ b/cmake/Modules/AXConfigDefine.cmake @@ -127,9 +127,9 @@ function(use_ax_compile_define target) if(APPLE) target_compile_definitions(${target} PUBLIC __APPLE__) target_compile_definitions(${target} PUBLIC USE_FILE32API) - if(AX_USE_COMPAT_GL) + if(AX_USE_ANGLE) target_compile_definitions(${target} - PUBLIC AX_USE_COMPAT_GL=1 + PUBLIC AX_USE_ANGLE=1 PUBLIC GL_SILENCE_DEPRECATION=1 ) endif() @@ -148,9 +148,7 @@ function(use_ax_compile_define target) elseif(ANDROID) target_compile_definitions(${target} PUBLIC USE_FILE32API) elseif(WINDOWS) - if(AX_USE_COMPAT_GL) - target_compile_definitions(${target} PUBLIC AX_USE_COMPAT_GL=1) - endif() + ax_config_pred(${target} AX_USE_ANGLE) ax_config_pred(${target} AX_ENABLE_VLC_MEDIA) target_compile_definitions(${target} PUBLIC WIN32 diff --git a/cmake/Modules/AXLinkHelpers.cmake b/cmake/Modules/AXLinkHelpers.cmake index d7f321134c..9e32db8f0f 100644 --- a/cmake/Modules/AXLinkHelpers.cmake +++ b/cmake/Modules/AXLinkHelpers.cmake @@ -9,7 +9,7 @@ endif() function(ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR) load_cache("${AX_ROOT_DIR}/${AX_PREBUILT_DIR}" EXCLUDE thirdparty_LIB_DEPENDS) - message(STATUS "AX_USE_COMPAT_GL=${AX_USE_COMPAT_GL}") + message(STATUS "AX_USE_ANGLE=${AX_USE_ANGLE}") message(STATUS "AX_ENABLE_MSEDGE_WEBVIEW2=${AX_ENABLE_MSEDGE_WEBVIEW2}") message(STATUS "AX_ENABLE_MFMEDIA=${AX_ENABLE_MFMEDIA}") @@ -25,7 +25,7 @@ function(ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR) message(STATUS "AX_ENABLE_EXT_EFFEKSEER=${AX_ENABLE_EXT_EFFEKSEER}") message(STATUS "AX_ENABLE_EXT_LUA=${AX_ENABLE_EXT_LUA}") - ax_config_pred(${APP_NAME} AX_USE_COMPAT_GL) + ax_config_pred(${APP_NAME} AX_USE_ANGLE) ax_config_pred(${APP_NAME} AX_ENABLE_MFMEDIA) ax_config_pred(${APP_NAME} AX_ENABLE_MSEDGE_WEBVIEW2) @@ -182,7 +182,7 @@ function(ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR) endif() # Copy windows angle binaries - if (AX_USE_COMPAT_GL) + if (AX_USE_ANGLE) add_custom_command(TARGET ${APP_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${AX_ROOT_DIR}/thirdparty/angle/prebuilt/${platform_name}/${ARCH_ALIAS}/libGLESv2.dll diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index bee12e0fbc..8308d9f336 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -39,10 +39,18 @@ endif() project(ax_libs) if (NOT WINRT) - option (AX_USE_COMPAT_GL "Use compat gl" OFF) + option (AX_USE_ANGLE "Use google angle renderer" OFF) else() - option (AX_USE_COMPAT_GL "Use compat gl" ON) - set(AX_USE_COMPAT_GL ON) + set (AX_USE_ANGLE TRUE CACHE BOOL "Use google angle renderer" FORCE) +endif() + +if (NOT AX_USE_ANGLE) # check deprecated option: AX_USE_COMPAT_GL + if (NOT WINRT) + option (AX_USE_COMPAT_GL "Use google angle renderer" OFF) + else() + set (AX_USE_COMPAT_GL TRUE CACHE BOOL "Use google angle renderer" ON) + endif() + set (AX_USE_ANGLE TRUE CACHE ${AX_USE_COMPAT_GL} "Use google angle renderer" FORCE) endif() message(STATUS "WINRT=${WINRT}") @@ -101,9 +109,11 @@ else() set(AX_ENABLE_EXT_IMGUI OFF) endif() -if (AX_ENABLE_EXT_EFFEKSEER AND ANDROID) # effekseer-axmol require use glad - set(AX_USE_GLAD TRUE CACHE INTERNAL "Forcing use glad for platforms which use GL backend" ) - add_definitions(-DAX_USE_GLAD=1) +if (ANDROID) + option(AX_USE_GLAD "Use glad for platforms which use GL backend" AX_ENABLE_EXT_EFFEKSEER) + if (AX_USE_GLAD) + add_definitions(-DAX_USE_GLAD=1) + endif() endif() if(XCODE) diff --git a/core/platform/CMakeLists.txt b/core/platform/CMakeLists.txt index 2c595a13d3..1e78aadd28 100644 --- a/core/platform/CMakeLists.txt +++ b/core/platform/CMakeLists.txt @@ -104,7 +104,7 @@ elseif(APPLE) platform/ios/InputView-ios.mm ) - if(NOT AX_USE_COMPAT_GL) + if(NOT AX_USE_ANGLE) set(_AX_PLATFORM_SPECIFIC_HEADER ${_AX_PLATFORM_SPECIFIC_HEADER} platform/ios/ES2Renderer-ios.h diff --git a/core/platform/GL.h b/core/platform/GL.h index 8dbd065838..6b4087a641 100644 --- a/core/platform/GL.h +++ b/core/platform/GL.h @@ -40,11 +40,11 @@ THE SOFTWARE. #elif AX_TARGET_PLATFORM == AX_PLATFORM_LINUX # include "platform/linux/GL-linux.h" #elif AX_TARGET_PLATFORM == AX_PLATFORM_IOS -# if AX_USE_COMPAT_GL +# if AX_USE_ANGLE # include "platform/ios/GL-ios.h" # endif #elif AX_TARGET_PLATFORM == AX_PLATFORM_MAC -# if AX_USE_COMPAT_GL +# if AX_USE_ANGLE # include "platform/mac/GL-mac.h" # endif #endif diff --git a/core/platform/PlatformConfig.h b/core/platform/PlatformConfig.h index 28ac5cc479..858ec2de8a 100644 --- a/core/platform/PlatformConfig.h +++ b/core/platform/PlatformConfig.h @@ -109,13 +109,15 @@ THE SOFTWARE. #endif // AX_PLATFORM_WIN32 /* -windows: https://github.com/google/angle -mac: GL -iOS: GLES -other: GL +The google/angle is library which translate native graphics API to GLES2+ APIs +repo: https://github.com/google/angle +windows: d3d9/d3d11/Desktop GL/Vulkan +macOS/iOS: Metal +Android: GLES/Vulkan +Linux: Desktop GL/Vulkan */ -#ifndef AX_USE_COMPAT_GL -# define AX_USE_COMPAT_GL 0 +#ifndef AX_USE_ANGLE +# define AX_USE_ANGLE 0 #endif #if ((AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID) || (AX_TARGET_PLATFORM == AX_PLATFORM_IOS) || (AX_TARGET_PLATFORM == AX_PLATFORM_WINRT)) @@ -125,13 +127,13 @@ other: GL #endif #if (AX_TARGET_PLATFORM == AX_PLATFORM_MAC) -# if !AX_USE_COMPAT_GL +# if !AX_USE_ANGLE # define AX_USE_METAL # else # define AX_USE_GL # endif #elif (AX_TARGET_PLATFORM == AX_PLATFORM_IOS) -# if !AX_USE_COMPAT_GL +# if !AX_USE_ANGLE # define AX_USE_METAL # else # define AX_USE_GL @@ -142,13 +144,13 @@ other: GL # define AX_USE_GLES #elif (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) # define AX_USE_GL -# if AX_USE_COMPAT_GL +# if AX_USE_ANGLE # define AX_USE_GLES # endif #elif (AX_TARGET_PLATFORM == AX_PLATFORM_WINRT) # define AX_USE_GL -# if !defined(AX_USE_COMPAT_GL) -# define AX_USE_COMPAT_GL 1 +# if !defined(AX_USE_ANGLE) +# define AX_USE_ANGLE 1 # endif # define AX_USE_GLES #else diff --git a/core/renderer/CMakeLists.txt b/core/renderer/CMakeLists.txt index d3f5301048..cac1964d0a 100644 --- a/core/renderer/CMakeLists.txt +++ b/core/renderer/CMakeLists.txt @@ -82,7 +82,7 @@ set(_AX_RENDERER_SRC renderer/backend/RenderPassDescriptor.cpp ) -if(ANDROID OR WINDOWS OR LINUX OR AX_USE_COMPAT_GL) +if(ANDROID OR WINDOWS OR LINUX OR AX_USE_ANGLE) list(APPEND _AX_RENDERER_HEADER renderer/backend/opengl/BufferGL.h