aboutsummaryrefslogtreecommitdiff
path: root/src/tests/test_utils/angle_test_instantiate.h
blob: 7e2a0fd27f65f0c3d9526f38e3cba000d54050ca (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
//
// Copyright 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/platform_helpers.h"

namespace angle
{
struct SystemInfo;
struct PlatformParameters;

// Operating systems
bool IsOzone();

// CPU architectures
bool IsARM64();

// Android devices
bool IsNexus5X();
bool IsNexus9();
bool IsPixelXL();
bool IsPixel2();
bool IsPixel2XL();
bool IsPixel4();
bool IsPixel4XL();
bool IsPixel6();
bool IsNVIDIAShield();

// GPU vendors.
bool IsIntel();
bool IsAMD();
bool IsAppleGPU();
bool IsARM();
bool IsNVIDIA();
bool IsQualcomm();

// GPU devices.
bool IsSwiftshaderDevice();
bool IsIntelUHD630Mobile();

bool HasMesa();

bool IsPlatformAvailable(const PlatformParameters &param);

// 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> &params)
{
    return FilterTestParams(params.data(), params.size());
}

// Used to generate valid test names out of testing::PrintToStringParamName used in combined tests.
struct CombinedPrintToStringParamName
{
    template <class ParamType>
    std::string operator()(const testing::TestParamInfo<ParamType> &info) const
    {
        std::string name = testing::PrintToStringParamName()(info);
        std::string sanitized;
        for (const char c : name)
        {
            if (c == ',')
            {
                sanitized += '_';
            }
            else if (isalnum(c) || c == '_')
            {
                sanitized += c;
            }
        }
        return sanitized;
    }
};

#define ANGLE_INSTANTIATE_TEST_PLATFORMS(testName, ...)                        \
    testing::ValuesIn(::angle::FilterTestParams(testName##__VA_ARGS__##params, \
                                                ArraySize(testName##__VA_ARGS__##params)))

// 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, first, ...)                                         \
    const std::remove_reference<decltype(first)>::type testName##params[] = {first,          \
                                                                             ##__VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),         \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ARRAY(testName, valuesin)                                         \
    INSTANTIATE_TEST_SUITE_P(, testName, testing::ValuesIn(::angle::FilterTestParams(valuesin)), \
                             testing::PrintToStringParamName())

#if !defined(ANGLE_TEST_ENABLE_SYSTEM_EGL)
#    define ANGLE_TEST_PLATFORMS_ES1_SYSTEM_EGL
#    define ANGLE_TEST_PLATFORMS_ES2_SYSTEM_EGL
#    define ANGLE_TEST_PLATFORMS_ES3_SYSTEM_EGL
#    define ANGLE_TEST_PLATFORMS_ES31_SYSTEM_EGL
#    define ANGLE_TEST_PLATFORMS_ES32_SYSTEM_EGL
#else
#    define ANGLE_TEST_PLATFORMS_ES1_SYSTEM_EGL ES1_EGL(),
#    define ANGLE_TEST_PLATFORMS_ES2_SYSTEM_EGL ES2_EGL(),
#    define ANGLE_TEST_PLATFORMS_ES3_SYSTEM_EGL ES3_EGL(),
#    define ANGLE_TEST_PLATFORMS_ES31_SYSTEM_EGL ES31_EGL(),
#    define ANGLE_TEST_PLATFORMS_ES32_SYSTEM_EGL ES32_EGL(),
#endif

#define ANGLE_ALL_TEST_PLATFORMS_ES1                                                   \
    ANGLE_TEST_PLATFORMS_ES1_SYSTEM_EGL                                                \
    ES1_D3D11(), ES1_OPENGL(), ES1_OPENGLES(), ES1_VULKAN(), ES1_VULKAN_SWIFTSHADER(), \
        ES1_VULKAN().enable(Feature::AsyncCommandQueue),                               \
        ES1_VULKAN_SWIFTSHADER().enable(Feature::AsyncCommandQueue),                   \
        ES1_VULKAN().enable(Feature::EnableParallelCompileAndLink)

#define ANGLE_ALL_TEST_PLATFORMS_ES2                                                               \
    ANGLE_TEST_PLATFORMS_ES2_SYSTEM_EGL                                                            \
    ES2_D3D9(), ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES(), ES2_VULKAN(), ES2_VULKAN_SWIFTSHADER(), \
        ES2_METAL(), ES2_VULKAN().enable(Feature::AsyncCommandQueue),                              \
        ES2_VULKAN_SWIFTSHADER().enable(Feature::AsyncCommandQueue),                               \
        ES2_VULKAN_SWIFTSHADER().enable(Feature::EnableParallelCompileAndLink),                    \
        ES2_VULKAN_SWIFTSHADER()                                                                   \
            .enable(Feature::EnableParallelCompileAndLink)                                         \
            .enable(Feature::AsyncCommandQueue)

#define ANGLE_ALL_TEST_PLATFORMS_ES3                                                   \
    ANGLE_TEST_PLATFORMS_ES3_SYSTEM_EGL                                                \
    ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES(), ES3_VULKAN(), ES3_VULKAN_SWIFTSHADER(), \
        ES3_METAL(), ES3_VULKAN().enable(Feature::AsyncCommandQueue),                  \
        ES3_VULKAN_SWIFTSHADER().enable(Feature::AsyncCommandQueue),                   \
        ES3_VULKAN().enable(Feature::EnableParallelCompileAndLink),                    \
        ES3_VULKAN_SWIFTSHADER().enable(Feature::EnableParallelCompileAndLink)

#define ANGLE_ALL_TEST_PLATFORMS_ES31                                                       \
    ANGLE_TEST_PLATFORMS_ES31_SYSTEM_EGL                                                    \
    ES31_D3D11(), ES31_OPENGL(), ES31_OPENGLES(), ES31_VULKAN(), ES31_VULKAN_SWIFTSHADER(), \
        ES31_VULKAN().enable(Feature::AsyncCommandQueue),                                   \
        ES31_VULKAN_SWIFTSHADER().enable(Feature::AsyncCommandQueue),                       \
        ES31_VULKAN_SWIFTSHADER().enable(Feature::EnableParallelCompileAndLink)

#define ANGLE_ALL_TEST_PLATFORMS_ES32                                \
    ANGLE_TEST_PLATFORMS_ES32_SYSTEM_EGL                             \
    ES32_VULKAN(), ES32_VULKAN().enable(Feature::AsyncCommandQueue), \
        ES32_VULKAN()                                                \
            .enable(Feature::AsyncCommandQueue)                      \
            .enable(Feature::EnableParallelCompileAndLink)

#define ANGLE_ALL_TEST_PLATFORMS_GL32_CORE GL32_CORE_VULKAN(), GL32_CORE_VULKAN_SWIFTSHADER()

#define ANGLE_ALL_TEST_PLATFORMS_NULL ES2_NULL(), ES3_NULL(), ES31_NULL()

// Instantiate the test once for each GLES1 platform
#define ANGLE_INSTANTIATE_TEST_ES1(testName)                                         \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES1};    \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

// Instantiate the test once for each GLES2 platform
#define ANGLE_INSTANTIATE_TEST_ES2(testName)                                         \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES2};    \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES2_AND(testName, ...)                                          \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES2, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),           \
                             testing::PrintToStringParamName())

// Instantiate the test once for each GLES3 platform
#define ANGLE_INSTANTIATE_TEST_ES3(testName)                                         \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES3};    \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES3_AND(testName, ...)                                          \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES3, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),           \
                             testing::PrintToStringParamName())

// Instantiate the test once for each GLES31 platform
#define ANGLE_INSTANTIATE_TEST_ES31(testName)                                        \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES31};   \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES31_AND(testName, ...)                                          \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES31, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),            \
                             testing::PrintToStringParamName())

// Instantiate the test once for each GLES32 platform
#define ANGLE_INSTANTIATE_TEST_ES32(testName)                                        \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES32};   \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES32_AND(testName, ...)                                          \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES32, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),            \
                             testing::PrintToStringParamName())

// Instantiate the test once for each desktop GL 3.2 core platform
#define ANGLE_INSTANTIATE_TEST_GL32_CORE(testName)                                      \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_GL32_CORE}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),    \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_GL32_CORE_AND(testName, ...)                            \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_GL32_CORE, \
                                                   __VA_ARGS__};                       \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),   \
                             testing::PrintToStringParamName())

