• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2025 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 // Header file for both TracePerfTest and TracePerfTestCL
7 //
8 
9 #pragma once
10 
11 #include <gtest/gtest.h>
12 #include "tests/perf_tests/ANGLEPerfTest.h"
13 #include "tests/perf_tests/ANGLEPerfTestArgs.h"
14 #include "tests/test_expectations/GPUTestExpectationsParser.h"
15 #include "util/capture/frame_capture_test_utils.h"
16 #include "util/test_utils.h"
17 
18 namespace angle
19 {
20 
21 constexpr char kTraceTestFolder[] = "src/tests/restricted_traces";
22 constexpr size_t kMaxPath         = 1024;
23 
24 struct TracePerfParams final : public RenderTestParams
25 {
26     // Common default options
TracePerfParamsfinal27     TracePerfParams(const TraceInfo &traceInfoIn,
28                     GLESDriverType driverType,
29                     EGLenum platformType,
30                     EGLenum deviceType)
31         : traceInfo(traceInfoIn)
32     {
33         majorVersion = traceInfo.contextClientMajorVersion;
34         minorVersion = traceInfo.contextClientMinorVersion;
35         windowWidth  = traceInfo.drawSurfaceWidth;
36         windowHeight = traceInfo.drawSurfaceHeight;
37         colorSpace   = traceInfo.drawSurfaceColorSpace;
38         isCL         = traceInfo.isCL;
39 
40         // Display the frame after every drawBenchmark invocation
41         iterationsPerStep = 1;
42 
43         driver                   = driverType;
44         eglParameters.renderer   = platformType;
45         eglParameters.deviceType = deviceType;
46 
47         ASSERT(!gOffscreen || !gVsync);
48 
49         if (gOffscreen)
50         {
51             surfaceType = SurfaceType::Offscreen;
52         }
53         if (gVsync)
54         {
55             surfaceType = SurfaceType::WindowWithVSync;
56         }
57 
58         // Force on features if we're validating serialization.
59         if (gTraceTestValidation)
60         {
61             // Enable limits when validating traces because we usually turn off capture.
62             eglParameters.enable(Feature::EnableCaptureLimits);
63 
64             // This feature should also be enabled in capture to mirror the replay.
65             eglParameters.enable(Feature::ForceInitShaderVariables);
66         }
67     }
68 
storyfinal69     std::string story() const override
70     {
71         std::stringstream strstr;
72         strstr << RenderTestParams::story() << "_" << traceInfo.name;
73         return strstr.str();
74     }
75 
76     TraceInfo traceInfo = {};
77 };
78 
79 ANGLEPerfTest *CreateTracePerfTestCL(std::unique_ptr<const TracePerfParams> params);
80 
81 }  // namespace angle
82