• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_restricted_traces.py using data from restricted_traces.json
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // Types and enumerations for trace tests.
9 
10 #ifndef ANGLE_RESTRICTED_TRACES_H_
11 #define ANGLE_RESTRICTED_TRACES_H_
12 
13 #include "candy_crush_500/candy_crush_500_capture_context2.h"
14 #include "egypt_1500/egypt_1500_capture_context1.h"
15 #include "manhattan_10/manhattan_10_capture_context1.h"
16 #include "subway_surfer_500/subway_surfer_500_capture_context4.h"
17 #include "temple_run_300/temple_run_300_capture_context3.h"
18 #include "trex_200/trex_200_capture_context1.h"
19 
20 namespace angle
21 {
22 enum class RestrictedTraceID
23 {
24     egypt_1500,
25     manhattan_10,
26     temple_run_300,
27     trex_200,
28     subway_surfer_500,
29     candy_crush_500,
30     InvalidEnum,
31     EnumCount = InvalidEnum
32 };
33 
34 using ReplayFunc           = void (*)(uint32_t);
35 using ResetFunc            = void (*)();
36 using SetupFunc            = void (*)();
37 using DecompressFunc       = uint8_t *(*)(const std::vector<uint8_t> &);
38 using SetBinaryDataDirFunc = void (*)(const char *);
39 
40 static constexpr size_t kTraceInfoMaxNameLen = 32;
41 
42 struct TraceInfo
43 {
44     uint32_t startFrame;
45     uint32_t endFrame;
46     char name[kTraceInfoMaxNameLen];
47 };
48 
49 constexpr angle::PackedEnumMap<RestrictedTraceID, TraceInfo> kTraceInfos = {
50     {RestrictedTraceID::egypt_1500,
51      {egypt_1500::kReplayFrameStart, egypt_1500::kReplayFrameEnd, "egypt_1500"}},
52     {RestrictedTraceID::manhattan_10,
53      {manhattan_10::kReplayFrameStart, manhattan_10::kReplayFrameEnd, "manhattan_10"}},
54     {RestrictedTraceID::temple_run_300,
55      {temple_run_300::kReplayFrameStart, temple_run_300::kReplayFrameEnd, "temple_run_300"}},
56     {RestrictedTraceID::trex_200,
57      {trex_200::kReplayFrameStart, trex_200::kReplayFrameEnd, "trex_200"}},
58     {RestrictedTraceID::subway_surfer_500,
59      {subway_surfer_500::kReplayFrameStart, subway_surfer_500::kReplayFrameEnd,
60       "subway_surfer_500"}},
61     {RestrictedTraceID::candy_crush_500,
62      {candy_crush_500::kReplayFrameStart, candy_crush_500::kReplayFrameEnd, "candy_crush_500"}}};
63 
64 using DecompressCallback        = uint8_t *(*)(const std::vector<uint8_t> &);
65 using FramebufferChangeCallback = void (*)(void *userData, GLenum target, GLuint framebuffer);
66 
ReplayFrame(RestrictedTraceID traceID,uint32_t frameIndex)67 inline void ReplayFrame(RestrictedTraceID traceID, uint32_t frameIndex)
68 {
69     switch (traceID)
70     {
71         case RestrictedTraceID::egypt_1500:
72             egypt_1500::ReplayContext1Frame(frameIndex);
73             break;
74         case RestrictedTraceID::manhattan_10:
75             manhattan_10::ReplayContext1Frame(frameIndex);
76             break;
77         case RestrictedTraceID::temple_run_300:
78             temple_run_300::ReplayContext3Frame(frameIndex);
79             break;
80         case RestrictedTraceID::trex_200:
81             trex_200::ReplayContext1Frame(frameIndex);
82             break;
83         case RestrictedTraceID::subway_surfer_500:
84             subway_surfer_500::ReplayContext4Frame(frameIndex);
85             break;
86         case RestrictedTraceID::candy_crush_500:
87             candy_crush_500::ReplayContext2Frame(frameIndex);
88             break;
89         default:
90             fprintf(stderr, "Error in switch.\n");
91             assert(0);
92             break;
93     }
94 }
95 
ResetReplay(RestrictedTraceID traceID)96 inline void ResetReplay(RestrictedTraceID traceID)
97 {
98     switch (traceID)
99     {
100         case RestrictedTraceID::egypt_1500:
101             egypt_1500::ResetContext1Replay();
102             break;
103         case RestrictedTraceID::manhattan_10:
104             manhattan_10::ResetContext1Replay();
105             break;
106         case RestrictedTraceID::temple_run_300:
107             temple_run_300::ResetContext3Replay();
108             break;
109         case RestrictedTraceID::trex_200:
110             trex_200::ResetContext1Replay();
111             break;
112         case RestrictedTraceID::subway_surfer_500:
113             subway_surfer_500::ResetContext4Replay();
114             break;
115         case RestrictedTraceID::candy_crush_500:
116             candy_crush_500::ResetContext2Replay();
117             break;
118         default:
119             fprintf(stderr, "Error in switch.\n");
120             assert(0);
121             break;
122     }
123 }
124 
SetupReplay(RestrictedTraceID traceID)125 inline void SetupReplay(RestrictedTraceID traceID)
126 {
127     switch (traceID)
128     {
129         case RestrictedTraceID::egypt_1500:
130             egypt_1500::SetupContext1Replay();
131             break;
132         case RestrictedTraceID::manhattan_10:
133             manhattan_10::SetupContext1Replay();
134             break;
135         case RestrictedTraceID::temple_run_300:
136             temple_run_300::SetupContext3Replay();
137             break;
138         case RestrictedTraceID::trex_200:
139             trex_200::SetupContext1Replay();
140             break;
141         case RestrictedTraceID::subway_surfer_500:
142             subway_surfer_500::SetupContext4Replay();
143             break;
144         case RestrictedTraceID::candy_crush_500:
145             candy_crush_500::SetupContext2Replay();
146             break;
147         default:
148             fprintf(stderr, "Error in switch.\n");
149             assert(0);
150             break;
151     }
152 }
153 
SetBinaryDataDir(RestrictedTraceID traceID,const char * dataDir)154 inline void SetBinaryDataDir(RestrictedTraceID traceID, const char *dataDir)
155 {
156     switch (traceID)
157     {
158         case RestrictedTraceID::egypt_1500:
159             egypt_1500::SetBinaryDataDir(dataDir);
160             break;
161         case RestrictedTraceID::manhattan_10:
162             manhattan_10::SetBinaryDataDir(dataDir);
163             break;
164         case RestrictedTraceID::temple_run_300:
165             temple_run_300::SetBinaryDataDir(dataDir);
166             break;
167         case RestrictedTraceID::trex_200:
168             trex_200::SetBinaryDataDir(dataDir);
169             break;
170         case RestrictedTraceID::subway_surfer_500:
171             subway_surfer_500::SetBinaryDataDir(dataDir);
172             break;
173         case RestrictedTraceID::candy_crush_500:
174             candy_crush_500::SetBinaryDataDir(dataDir);
175             break;
176         default:
177             fprintf(stderr, "Error in switch.\n");
178             assert(0);
179             break;
180     }
181 }
182 
SetBinaryDataDecompressCallback(RestrictedTraceID traceID,DecompressCallback callback)183 inline void SetBinaryDataDecompressCallback(RestrictedTraceID traceID, DecompressCallback callback)
184 {
185     switch (traceID)
186     {
187         case RestrictedTraceID::egypt_1500:
188             egypt_1500::SetBinaryDataDecompressCallback(callback);
189             break;
190         case RestrictedTraceID::manhattan_10:
191             manhattan_10::SetBinaryDataDecompressCallback(callback);
192             break;
193         case RestrictedTraceID::temple_run_300:
194             temple_run_300::SetBinaryDataDecompressCallback(callback);
195             break;
196         case RestrictedTraceID::trex_200:
197             trex_200::SetBinaryDataDecompressCallback(callback);
198             break;
199         case RestrictedTraceID::subway_surfer_500:
200             subway_surfer_500::SetBinaryDataDecompressCallback(callback);
201             break;
202         case RestrictedTraceID::candy_crush_500:
203             candy_crush_500::SetBinaryDataDecompressCallback(callback);
204             break;
205         default:
206             fprintf(stderr, "Error in switch.\n");
207             assert(0);
208             break;
209     }
210 }
211 
SetFramebufferChangeCallback(RestrictedTraceID traceID,void * userData,FramebufferChangeCallback callback)212 inline void SetFramebufferChangeCallback(RestrictedTraceID traceID,
213                                          void *userData,
214                                          FramebufferChangeCallback callback)
215 {
216     switch (traceID)
217     {
218         case RestrictedTraceID::egypt_1500:
219             egypt_1500::SetFramebufferChangeCallback(userData, callback);
220             break;
221         case RestrictedTraceID::manhattan_10:
222             manhattan_10::SetFramebufferChangeCallback(userData, callback);
223             break;
224         case RestrictedTraceID::temple_run_300:
225             temple_run_300::SetFramebufferChangeCallback(userData, callback);
226             break;
227         case RestrictedTraceID::trex_200:
228             trex_200::SetFramebufferChangeCallback(userData, callback);
229             break;
230         case RestrictedTraceID::subway_surfer_500:
231             subway_surfer_500::SetFramebufferChangeCallback(userData, callback);
232             break;
233         case RestrictedTraceID::candy_crush_500:
234             candy_crush_500::SetFramebufferChangeCallback(userData, callback);
235             break;
236         default:
237             fprintf(stderr, "Error in switch.\n");
238             assert(0);
239             break;
240     }
241 }
242 }  // namespace angle
243 
244 #endif  // ANGLE_RESTRICTED_TRACES_H_
245