// Multiple ES Version macros
#define ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(testName)                                 \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES2,     \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES3};    \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND(testName, ...)                                  \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES2,               \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES3, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),           \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND_ES31(testName)                        \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES2,     \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES3,     \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES31};   \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND_ES31_AND(testName, ...)                          \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES2,                \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES3,                \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES31, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),            \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND_ES31_AND_NULL(testName)                             \
    const PlatformParameters testName##params[] = {                                                \
        ANGLE_ALL_TEST_PLATFORMS_ES2, ANGLE_ALL_TEST_PLATFORMS_ES3, ANGLE_ALL_TEST_PLATFORMS_ES31, \
        ANGLE_ALL_TEST_PLATFORMS_NULL};                                                            \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),               \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND_ES31_AND_NULL_AND(testName, ...)                    \
    const PlatformParameters testName##params[] = {                                                \
        ANGLE_ALL_TEST_PLATFORMS_ES2, ANGLE_ALL_TEST_PLATFORMS_ES3, ANGLE_ALL_TEST_PLATFORMS_ES31, \
        ANGLE_ALL_TEST_PLATFORMS_NULL, __VA_ARGS__};                                               \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),               \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES3_AND_ES31(testName)                                \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES3,     \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES31};   \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
                             testing::PrintToStringParamName())

