1 //
2 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // DrawCallPerfParams.h:
7 //   Parametrization for performance tests for ANGLE draw call overhead.
8 //
9 
10 #ifndef TESTS_PERF_TESTS_DRAW_CALL_PERF_PARAMS_H_
11 #define TESTS_PERF_TESTS_DRAW_CALL_PERF_PARAMS_H_
12 
13 #include <ostream>
14 
15 #include "ANGLEPerfTest.h"
16 #include "test_utils/angle_test_configs.h"
17 
18 struct DrawCallPerfParams : public RenderTestParams
19 {
20     // Common default options
21     DrawCallPerfParams();
22     ~DrawCallPerfParams() override;
23 
24     std::string story() const override;
25 
26     double runTimeSeconds;
27     int numTris;
28 };
29 
30 namespace params
31 {
32 template <typename ParamsT>
D3D11(const ParamsT & in)33 ParamsT D3D11(const ParamsT &in)
34 {
35     ParamsT out       = in;
36     out.eglParameters = angle::egl_platform::D3D11();
37     return out;
38 }
39 
40 template <typename ParamsT>
GL(const ParamsT & in)41 ParamsT GL(const ParamsT &in)
42 {
43     ParamsT out       = in;
44     out.eglParameters = angle::egl_platform::OPENGL_OR_GLES();
45     return out;
46 }
47 
48 template <typename ParamsT>
GL3(const ParamsT & in)49 ParamsT GL3(const ParamsT &in)
50 {
51     ParamsT out       = in;
52     out.eglParameters = angle::egl_platform::OPENGL_OR_GLES(3, 0);
53     return out;
54 }
55 
56 template <typename ParamsT>
Vulkan(const ParamsT & in)57 ParamsT Vulkan(const ParamsT &in)
58 {
59     ParamsT out       = in;
60     out.eglParameters = angle::egl_platform::VULKAN();
61     return out;
62 }
63 
64 template <typename ParamsT>
VulkanMockICD(const ParamsT & in)65 ParamsT VulkanMockICD(const ParamsT &in)
66 {
67     ParamsT out       = in;
68     out.eglParameters = angle::egl_platform::VULKAN_NULL();
69     return out;
70 }
71 
72 template <typename ParamsT>
VulkanSwiftShader(const ParamsT & in)73 ParamsT VulkanSwiftShader(const ParamsT &in)
74 {
75     ParamsT out       = in;
76     out.eglParameters = angle::egl_platform::VULKAN_SWIFTSHADER();
77     return out;
78 }
79 
80 template <typename ParamsT>
WGL(const ParamsT & in)81 ParamsT WGL(const ParamsT &in)
82 {
83     ParamsT out = in;
84     out.driver  = angle::GLESDriverType::SystemWGL;
85     return out;
86 }
87 
88 template <typename ParamsT>
EGL(const ParamsT & in)89 ParamsT EGL(const ParamsT &in)
90 {
91     ParamsT out = in;
92     out.driver  = angle::GLESDriverType::SystemEGL;
93     return out;
94 }
95 
96 template <typename ParamsT>
Native(const ParamsT & in)97 ParamsT Native(const ParamsT &in)
98 {
99 #if defined(ANGLE_PLATFORM_WINDOWS)
100     return WGL(in);
101 #else
102     return EGL(in);
103 #endif
104 }
105 }  // namespace params
106 
107 #endif  // TESTS_PERF_TESTS_DRAW_CALL_PERF_PARAMS_H_
108