Commit 5df2c9ea by Jamie Madill Committed by Commit Bot

Refactor ANGLE common test utils.

This reduces code duplication by including a common set of sources in a single place. New test sets will be a bit easier to add. It also encapsulates the dependencies a bit better when we pull the test utils out of the test targets. Unblocks a follow-up CL that moves the trace perf test sources into their own file so we can re-enable optimizations in the main perf test target. New warnings popped up in a few of the files because of the new source set enabling more warnings. This CL also fixes all of those. Bug: angleproject:3630 Change-Id: Ic30cb30fb4288c4dbbbd29f9bdf04be51e8a6b30 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2103083 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent 41b4ab19
...@@ -57,6 +57,53 @@ angle_static_library("angle_test_expectations") { ...@@ -57,6 +57,53 @@ angle_static_library("angle_test_expectations") {
} }
} }
config("angle_common_test_utils_config") {
include_dirs = [ "." ]
}
template("angle_common_test_utils") {
assert(defined(invoker.angle_util))
angle_source_set(target_name) {
testonly = true
public_configs = [
":angle_common_test_utils_config",
"$angle_root:library_name_config",
]
public_deps = [
"$angle_root:angle_common",
"$angle_root:angle_gpu_info_util",
"$angle_root/util:${invoker.angle_util}",
"//testing/gmock",
"//testing/gtest",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
sources = [
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/angle_test_platform.cpp",
"test_utils/angle_test_platform.h",
"test_utils/gl_raii.h",
]
if (is_mac) {
sources += [
"test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm",
]
}
}
}
angle_common_test_utils("angle_common_test_utils_shared") {
angle_util = "angle_util"
}
angle_common_test_utils("angle_common_test_utils_static") {
angle_util = "angle_util_static"
}
angle_test("angle_unittests") { angle_test("angle_unittests") {
sources = angle_unittests_sources sources = angle_unittests_sources
main = "angle_unittest_main" main = "angle_unittest_main"
...@@ -107,17 +154,12 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) { ...@@ -107,17 +154,12 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) {
sources += angle_end2end_tests_x11_sources sources += angle_end2end_tests_x11_sources
} }
configs += [ configs += [ "${angle_root}:libANGLE_config" ]
"${angle_root}:libANGLE_config",
"${angle_root}:library_name_config",
]
deps = [ deps = [
":angle_common_test_utils_shared",
":angle_test_expectations", ":angle_test_expectations",
"$angle_root:angle_gpu_info_util",
"$angle_root:angle_image_util", "$angle_root:angle_image_util",
"$angle_root/util:angle_util",
"$angle_root/util:angle_util_loader_headers",
] ]
data_deps = [ data_deps = [
...@@ -155,22 +197,15 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -155,22 +197,15 @@ if (is_win || is_linux || is_mac || is_android) {
sources += angle_white_box_tests_win_sources sources += angle_white_box_tests_win_sources
} }
if (is_mac) { configs += [ "${angle_root}:libANGLE_config" ]
sources += angle_white_box_tests_mac_sources
}
configs += [
"${angle_root}:libANGLE_config",
"${angle_root}:library_name_config",
]
deps = [ deps = [
":angle_common_test_utils_static",
"$angle_root:libANGLE", "$angle_root:libANGLE",
"$angle_root:libEGL_static", "$angle_root:libEGL_static",
"$angle_root:libGLESv2_static", "$angle_root:libGLESv2_static",
"$angle_root:preprocessor", "$angle_root:preprocessor",
"$angle_root:translator", "$angle_root:translator",
"$angle_root/util:angle_util_static",
] ]
deps += [ "${angle_root}:angle_gl_enum_utils" ] deps += [ "${angle_root}:angle_gl_enum_utils" ]
...@@ -194,11 +229,11 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -194,11 +229,11 @@ if (is_win || is_linux || is_android || is_mac) {
main = "angle_perftests_main" main = "angle_perftests_main"
deps = [ deps = [
":angle_common_test_utils_static",
"$angle_jsoncpp_dir:jsoncpp", "$angle_jsoncpp_dir:jsoncpp",
"$angle_root:libANGLE", "$angle_root:libANGLE",
"$angle_root:libEGL_static", "$angle_root:libEGL_static",
"$angle_root:libGLESv2_static", "$angle_root:libGLESv2_static",
"$angle_root/util:angle_util_static",
] ]
if (is_win) { if (is_win) {
...@@ -218,7 +253,6 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -218,7 +253,6 @@ if (is_win || is_linux || is_android || is_mac) {
configs += [ configs += [
"${angle_jsoncpp_dir}:jsoncpp_config", "${angle_jsoncpp_dir}:jsoncpp_config",
"${angle_root}:libANGLE_config", "${angle_root}:libANGLE_config",
"${angle_root}:library_name_config",
] ]
} }
} }
...@@ -233,12 +267,10 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) { ...@@ -233,12 +267,10 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) {
main = "angle_perftests_main" main = "angle_perftests_main"
deps = [ deps = [
":angle_common_test_utils_shared",
"$angle_jsoncpp_dir:jsoncpp", "$angle_jsoncpp_dir:jsoncpp",
"$angle_root:angle_common", "$angle_root:angle_common",
"$angle_root:angle_gpu_info_util",
"$angle_root:angle_system_utils", "$angle_root:angle_system_utils",
"$angle_root/util:angle_util",
"$angle_root/util:angle_util_loader_headers",
"$angle_spirv_tools_dir:spvtools_val", "$angle_spirv_tools_dir:spvtools_val",
] ]
...@@ -250,7 +282,6 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) { ...@@ -250,7 +282,6 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) {
configs += [ configs += [
"${angle_jsoncpp_dir}:jsoncpp_config", "${angle_jsoncpp_dir}:jsoncpp_config",
"${angle_root}:libANGLE_config", "${angle_root}:libANGLE_config",
"${angle_root}:library_name_config",
] ]
if (is_win || is_linux) { if (is_win || is_linux) {
...@@ -485,7 +516,10 @@ if (build_angle_gles1_conform_tests) { ...@@ -485,7 +516,10 @@ if (build_angle_gles1_conform_tests) {
} }
angle_test("angle_gles1_conformance_tests") { angle_test("angle_gles1_conformance_tests") {
deps = [ ":angle_gles1_conformance_no_gtest" ] deps = [
":angle_common_test_utils_static",
":angle_gles1_conformance_no_gtest",
]
include_dirs = [ "." ] include_dirs = [ "." ]
...@@ -493,25 +527,11 @@ if (build_angle_gles1_conform_tests) { ...@@ -493,25 +527,11 @@ if (build_angle_gles1_conform_tests) {
"gles1_conformance_tests/ConformanceTests.cpp", "gles1_conformance_tests/ConformanceTests.cpp",
"test_utils/ANGLETest.cpp", "test_utils/ANGLETest.cpp",
"test_utils/ANGLETest.h", "test_utils/ANGLETest.h",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/angle_test_platform.cpp",
"test_utils/angle_test_platform.h",
"test_utils/gl_raii.h",
] ]
if (is_mac) {
sources += [
"test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm",
]
}
main = "angle_end2end_tests_main" main = "angle_end2end_tests_main"
configs += [ configs += [
"${angle_root}:libANGLE_config", "${angle_root}:libANGLE_config",
"${angle_root}:library_name_config",
"${angle_root}:angle_backend_config", "${angle_root}:angle_backend_config",
] ]
} }
......
...@@ -160,19 +160,10 @@ angle_end2end_tests_sources = [ ...@@ -160,19 +160,10 @@ angle_end2end_tests_sources = [
"test_utils/ANGLETest.h", "test_utils/ANGLETest.h",
"test_utils/MultiviewTest.cpp", "test_utils/MultiviewTest.cpp",
"test_utils/MultiviewTest.h", "test_utils/MultiviewTest.h",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/angle_test_platform.cpp",
"test_utils/angle_test_platform.h",
"test_utils/gl_raii.h",
] ]
angle_end2end_tests_mac_sources = [ angle_end2end_tests_mac_sources = [
"egl_tests/EGLDeviceCGLTest.cpp", "egl_tests/EGLDeviceCGLTest.cpp",
"egl_tests/EGLIOSurfaceClientBufferTest.cpp", "egl_tests/EGLIOSurfaceClientBufferTest.cpp",
"test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm",
] ]
angle_end2end_tests_win_sources = [ angle_end2end_tests_win_sources = [
"egl_tests/EGLDeviceTest.cpp", "egl_tests/EGLDeviceTest.cpp",
......
...@@ -12,22 +12,8 @@ _angle_perf_test_common_sources = [ ...@@ -12,22 +12,8 @@ _angle_perf_test_common_sources = [
"perf_tests/third_party/perf/perf_result_reporter.h", "perf_tests/third_party/perf/perf_result_reporter.h",
"perf_tests/third_party/perf/perf_test.cc", "perf_tests/third_party/perf/perf_test.cc",
"perf_tests/third_party/perf/perf_test.h", "perf_tests/third_party/perf/perf_test.h",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/angle_test_platform.cpp",
"test_utils/angle_test_platform.h",
"test_utils/gl_raii.h",
] ]
if (is_mac) {
_angle_perf_test_common_sources += [
"test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm",
]
}
angle_perf_tests_sources = _angle_perf_test_common_sources + [ angle_perf_tests_sources = _angle_perf_test_common_sources + [
"perf_tests/BlitFramebufferPerf.cpp", "perf_tests/BlitFramebufferPerf.cpp",
"perf_tests/BindingPerf.cpp", "perf_tests/BindingPerf.cpp",
......
...@@ -7,13 +7,6 @@ angle_white_box_tests_sources = [ ...@@ -7,13 +7,6 @@ angle_white_box_tests_sources = [
"gl_tests/FormatPrintTest.cpp", "gl_tests/FormatPrintTest.cpp",
"test_utils/ANGLETest.cpp", "test_utils/ANGLETest.cpp",
"test_utils/ANGLETest.h", "test_utils/ANGLETest.h",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
"test_utils/angle_test_instantiate.cpp",
"test_utils/angle_test_instantiate.h",
"test_utils/angle_test_platform.cpp",
"test_utils/angle_test_platform.h",
"test_utils/gl_raii.h",
"util_tests/PrintSystemInfoTest.cpp", "util_tests/PrintSystemInfoTest.cpp",
] ]
angle_white_box_tests_win_sources = [ angle_white_box_tests_win_sources = [
...@@ -28,7 +21,3 @@ angle_white_box_tests_vulkan_sources = [ ...@@ -28,7 +21,3 @@ angle_white_box_tests_vulkan_sources = [
"gl_tests/VulkanFormatTablesTest.cpp", "gl_tests/VulkanFormatTablesTest.cpp",
"gl_tests/VulkanUniformUpdatesTest.cpp", "gl_tests/VulkanUniformUpdatesTest.cpp",
] ]
angle_white_box_tests_mac_sources = [
"test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm",
]
...@@ -61,7 +61,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -61,7 +61,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
const std::string &backend, const std::string &backend,
const std::string &story, const std::string &story,
unsigned int iterationsPerStep); unsigned int iterationsPerStep);
virtual ~ANGLEPerfTest(); ~ANGLEPerfTest() override;
virtual void step() = 0; virtual void step() = 0;
...@@ -120,7 +120,7 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -120,7 +120,7 @@ class ANGLERenderTest : public ANGLEPerfTest
{ {
public: public:
ANGLERenderTest(const std::string &name, const RenderTestParams &testParams); ANGLERenderTest(const std::string &name, const RenderTestParams &testParams);
~ANGLERenderTest(); ~ANGLERenderTest() override;
void addExtensionPrerequisite(const char *extensionName); void addExtensionPrerequisite(const char *extensionName);
......
...@@ -19,7 +19,7 @@ struct DrawCallPerfParams : public RenderTestParams ...@@ -19,7 +19,7 @@ struct DrawCallPerfParams : public RenderTestParams
{ {
// Common default options // Common default options
DrawCallPerfParams(); DrawCallPerfParams();
virtual ~DrawCallPerfParams(); ~DrawCallPerfParams() override;
std::string story() const override; std::string story() const override;
......
...@@ -1309,7 +1309,7 @@ void ANGLEProcessTestArgs(int *argc, char *argv[]) ...@@ -1309,7 +1309,7 @@ void ANGLEProcessTestArgs(int *argc, char *argv[])
{ {
if (strncmp(argv[argIndex], kUseConfig, strlen(kUseConfig)) == 0) if (strncmp(argv[argIndex], kUseConfig, strlen(kUseConfig)) == 0)
{ {
gSelectedConfig = std::string(argv[argIndex] + strlen(kUseConfig)); SetSelectedConfig(argv[argIndex] + strlen(kUseConfig));
} }
if (strncmp(argv[argIndex], kSeparateProcessPerConfig, strlen(kSeparateProcessPerConfig)) == if (strncmp(argv[argIndex], kSeparateProcessPerConfig, strlen(kSeparateProcessPerConfig)) ==
0) 0)
...@@ -1320,7 +1320,7 @@ void ANGLEProcessTestArgs(int *argc, char *argv[]) ...@@ -1320,7 +1320,7 @@ void ANGLEProcessTestArgs(int *argc, char *argv[])
if (gSeparateProcessPerConfig) if (gSeparateProcessPerConfig)
{ {
if (!gSelectedConfig.empty()) if (IsConfigSelected())
{ {
std::cout << "Cannot use both a single test config and separate processes.\n"; std::cout << "Cannot use both a single test config and separate processes.\n";
exit(1); exit(1);
......
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
#include "test_utils/angle_test_instantiate.h" #include "test_utils/angle_test_instantiate.h"
#include <array>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include "angle_gl.h" #include "angle_gl.h"
#include "common/platform.h" #include "common/platform.h"
#include "common/system_utils.h" #include "common/system_utils.h"
#include "common/third_party/base/anglebase/no_destructor.h"
#include "gpu_info_util/SystemInfo.h" #include "gpu_info_util/SystemInfo.h"
#include "test_utils/angle_test_configs.h" #include "test_utils/angle_test_configs.h"
#include "util/EGLWindow.h" #include "util/EGLWindow.h"
...@@ -76,8 +78,6 @@ bool IsNativeConfigSupported(const PlatformParameters &param, OSWindow *osWindow ...@@ -76,8 +78,6 @@ bool IsNativeConfigSupported(const PlatformParameters &param, OSWindow *osWindow
return false; return false;
} }
std::map<PlatformParameters, bool> gParamAvailabilityCache;
bool IsAndroidDevice(const std::string &deviceName) bool IsAndroidDevice(const std::string &deviceName)
{ {
if (!IsAndroid()) if (!IsAndroid())
...@@ -102,11 +102,27 @@ bool HasSystemVendorID(VendorID vendorID) ...@@ -102,11 +102,27 @@ bool HasSystemVendorID(VendorID vendorID)
} }
return systemInfo->gpus[systemInfo->activeGPUIndex].vendorId == vendorID; return systemInfo->gpus[systemInfo->activeGPUIndex].vendorId == vendorID;
} }
using ParamAvailabilityCache = std::map<PlatformParameters, bool>;
ParamAvailabilityCache &GetAvailabilityCache()
{
static angle::base::NoDestructor<std::unique_ptr<ParamAvailabilityCache>>
sParamAvailabilityCache(new ParamAvailabilityCache());
return **sParamAvailabilityCache;
}
constexpr size_t kMaxConfigNameLen = 100;
std::array<char, kMaxConfigNameLen> gSelectedConfig;
} // namespace } // namespace
std::string gSelectedConfig;
bool gSeparateProcessPerConfig = false; bool gSeparateProcessPerConfig = false;
bool IsConfigSelected()
{
return gSelectedConfig[0] != 0;
}
SystemInfo *GetTestSystemInfo() SystemInfo *GetTestSystemInfo()
{ {
static SystemInfo *sSystemInfo = nullptr; static SystemInfo *sSystemInfo = nullptr;
...@@ -130,7 +146,7 @@ SystemInfo *GetTestSystemInfo() ...@@ -130,7 +146,7 @@ SystemInfo *GetTestSystemInfo()
// Print complete system info when available. // Print complete system info when available.
// Seems to trip up Android test expectation parsing. // Seems to trip up Android test expectation parsing.
// Also don't print info when a config is selected to prevent test spam. // Also don't print info when a config is selected to prevent test spam.
if (!IsAndroid() && gSelectedConfig.empty()) if (!IsAndroid() && !IsConfigSelected())
{ {
PrintSystemInfo(*sSystemInfo); PrintSystemInfo(*sSystemInfo);
} }
...@@ -568,18 +584,18 @@ bool IsPlatformAvailable(const PlatformParameters &param) ...@@ -568,18 +584,18 @@ bool IsPlatformAvailable(const PlatformParameters &param)
bool result = false; bool result = false;
auto iter = gParamAvailabilityCache.find(param); auto iter = GetAvailabilityCache().find(param);
if (iter != gParamAvailabilityCache.end()) if (iter != GetAvailabilityCache().end())
{ {
result = iter->second; result = iter->second;
} }
else else
{ {
if (!gSelectedConfig.empty()) if (IsConfigSelected())
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << param; strstr << param;
if (strstr.str() == gSelectedConfig) if (strstr.str() == std::string(gSelectedConfig.data()))
{ {
result = true; result = true;
} }
...@@ -598,10 +614,10 @@ bool IsPlatformAvailable(const PlatformParameters &param) ...@@ -598,10 +614,10 @@ bool IsPlatformAvailable(const PlatformParameters &param)
} }
} }
gParamAvailabilityCache[param] = result; GetAvailabilityCache()[param] = result;
// Enable this unconditionally to print available platforms. // Enable this unconditionally to print available platforms.
if (!gSelectedConfig.empty()) if (IsConfigSelected())
{ {
if (result) if (result)
{ {
...@@ -627,7 +643,7 @@ std::vector<std::string> GetAvailableTestPlatformNames() ...@@ -627,7 +643,7 @@ std::vector<std::string> GetAvailableTestPlatformNames()
{ {
std::vector<std::string> platformNames; std::vector<std::string> platformNames;
for (const auto &iter : gParamAvailabilityCache) for (const auto &iter : GetAvailabilityCache())
{ {
if (iter.second) if (iter.second)
{ {
...@@ -642,4 +658,10 @@ std::vector<std::string> GetAvailableTestPlatformNames() ...@@ -642,4 +658,10 @@ std::vector<std::string> GetAvailableTestPlatformNames()
return platformNames; return platformNames;
} }
void SetSelectedConfig(const char *selectedConfig)
{
gSelectedConfig.fill(0);
strncpy(gSelectedConfig.data(), selectedConfig, kMaxConfigNameLen - 1);
}
} // namespace angle } // namespace angle
...@@ -234,7 +234,8 @@ SystemInfo *GetTestSystemInfo(); ...@@ -234,7 +234,8 @@ SystemInfo *GetTestSystemInfo();
std::vector<std::string> GetAvailableTestPlatformNames(); std::vector<std::string> GetAvailableTestPlatformNames();
// Active config (e.g. ES2_Vulkan). // Active config (e.g. ES2_Vulkan).
extern std::string gSelectedConfig; void SetSelectedConfig(const char *selectedConfig);
bool IsConfigSelected();
// Use a separate isolated process per test config. This works around // Use a separate isolated process per test config. This works around
// driver flakiness when using multiple APIs/windows/etc in the same // driver flakiness when using multiple APIs/windows/etc in the same
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
#include "common/platform.h" #include "common/platform.h"
#include "gpu_info_util/SystemInfo.h" #include "gpu_info_util/SystemInfo.h"
#include "util/EGLWindow.h"
#include "util/OSWindow.h"
#include "util/test_utils.h"
#if defined(ANGLE_PLATFORM_WINDOWS) #if defined(ANGLE_PLATFORM_WINDOWS)
# include <VersionHelpers.h> # include <VersionHelpers.h>
#endif // defined(ANGLE_PLATFORM_WINDOWS) #endif // defined(ANGLE_PLATFORM_WINDOWS)
using namespace angle;
bool IsAdreno() bool IsAdreno()
{ {
std::string rendererString(reinterpret_cast<const char *>(glGetString(GL_RENDERER))); std::string rendererString(reinterpret_cast<const char *>(glGetString(GL_RENDERER)));
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <string> #include <string>
#include "util/EGLWindow.h" #include "util/util_gl.h"
// Driver vendors // Driver vendors
bool IsAdreno(); bool IsAdreno();
......
...@@ -85,6 +85,7 @@ config("angle_util_loader_config") { ...@@ -85,6 +85,7 @@ config("angle_util_loader_config") {
} }
config("angle_util_loader_headers_config") { config("angle_util_loader_headers_config") {
# Force users to include "util/header.h" instead of just "header.h".
include_dirs = [ ".." ] include_dirs = [ ".." ]
} }
...@@ -129,7 +130,8 @@ angle_source_set("angle_util_loader") { ...@@ -129,7 +130,8 @@ angle_source_set("angle_util_loader") {
} }
config("angle_util_config") { config("angle_util_config") {
include_dirs = [ "." ] # Force users to include "util/header.h" instead of just "header.h".
include_dirs = [ ".." ]
if (is_linux && angle_use_x11) { if (is_linux && angle_use_x11) {
libs = [ "X11" ] libs = [ "X11" ]
} }
...@@ -153,12 +155,11 @@ foreach(is_shared_library, ...@@ -153,12 +155,11 @@ foreach(is_shared_library,
target(library_type, library_name) { target(library_type, library_name) {
testonly = true testonly = true
sources = _util_sources sources = _util_sources
deps = [ deps = [ "$angle_root:angle_common" ]
public_deps = [
":angle_test_utils", ":angle_test_utils",
":angle_util_loader_headers", ":angle_util_loader_headers",
"$angle_root:angle_common",
] ]
public_deps = []
libs = [] libs = []
if (is_linux) { if (is_linux) {
......
...@@ -622,13 +622,6 @@ bool EGLWindow::hasError() const ...@@ -622,13 +622,6 @@ bool EGLWindow::hasError() const
return eglGetError() != EGL_SUCCESS; return eglGetError() != EGL_SUCCESS;
} }
bool CheckExtensionExists(const char *allExtensions, const std::string &extName)
{
const std::string paddedExtensions = std::string(" ") + allExtensions + std::string(" ");
return paddedExtensions.find(std::string(" ") + extName + std::string(" ")) !=
std::string::npos;
}
// static // static
void GLWindowBase::Delete(GLWindowBase **window) void GLWindowBase::Delete(GLWindowBase **window)
{ {
......
...@@ -157,6 +157,4 @@ class ANGLE_UTIL_EXPORT EGLWindow : public GLWindowBase ...@@ -157,6 +157,4 @@ class ANGLE_UTIL_EXPORT EGLWindow : public GLWindowBase
EGLint mEGLMinorVersion; EGLint mEGLMinorVersion;
}; };
ANGLE_UTIL_EXPORT bool CheckExtensionExists(const char *allExtensions, const std::string &extName);
#endif // UTIL_EGLWINDOW_H_ #endif // UTIL_EGLWINDOW_H_
...@@ -27,4 +27,13 @@ ...@@ -27,4 +27,13 @@
# include "angle_gl.h" # include "angle_gl.h"
#endif // defined(ANGLE_USE_UTIL_LOADER) #endif // defined(ANGLE_USE_UTIL_LOADER)
namespace angle
{
inline bool CheckExtensionExists(const char *allExtensions, const std::string &extName)
{
const std::string paddedExtensions = std::string(" ") + allExtensions + std::string(" ");
return paddedExtensions.find(std::string(" ") + extName + std::string(" ")) !=
std::string::npos;
}
} // namespace angle
#endif // UTIL_GL_H_ #endif // UTIL_GL_H_
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