#define ANGLE_INSTANTIATE_TEST_ES3_AND_ES31_AND(testName, ...)                                  \
    const PlatformParameters testName##params[] = {ANGLE_ALL_TEST_PLATFORMS_ES3,                \
                                                   ANGLE_ALL_TEST_PLATFORMS_ES31, __VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),            \
                             testing::PrintToStringParamName())

// Instantiate the test for a combination of N parameters and the
// enumeration of platforms in the extra args, similar to
// ANGLE_INSTANTIATE_TEST.  The macros are defined only for the Ns
// currently in use, and can be expanded as necessary.
#define ANGLE_INSTANTIATE_TEST_COMBINE_1(testName, print, combine1, first, ...)              \
    const std::remove_reference<decltype(first)>::type testName##params[] = {first,          \
                                                                             ##__VA_ARGS__}; \
    INSTANTIATE_TEST_SUITE_P(                                                                \
        , testName, testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), combine1), print)
#define ANGLE_INSTANTIATE_TEST_COMBINE_3(testName, print, combine1, combine2, combine3, first, \
                                         ...)                                                  \
    const std::remove_reference<decltype(first)>::type testName##params[] = {first,            \
                                                                             ##__VA_ARGS__};   \
    INSTANTIATE_TEST_SUITE_P(, testName,                                                       \
                             testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),      \
                                              combine1, combine2, combine3),                   \
                             print)
#define ANGLE_INSTANTIATE_TEST_COMBINE_4(testName, print, combine1, combine2, combine3, combine4, \
                                         first, ...)                                              \
    const std::remove_reference<decltype(first)>::type testName##params[] = {first,               \
                                                                             ##__VA_ARGS__};      \
    INSTANTIATE_TEST_SUITE_P(, testName,                                                          \
                             testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),         \
                                              combine1, combine2, combine3, combine4),            \
                             print)
#define ANGLE_INSTANTIATE_TEST_COMBINE_5(testName, print, combine1, combine2, combine3, combine4, \
                                         combine5, first, ...)                                    \
    const std::remove_reference<decltype(first)>::type testName##params[] = {first,               \
                                                                             ##__VA_ARGS__};      \
    INSTANTIATE_TEST_SUITE_P(, testName,                                                          \
                             testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName),         \
                                              combine1, combine2, combine3, combine4, combine5),  \
                             print)
