Hash :
1436d434
Author :
Date :
2018-01-24T14:38:22
Add a simple compiler perf test The perf test initializes the compiler once and then translates the same shader to HLSL, GLSL or ESSL repeatedly. There are three variations of the test compiling different shaders. One is a real-world shader. BUG=angleproject:2267 TEST=angle_perftests Change-Id: Ie07b67d7548d105c4c93dff3b6196233d83b5b8c Reviewed-on: https://chromium-review.googlesource.com/883784 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
//
// 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 <gtest/gtest.h>
#include "common/debug.h"
namespace angle
{
struct CompilerParameters;
struct PlatformParameters;
bool IsPlatformAvailable(const CompilerParameters ¶m);
bool IsPlatformAvailable(const PlatformParameters ¶m);
// This functions is used to filter which tests should be registered,
// T must be or inherit from angle::PlatformParameters.
template <typename T>
std::vector<T> FilterTestParams(const T *params, size_t numParams)
{
std::vector<T> filtered;
for (size_t i = 0; i < numParams; i++)
{
if (IsPlatformAvailable(params[i]))
{
filtered.push_back(params[i]);
}
}
return filtered;
}
template <typename T>
std::vector<T> FilterTestParams(const std::vector<T> ¶ms)
{
return FilterTestParams(params.data(), params.size());
}
// 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, firstParam, ...) \
const decltype(firstParam) testName##params[] = { firstParam, ##__VA_ARGS__ }; \
INSTANTIATE_TEST_CASE_P(, testName, \
testing::ValuesIn(::angle::FilterTestParams(testName##params, ArraySize(testName##params))), \
testing::PrintToStringParamName());
} // namespace angle
#endif // ANGLE_TEST_INSTANTIATE_H_