Commit ad4f9642 by Yuly Novikov Committed by Commit Bot

Allow ANGLE libs to have arbitrary suffix.

In order to work with tools which intercept EGL and GLES calls. BUG=angleproject:2343 Change-Id: I63aec7a56648dc4b3e7f4aff7f7d1608709ba118 Reviewed-on: https://chromium-review.googlesource.com/920652 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent e6a40d07
...@@ -588,7 +588,7 @@ config("angle_static") { ...@@ -588,7 +588,7 @@ config("angle_static") {
] ]
} }
shared_library("libGLESv2") { shared_library("libGLESv2${angle_libs_suffix}") {
sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src") sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
if (is_android) { if (is_android) {
...@@ -655,7 +655,7 @@ static_library("libGLESv2_static") { ...@@ -655,7 +655,7 @@ static_library("libGLESv2_static") {
] ]
} }
shared_library("libGLESv1_CM") { shared_library("libGLESv1_CM${angle_libs_suffix}") {
sources = rebase_path(gles_gypi.libglesv1_cm_sources, ".", "src") sources = rebase_path(gles_gypi.libglesv1_cm_sources, ".", "src")
if (is_android) { if (is_android) {
...@@ -693,7 +693,7 @@ shared_library("libGLESv1_CM") { ...@@ -693,7 +693,7 @@ shared_library("libGLESv1_CM") {
deps = [ deps = [
":includes", ":includes",
":libGLESv2", ":libGLESv2${angle_libs_suffix}",
"//build/config:exe_and_shlib_deps", "//build/config:exe_and_shlib_deps",
] ]
} }
...@@ -717,7 +717,7 @@ static_library("libGLESv1_CM_static") { ...@@ -717,7 +717,7 @@ static_library("libGLESv1_CM_static") {
] ]
} }
shared_library("libEGL") { shared_library("libEGL${angle_libs_suffix}") {
sources = rebase_path(gles_gypi.libegl_sources, ".", "src") sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
if (is_android) { if (is_android) {
...@@ -752,7 +752,7 @@ shared_library("libEGL") { ...@@ -752,7 +752,7 @@ shared_library("libEGL") {
deps = [ deps = [
":includes", ":includes",
":libGLESv2", ":libGLESv2${angle_libs_suffix}",
"//build/config:exe_and_shlib_deps", "//build/config:exe_and_shlib_deps",
] ]
} }
...@@ -796,7 +796,7 @@ foreach(is_shared_library, ...@@ -796,7 +796,7 @@ foreach(is_shared_library,
if (is_shared_library) { if (is_shared_library) {
library_type = "shared_library" library_type = "shared_library"
library_name = "angle_util" library_name = "angle_util"
dep_suffix = "" dep_suffix = "${angle_libs_suffix}"
} else { } else {
library_type = "static_library" library_type = "static_library"
library_name = "angle_util_static" library_name = "angle_util_static"
......
...@@ -34,4 +34,30 @@ This is done with the gn arg: ...@@ -34,4 +34,30 @@ This is done with the gn arg:
angle_shared_libvulkan = true angle_shared_libvulkan = true
``` ```
When capturing traces of gtest based tests built inside Chromium checkout, make sure to run the tests with `--single-process-tests` argument. When capturing traces of gtest based tests built inside Chromium checkout, make sure to run the tests with `--single-process-tests` argument.
\ No newline at end of file
## Running ANGLE under GAPID on Android
[GAPID](https://github.com/google/gapid) can be used to capture a trace of the Vulkan or OpenGL ES command stream on Android.
For it to work, ANGLE's libraries must have different names from the system OpenGL libraries.
This is done with the gn arg:
```
angle_libs_suffix = "_ANGLE"
```
All [NativeTest](https://chromium.googlesource.com/chromium/src/+/master/testing/android/native_test/java/src/org/chromium/native_test/NativeTest.java) based tests share the same activity name, `org.chromium.native_test.NativeUnitTestNativeActivity`. Thus, prior to capturing your test trace, the specific test APK must be installed on the device. When you build the test, a test launcher is generated, for example, `./out/Release/bin/run_angle_end2end_tests`. The best way to install the APK is to run this test launcher once.
In GAPID's "Capture Trace" dialog, "Package / Action:" should be
```
android.intent.action.MAIN:org.chromium.native_test/org.chromium.native_test.NativeUnitTestNativeActivity
```
The mandatory [extra intent argument](https://developer.android.com/studio/command-line/adb.html#IntentSpec) for starting the activity is `org.chromium.native_test.NativeTest.StdoutFile`. Without it the test APK crashes. Test filters can be specified via either the `org.chromium.native_test.NativeTest.CommandLineFlags` or the `org.chromium.native_test.NativeTest.Shard` argument.
Example "Intent Arguments:" values in GAPID's "Capture Trace" dialog:
```
-e org.chromium.native_test.NativeTest.StdoutFile /sdcard/chromium_tests_root/out.txt -e org.chromium.native_test.NativeTest.CommandLineFlags "--gtest_filter=*ES2_VULKAN"
```
or
```
-e org.chromium.native_test.NativeTest.StdoutFile /sdcard/chromium_tests_root/out.txt --esal org.chromium.native_test.NativeTest.Shard RendererTest.SimpleOperation/ES2_VULKAN,SimpleOperationTest.DrawWithTexture/ES2_VULKAN
```
\ No newline at end of file
...@@ -32,6 +32,7 @@ declare_args() { ...@@ -32,6 +32,7 @@ declare_args() {
(current_cpu == "arm64" && android64_ndk_api_level >= 24) (current_cpu == "arm64" && android64_ndk_api_level >= 24)
} }
angle_shared_libvulkan = false angle_shared_libvulkan = false
angle_libs_suffix = ""
} }
declare_args() { declare_args() {
......
...@@ -2,17 +2,22 @@ ...@@ -2,17 +2,22 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("../gni/angle.gni")
executable("shader_translator") { executable("shader_translator") {
sources = [ "shader_translator/shader_translator.cpp", ] sources = [
include_dirs = [ "../include", ] "shader_translator/shader_translator.cpp",
deps = [ "../:translator", ] ]
include_dirs = [ "../include" ]
deps = [
"../:translator",
]
} }
config("sample_util_config") { config("sample_util_config") {
include_dirs = [ "sample_util" ] include_dirs = [ "sample_util" ]
} }
static_library("sample_util") { static_library("sample_util") {
sources = [ sources = [
"sample_util/SampleApplication.cpp", "sample_util/SampleApplication.cpp",
...@@ -25,8 +30,8 @@ static_library("sample_util") { ...@@ -25,8 +30,8 @@ static_library("sample_util") {
deps = [ deps = [
"../:angle_common", "../:angle_common",
"../:angle_util", "../:angle_util",
"../:libEGL", "../:libEGL${angle_libs_suffix}",
"../:libGLESv2", "../:libGLESv2${angle_libs_suffix}",
] ]
public_configs = [ ":sample_util_config" ] public_configs = [ ":sample_util_config" ]
} }
......
...@@ -126,6 +126,10 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -126,6 +126,10 @@ if (is_win || is_linux || is_mac || is_android) {
"../../src/tests", "../../src/tests",
"../../util", "../../util",
] ]
defines = [
"ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
"ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
]
if (is_android) { if (is_android) {
use_native_activity = true use_native_activity = true
...@@ -174,8 +178,8 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -174,8 +178,8 @@ if (is_win || is_linux || is_mac || is_android) {
deps = googletest_deps + [ deps = googletest_deps + [
angle_root + ":angle_image_util", angle_root + ":angle_image_util",
angle_root + ":angle_util", angle_root + ":angle_util",
angle_root + ":libEGL", angle_root + ":libEGL${angle_libs_suffix}",
angle_root + ":libGLESv2", angle_root + ":libGLESv2${angle_libs_suffix}",
angle_root + ":preprocessor", angle_root + ":preprocessor",
angle_root + ":translator", angle_root + ":translator",
] ]
...@@ -467,9 +471,9 @@ if (build_angle_gles1_conform_tests) { ...@@ -467,9 +471,9 @@ if (build_angle_gles1_conform_tests) {
":angle_gles1_conformance_no_gtest", ":angle_gles1_conformance_no_gtest",
angle_root + ":angle_common", angle_root + ":angle_common",
angle_root + ":angle_util", angle_root + ":angle_util",
angle_root + ":libEGL", angle_root + ":libEGL${angle_libs_suffix}",
angle_root + ":libGLESv1_CM", angle_root + ":libGLESv1_CM${angle_libs_suffix}",
angle_root + ":libGLESv2", angle_root + ":libGLESv2${angle_libs_suffix}",
angle_root + ":preprocessor", angle_root + ":preprocessor",
angle_root + ":translator", angle_root + ":translator",
] ]
...@@ -592,9 +596,10 @@ if (build_angle_deqp_tests) { ...@@ -592,9 +596,10 @@ if (build_angle_deqp_tests) {
":angle_deqp_decpp", ":angle_deqp_decpp",
angle_root + ":angle_common", angle_root + ":angle_common",
angle_root + ":angle_util", angle_root + ":angle_util",
angle_root + ":libEGL", angle_root + ":libEGL${angle_libs_suffix}",
"//third_party/libpng:libpng", "//third_party/libpng:libpng",
] ]
defines = [ "ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"" ]
configs -= deqp_undefine_configs configs -= deqp_undefine_configs
public_configs = [ ":angle_deqp_libtester_config" ] public_configs = [ ":angle_deqp_libtester_config" ]
......
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
// clang-format off // clang-format off
#if (DE_OS == DE_OS_WIN32) #if (DE_OS == DE_OS_WIN32)
#define ANGLE_EGL_LIBRARY_NAME "libEGL.dll" #define ANGLE_EGL_LIBRARY_FULL_NAME ANGLE_EGL_LIBRARY_NAME ".dll"
#elif (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID) #elif (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID)
#define ANGLE_EGL_LIBRARY_NAME "libEGL.so" #define ANGLE_EGL_LIBRARY_FULL_NAME ANGLE_EGL_LIBRARY_NAME ".so"
#elif (DE_OS == DE_OS_OSX) #elif (DE_OS == DE_OS_OSX)
#define ANGLE_EGL_LIBRARY_NAME "libEGL.dylib" #define ANGLE_EGL_LIBRARY_FULL_NAME ANGLE_EGL_LIBRARY_NAME ".dylib"
#else #else
#error "Unsupported platform" #error "Unsupported platform"
#endif #endif
...@@ -149,7 +149,7 @@ class NativeWindow : public eglu::NativeWindow ...@@ -149,7 +149,7 @@ class NativeWindow : public eglu::NativeWindow
ANGLENativeDisplay::ANGLENativeDisplay(const std::vector<EGLAttrib> &attribs) ANGLENativeDisplay::ANGLENativeDisplay(const std::vector<EGLAttrib> &attribs)
: eglu::NativeDisplay(DISPLAY_CAPABILITIES, EGL_PLATFORM_ANGLE_ANGLE, "EGL_EXT_platform_base"), : eglu::NativeDisplay(DISPLAY_CAPABILITIES, EGL_PLATFORM_ANGLE_ANGLE, "EGL_EXT_platform_base"),
mDeviceContext(EGL_DEFAULT_DISPLAY), mDeviceContext(EGL_DEFAULT_DISPLAY),
mLibrary(ANGLE_EGL_LIBRARY_NAME), mLibrary(ANGLE_EGL_LIBRARY_FULL_NAME),
mPlatformAttributes(attribs) mPlatformAttributes(attribs)
{ {
} }
......
...@@ -40,8 +40,8 @@ DWORD WINAPI EGLThreadTest::ThreadingTestEntryPoint(LPVOID lpParameter) ...@@ -40,8 +40,8 @@ DWORD WINAPI EGLThreadTest::ThreadingTestEntryPoint(LPVOID lpParameter)
void EGLThreadTest::ThreadingTest() void EGLThreadTest::ThreadingTest()
{ {
mEGL = LoadLibrary(TEXT("libEGL.dll")); mEGL = LoadLibrary(TEXT(ANGLE_EGL_LIBRARY_NAME ".dll"));
mGLESv2 = LoadLibrary(TEXT("libGLESv2.dll")); mGLESv2 = LoadLibrary(TEXT(ANGLE_GLESV2_LIBRARY_NAME ".dll"));
EXPECT_TRUE(mEGL != nullptr); EXPECT_TRUE(mEGL != nullptr);
EXPECT_TRUE(mGLESv2 != nullptr); EXPECT_TRUE(mGLESv2 != nullptr);
......
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