#define ANGLE_INSTANTIATE_TEST_COMBINE_6(testName, print, combine1, combine2, combine3, combine4,  \
                                         combine5, combine6, first, ...)                           \
    const std::remove_reference<decltype(first)>::type testName##params[] = {first,                \
                                                                             ##__VA_ARGS__};       \
    INSTANTIATE_TEST_SUITE_P(                                                                      \
        , testName,                                                                                \
        testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), combine1, combine2, combine3, \
                         combine4, combine5, combine6),                                            \
        print)

// Checks if a config is expected to be supported by checking a system-based allow list.
bool IsConfigAllowlisted(const SystemInfo &systemInfo, const PlatformParameters &param);

// Determines if a config is supported by trying to initialize it. Does
// not require SystemInfo.
bool IsConfigSupported(const PlatformParameters &param);

// Returns shared test system information. Can be used globally in the
// tests.
SystemInfo *GetTestSystemInfo();

// Returns a list of all enabled test platform names. For use in
// configuration enumeration.
std::vector<std::string> GetAvailableTestPlatformNames();

// Active config (e.g. ES2_Vulkan).
void SetSelectedConfig(const char *selectedConfig);
bool IsConfigSelected();

// Check whether texture swizzle is natively supported on Metal device.
bool IsMetalTextureSwizzleAvailable();

// Check whether TEXTURE_3D target is supported for compressed formats on Metal device.
bool IsMetalCompressedTexture3DAvailable();

extern bool gEnableANGLEPerTestCaptureLabel;

// For use with ANGLE_INSTANTIATE_TEST_ARRAY
template <typename ParamsT>
using ModifierFunc = std::function<ParamsT(const ParamsT &)>;

template <typename ParamsT>
std::vector<ParamsT> CombineWithFuncs(const std::vector<ParamsT> &in,
                                      const std::vector<ModifierFunc<ParamsT>> &modifiers)
{
    std::vector<ParamsT> out;
    for (const ParamsT &paramsIn : in)
    {
        for (ModifierFunc<ParamsT> modifier : modifiers)
        {
            out.push_back(modifier(paramsIn));
        }
    }
    return out;
}

template <typename ParamT, typename RangeT, typename ModifierT>
std::vector<ParamT> CombineWithValues(const std::vector<ParamT> &in,
                                      RangeT begin,
                                      RangeT end,
                                      ParamT combine(const ParamT &, ModifierT))
{
    std::vector<ParamT> out;
    for (const ParamT &paramsIn : in)
    {
        for (auto iter = begin; iter != end; ++iter)
        {
            out.push_back(combine(paramsIn, *iter));
        }
    }
    return out;
}

template <typename ParamT, typename ModifierT>
std::vector<ParamT> CombineWithValues(const std::vector<ParamT> &in,
                                      const std::initializer_list<ModifierT> &modifiers,
                                      ParamT combine(const ParamT &, ModifierT))
{
    return CombineWithValues(in, modifiers.begin(), modifiers.end(), combine);
}

template <typename ParamT, typename ModifiersT, typename ModifierT>
std::vector<ParamT> CombineWithValues(const std::vector<ParamT> &in,
                                      const ModifiersT &modifiers,
                                      ParamT combine(const ParamT &, ModifierT))
{
    return CombineWithValues(in, std::begin(modifiers), std::end(modifiers), combine);
}

template <typename ParamT, typename FilterFunc>
std::vector<ParamT> FilterWithFunc(const std::vector<ParamT> &in, FilterFunc filter)
{
    std::vector<ParamT> out;
    for (const ParamT &param : in)
    {
        if (filter(param))
        {
            out.push_back(param);
        }
    }
    return out;
}
}  // namespace angle

#define ANGLE_SKIP_TEST_IF(COND)                        \
    do                                                  \
    {                                                   \
        if (COND)                                       \
        {                                               \
            GTEST_SKIP() << "Test skipped: " #COND "."; \
            return;                                     \
        }                                               \
    } while (0)

#endif  // ANGLE_TEST_INSTANTIATE_H_