mirror of
https://github.com/utmapp/angle.git
synced 2026-12-01 14:00:09 -10:00
Make perftests use ANGLE_INSTANTIATE_TEST
This also moves ANGLE_INSTANTIATE_TEST to its own header and makes it generic over the type of test parameter. BUG=angleproject:892 Change-Id: Id4e3929d7ad06964b3259015915be84a8ee414f9 Reviewed-on: https://chromium-review.googlesource.com/272553 Reviewed-by: Geoff Lang <[email protected]> Tested-by: Corentin Wallez <[email protected]>
This commit is contained in:
1 parent
e3b10e8d2f
commit
b45a80dbdf
11 files changed
+112
-58
No files matched your search
@@ -54,6 +54,7 @@
|
||||
'<(angle_path)/src/tests/test_utils/ANGLETest.cpp',
|
||||
'<(angle_path)/src/tests/test_utils/ANGLETest.h',
|
||||
'<(angle_path)/src/tests/test_utils/angle_test_configs.h',
|
||||
'<(angle_path)/src/tests/test_utils/angle_test_instantiate.h',
|
||||
],
|
||||
'angle_end2end_tests_win_sources':
|
||||
[
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
'perf_tests/TexSubImage.cpp',
|
||||
'perf_tests/third_party/perf/perf_test.cc',
|
||||
'perf_tests/third_party/perf/perf_test.h',
|
||||
'test_utils/angle_test_instantiate.h',
|
||||
],
|
||||
'angle_perf_tests_win_sources':
|
||||
[
|
||||
@@ -47,6 +48,10 @@
|
||||
[
|
||||
'<@(angle_perf_tests_sources)',
|
||||
],
|
||||
'include_dirs':
|
||||
[
|
||||
'<(angle_path)/src/tests'
|
||||
],
|
||||
'conditions':
|
||||
[
|
||||
['OS=="win"',
|
||||
|
||||
@@ -74,10 +74,18 @@ std::string RenderTestParams::suffix() const
|
||||
{
|
||||
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE: return "_d3d11";
|
||||
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE: return "_d3d9";
|
||||
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE: return "_gl";
|
||||
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE: return "_gles";
|
||||
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE: return "_default";
|
||||
default: assert(0); return "_unk";
|
||||
}
|
||||
}
|
||||
|
||||
EGLint RenderTestParams::getRenderer() const
|
||||
{
|
||||
return requestedRenderer;
|
||||
}
|
||||
|
||||
ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams &testParams)
|
||||
: ANGLEPerfTest(name, testParams.suffix()),
|
||||
mTestParams(testParams),
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "OSWindow.h"
|
||||
#include "Timer.h"
|
||||
#include "common/angleutils.h"
|
||||
#include "common/debug.h"
|
||||
#include "test_utils/angle_test_instantiate.h"
|
||||
|
||||
class Event;
|
||||
|
||||
@@ -54,6 +56,8 @@ struct RenderTestParams
|
||||
{
|
||||
virtual std::string suffix() const;
|
||||
|
||||
EGLint getRenderer() const;
|
||||
|
||||
EGLint requestedRenderer;
|
||||
EGLint deviceType;
|
||||
EGLint glesMajorVersion;
|
||||
|
||||
@@ -356,8 +356,7 @@ TEST_P(BufferSubDataBenchmark, Run)
|
||||
run();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BufferUpdates,
|
||||
BufferSubDataBenchmark,
|
||||
::testing::Values(BufferUpdateD3D11Params(), BufferUpdateD3D9Params()));
|
||||
ANGLE_INSTANTIATE_TEST(BufferSubDataBenchmark,
|
||||
BufferUpdateD3D11Params(), BufferUpdateD3D9Params());
|
||||
|
||||
} // namespace
|
||||
@@ -206,10 +206,7 @@ TEST_P(DrawCallPerfBenchmark, Run)
|
||||
run();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DrawCallPerf,
|
||||
DrawCallPerfBenchmark,
|
||||
::testing::Values(DrawCallPerfD3D11Params(),
|
||||
DrawCallPerfD3D9Params(),
|
||||
DrawCallPerfValidationOnly()));
|
||||
ANGLE_INSTANTIATE_TEST(DrawCallPerfBenchmark,
|
||||
DrawCallPerfD3D11Params(), DrawCallPerfD3D9Params(), DrawCallPerfValidationOnly());
|
||||
|
||||
} // namespace
|
||||
@@ -195,8 +195,7 @@ TEST_P(IndexConversionPerfTest, Run)
|
||||
run();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(IndexConversionPerf,
|
||||
IndexConversionPerfTest,
|
||||
::testing::Values(IndexConversionPerfD3D11Params()));
|
||||
ANGLE_INSTANTIATE_TEST(IndexConversionPerfTest,
|
||||
IndexConversionPerfD3D11Params());
|
||||
|
||||
} // namespace
|
||||
@@ -224,6 +224,5 @@ TEST_P(PointSpritesBenchmark, Run)
|
||||
run();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Render,
|
||||
PointSpritesBenchmark,
|
||||
::testing::Values(D3D11Params(), D3D9Params()));
|
||||
ANGLE_INSTANTIATE_TEST(PointSpritesBenchmark,
|
||||
D3D11Params(), D3D9Params());
|
||||
@@ -293,6 +293,5 @@ TEST_P(TexSubImageBenchmark, Run)
|
||||
run();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TextureUpdates,
|
||||
TexSubImageBenchmark,
|
||||
::testing::Values(D3D11Params(), D3D9Params()));
|
||||
ANGLE_INSTANTIATE_TEST(TexSubImageBenchmark,
|
||||
D3D11Params(), D3D9Params());
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "angle_test_instantiate.h"
|
||||
#include "EGLWindow.h"
|
||||
|
||||
namespace angle
|
||||
@@ -25,6 +25,8 @@ struct PlatformParameters
|
||||
{
|
||||
}
|
||||
|
||||
EGLint getRenderer() const { return mEGLPlatformParameters.renderer; }
|
||||
|
||||
EGLint mClientVersion;
|
||||
EGLPlatformParameters mEGLPlatformParameters;
|
||||
|
||||
@@ -87,42 +89,6 @@ inline std::ostream &operator<<(std::ostream& stream,
|
||||
return stream;
|
||||
}
|
||||
|
||||
inline std::vector<PlatformParameters> FilterPlatforms(const PlatformParameters *platforms, size_t numPlatforms)
|
||||
{
|
||||
std::vector<PlatformParameters> filtered;
|
||||
|
||||
for (size_t i = 0; i < numPlatforms; i++)
|
||||
{
|
||||
switch (platforms[i].mEGLPlatformParameters.renderer)
|
||||
{
|
||||
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_D3D9)
|
||||
filtered.push_back(platforms[i]);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_D3D11)
|
||||
filtered.push_back(platforms[i]);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
|
||||
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_OPENGL)
|
||||
filtered.push_back(platforms[i]);
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
inline PlatformParameters ES2_D3D9()
|
||||
{
|
||||
EGLPlatformParameters eglParams(
|
||||
@@ -435,10 +401,6 @@ inline PlatformParameters ES3_OPENGLES()
|
||||
return PlatformParameters(3, eglParams);
|
||||
}
|
||||
|
||||
#define ANGLE_INSTANTIATE_TEST(testName, ...) \
|
||||
const PlatformParameters testName##params[] = {__VA_ARGS__}; \
|
||||
INSTANTIATE_TEST_CASE_P(, testName, testing::ValuesIn(FilterPlatforms(testName##params, ArraySize(testName##params))));
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_TEST_CONFIGS_H_
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// Copyright (c) 2014 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.
|
||||
//
|
||||
|
||||
// angle_test_instantiate.h: Adds support for filtering parameterized
|
||||
// tests by platform, so we skip unsupported configs.
|
||||
|
||||
#ifndef ANGLE_TEST_INSTANTIATE_H_
|
||||
#define ANGLE_TEST_INSTANTIATE_H_
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
// This functions is used to filter which tests should be registered,
|
||||
// internally it T::getRenderer() const that should be implemented for test
|
||||
// parameter types.
|
||||
template <typename T>
|
||||
inline std::vector<T> FilterTestParams(const T *params, size_t numParams)
|
||||
{
|
||||
std::vector<T> filtered;
|
||||
|
||||
for (size_t i = 0; i < numParams; i++)
|
||||
{
|
||||
switch (params[i].getRenderer())
|
||||
{
|
||||
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
|
||||
filtered.push_back(params[i]);
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_D3D9)
|
||||
filtered.push_back(params[i]);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_D3D11)
|
||||
filtered.push_back(params[i]);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
|
||||
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_OPENGL)
|
||||
filtered.push_back(params[i]);
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Used with decltype to get the type of the first argument.
|
||||
template <typename T, typename ... Args>
|
||||
T ReturnFirst(T first, Args...)
|
||||
{
|
||||
return first;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Instantiate the test once for each extra argument. The types of all the
|
||||
// arguments must match, and getRenderer must be implemented for that type.
|
||||
#define ANGLE_INSTANTIATE_TEST(testName, ...) \
|
||||
const decltype(::angle::detail::ReturnFirst(__VA_ARGS__)) testName##params[] = {__VA_ARGS__}; \
|
||||
INSTANTIATE_TEST_CASE_P(, testName, testing::ValuesIn(::angle::FilterTestParams(testName##params, ArraySize(testName##params))));
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_TEST_INSTANTIATE_H_
|
||||
Reference in new issue
Block a user