• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_overlay_widgets.py using data from overlay_widgets.json.
3 //
4 // Copyright 2019 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 // Overlay_autogen.cpp:
9 //   Autogenerated overlay widget declarations.
10 
11 #include "libANGLE/Overlay.h"
12 #include "libANGLE/OverlayWidgets.h"
13 #include "libANGLE/Overlay_font_autogen.h"
14 #include "libANGLE/renderer/driver_utils.h"
15 
16 namespace gl
17 {
18 using namespace overlay;
19 
20 namespace
21 {
GetFontSize(int fontSize,bool largeFont)22 int GetFontSize(int fontSize, bool largeFont)
23 {
24     if (largeFont && fontSize > 0)
25     {
26         return fontSize - 1;
27     }
28     return fontSize;
29 }
30 }  // anonymous namespace
31 
initOverlayWidgets()32 void Overlay::initOverlayWidgets()
33 {
34     const bool kLargeFont = rx::IsAndroid();
35 
36     {
37         PerSecond *widget = new PerSecond;
38         {
39             const int32_t fontSize = GetFontSize(kFontLayerMedium, kLargeFont);
40             const int32_t offsetX  = 10;
41             const int32_t offsetY  = 10;
42             const int32_t width    = 12 * kFontGlyphWidths[fontSize];
43             const int32_t height   = kFontGlyphHeights[fontSize];
44 
45             widget->type      = WidgetType::PerSecond;
46             widget->fontSize  = fontSize;
47             widget->coords[0] = offsetX;
48             widget->coords[1] = offsetY;
49             widget->coords[2] = offsetX + width;
50             widget->coords[3] = offsetY + height;
51             widget->color[0]  = 0.498039215686f;
52             widget->color[1]  = 0.749019607843f;
53             widget->color[2]  = 1.0f;
54             widget->color[3]  = 1.0f;
55         }
56         mState.mOverlayWidgets[WidgetId::FPS].reset(widget);
57     }
58 
59     {
60         Text *widget = new Text;
61         {
62             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
63             const int32_t offsetX  = 10;
64             const int32_t offsetY  = -10;
65             const int32_t width    = 150 * kFontGlyphWidths[fontSize];
66             const int32_t height   = kFontGlyphHeights[fontSize];
67 
68             widget->type      = WidgetType::Text;
69             widget->fontSize  = fontSize;
70             widget->coords[0] = offsetX;
71             widget->coords[1] = offsetY - height;
72             widget->coords[2] = offsetX + width;
73             widget->coords[3] = offsetY;
74             widget->color[0]  = 1.0f;
75             widget->color[1]  = 0.0f;
76             widget->color[2]  = 0.0f;
77             widget->color[3]  = 1.0f;
78         }
79         mState.mOverlayWidgets[WidgetId::VulkanLastValidationMessage].reset(widget);
80     }
81 
82     {
83         Count *widget = new Count;
84         {
85             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
86             const int32_t offsetX  = 10;
87             const int32_t offsetY =
88                 mState.mOverlayWidgets[WidgetId::VulkanLastValidationMessage]->coords[1];
89             const int32_t width  = 25 * kFontGlyphWidths[fontSize];
90             const int32_t height = kFontGlyphHeights[fontSize];
91 
92             widget->type      = WidgetType::Count;
93             widget->fontSize  = fontSize;
94             widget->coords[0] = offsetX;
95             widget->coords[1] = offsetY - height;
96             widget->coords[2] = offsetX + width;
97             widget->coords[3] = offsetY;
98             widget->color[0]  = 1.0f;
99             widget->color[1]  = 0.0f;
100             widget->color[2]  = 0.0f;
101             widget->color[3]  = 1.0f;
102         }
103         mState.mOverlayWidgets[WidgetId::VulkanValidationMessageCount].reset(widget);
104     }
105 
106     {
107         RunningGraph *widget = new RunningGraph(60);
108         {
109             const int32_t fontSize = GetFontSize(0, kLargeFont);
110             const int32_t offsetX  = 10;
111             const int32_t offsetY  = 100;
112             const int32_t width    = 5 * static_cast<uint32_t>(widget->runningValues.size());
113             const int32_t height   = 100;
114 
115             widget->type      = WidgetType::RunningGraph;
116             widget->fontSize  = fontSize;
117             widget->coords[0] = offsetX;
118             widget->coords[1] = offsetY;
119             widget->coords[2] = offsetX + width;
120             widget->coords[3] = offsetY + height;
121             widget->color[0]  = 0.294117647059f;
122             widget->color[1]  = 0.78431372549f;
123             widget->color[2]  = 0.0f;
124             widget->color[3]  = 0.78431372549f;
125         }
126         mState.mOverlayWidgets[WidgetId::VulkanRenderPassCount].reset(widget);
127         {
128             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
129             const int32_t offsetX =
130                 mState.mOverlayWidgets[WidgetId::VulkanRenderPassCount]->coords[0];
131             const int32_t offsetY =
132                 mState.mOverlayWidgets[WidgetId::VulkanRenderPassCount]->coords[1];
133             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
134             const int32_t height = kFontGlyphHeights[fontSize];
135 
136             widget->description.type      = WidgetType::Text;
137             widget->description.fontSize  = fontSize;
138             widget->description.coords[0] = offsetX;
139             widget->description.coords[1] = std::max(offsetY - height, 1);
140             widget->description.coords[2] = offsetX + width;
141             widget->description.coords[3] = offsetY;
142             widget->description.color[0]  = 0.294117647059f;
143             widget->description.color[1]  = 0.78431372549f;
144             widget->description.color[2]  = 0.0f;
145             widget->description.color[3]  = 1.0f;
146         }
147     }
148 
149     {
150         RunningHistogram *widget = new RunningHistogram(100);
151         {
152             const int32_t fontSize = GetFontSize(0, kLargeFont);
153             const int32_t offsetX  = -50;
154             const int32_t offsetY  = 100;
155             const int32_t width    = 6 * static_cast<uint32_t>(widget->runningValues.size());
156             const int32_t height   = 100;
157 
158             widget->type      = WidgetType::RunningHistogram;
159             widget->fontSize  = fontSize;
160             widget->coords[0] = offsetX - width;
161             widget->coords[1] = offsetY;
162             widget->coords[2] = offsetX;
163             widget->coords[3] = offsetY + height;
164             widget->color[0]  = 1.0f;
165             widget->color[1]  = 0.78431372549f;
166             widget->color[2]  = 0.294117647059f;
167             widget->color[3]  = 0.78431372549f;
168         }
169         mState.mOverlayWidgets[WidgetId::VulkanRenderPassBufferCount].reset(widget);
170         {
171             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
172             const int32_t offsetX =
173                 mState.mOverlayWidgets[WidgetId::VulkanRenderPassBufferCount]->coords[0];
174             const int32_t offsetY =
175                 mState.mOverlayWidgets[WidgetId::VulkanRenderPassBufferCount]->coords[1];
176             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
177             const int32_t height = kFontGlyphHeights[fontSize];
178 
179             widget->description.type      = WidgetType::Text;
180             widget->description.fontSize  = fontSize;
181             widget->description.coords[0] = offsetX;
182             widget->description.coords[1] = std::max(offsetY - height, 1);
183             widget->description.coords[2] = std::min(offsetX + width, -1);
184             widget->description.coords[3] = offsetY;
185             widget->description.color[0]  = 1.0f;
186             widget->description.color[1]  = 0.78431372549f;
187             widget->description.color[2]  = 0.294117647059f;
188             widget->description.color[3]  = 1.0f;
189         }
190     }
191 
192     {
193         RunningHistogram *widget = new RunningHistogram(50);
194         {
195             const int32_t fontSize = GetFontSize(0, kLargeFont);
196             const int32_t offsetX  = -50;
197             const int32_t offsetY  = 100;
198             const int32_t width    = 6 * static_cast<uint32_t>(widget->runningValues.size());
199             const int32_t height   = 100;
200 
201             widget->type      = WidgetType::RunningHistogram;
202             widget->fontSize  = fontSize;
203             widget->coords[0] = offsetX - width;
204             widget->coords[1] = offsetY;
205             widget->coords[2] = offsetX;
206             widget->coords[3] = offsetY + height;
207             widget->color[0]  = 1.0f;
208             widget->color[1]  = 0.78431372549f;
209             widget->color[2]  = 0.294117647059f;
210             widget->color[3]  = 0.78431372549f;
211         }
212         mState.mOverlayWidgets[WidgetId::VulkanSecondaryCommandBufferPoolWaste].reset(widget);
213         {
214             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
215             const int32_t offsetX =
216                 mState.mOverlayWidgets[WidgetId::VulkanSecondaryCommandBufferPoolWaste]->coords[0];
217             const int32_t offsetY =
218                 mState.mOverlayWidgets[WidgetId::VulkanSecondaryCommandBufferPoolWaste]->coords[1];
219             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
220             const int32_t height = kFontGlyphHeights[fontSize];
221 
222             widget->description.type      = WidgetType::Text;
223             widget->description.fontSize  = fontSize;
224             widget->description.coords[0] = offsetX;
225             widget->description.coords[1] = std::max(offsetY - height, 1);
226             widget->description.coords[2] = std::min(offsetX + width, -1);
227             widget->description.coords[3] = offsetY;
228             widget->description.color[0]  = 1.0f;
229             widget->description.color[1]  = 0.78431372549f;
230             widget->description.color[2]  = 0.294117647059f;
231             widget->description.color[3]  = 1.0f;
232         }
233     }
234 
235     {
236         RunningGraph *widget = new RunningGraph(60);
237         {
238             const int32_t fontSize = GetFontSize(0, kLargeFont);
239             const int32_t offsetX  = 10;
240             const int32_t offsetY  = 220;
241             const int32_t width    = 5 * static_cast<uint32_t>(widget->runningValues.size());
242             const int32_t height   = 100;
243 
244             widget->type      = WidgetType::RunningGraph;
245             widget->fontSize  = fontSize;
246             widget->coords[0] = offsetX;
247             widget->coords[1] = offsetY;
248             widget->coords[2] = offsetX + width;
249             widget->coords[3] = offsetY + height;
250             widget->color[0]  = 0.294117647059f;
251             widget->color[1]  = 0.78431372549f;
252             widget->color[2]  = 0.0f;
253             widget->color[3]  = 0.78431372549f;
254         }
255         mState.mOverlayWidgets[WidgetId::VulkanWriteDescriptorSetCount].reset(widget);
256         {
257             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
258             const int32_t offsetX =
259                 mState.mOverlayWidgets[WidgetId::VulkanWriteDescriptorSetCount]->coords[0];
260             const int32_t offsetY =
261                 mState.mOverlayWidgets[WidgetId::VulkanWriteDescriptorSetCount]->coords[1];
262             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
263             const int32_t height = kFontGlyphHeights[fontSize];
264 
265             widget->description.type      = WidgetType::Text;
266             widget->description.fontSize  = fontSize;
267             widget->description.coords[0] = offsetX;
268             widget->description.coords[1] = std::max(offsetY - height, 1);
269             widget->description.coords[2] = offsetX + width;
270             widget->description.coords[3] = offsetY;
271             widget->description.color[0]  = 0.294117647059f;
272             widget->description.color[1]  = 0.78431372549f;
273             widget->description.color[2]  = 0.0f;
274             widget->description.color[3]  = 1.0f;
275         }
276     }
277 
278     {
279         RunningGraph *widget = new RunningGraph(60);
280         {
281             const int32_t fontSize = GetFontSize(0, kLargeFont);
282             const int32_t offsetX  = -50;
283             const int32_t offsetY  = 250;
284             const int32_t width    = 6 * static_cast<uint32_t>(widget->runningValues.size());
285             const int32_t height   = 100;
286 
287             widget->type      = WidgetType::RunningGraph;
288             widget->fontSize  = fontSize;
289             widget->coords[0] = offsetX - width;
290             widget->coords[1] = offsetY;
291             widget->coords[2] = offsetX;
292             widget->coords[3] = offsetY + height;
293             widget->color[0]  = 1.0f;
294             widget->color[1]  = 0.0f;
295             widget->color[2]  = 0.294117647059f;
296             widget->color[3]  = 0.78431372549f;
297         }
298         mState.mOverlayWidgets[WidgetId::VulkanDescriptorSetAllocations].reset(widget);
299         {
300             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
301             const int32_t offsetX =
302                 mState.mOverlayWidgets[WidgetId::VulkanDescriptorSetAllocations]->coords[0];
303             const int32_t offsetY =
304                 mState.mOverlayWidgets[WidgetId::VulkanDescriptorSetAllocations]->coords[1];
305             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
306             const int32_t height = kFontGlyphHeights[fontSize];
307 
308             widget->description.type      = WidgetType::Text;
309             widget->description.fontSize  = fontSize;
310             widget->description.coords[0] = offsetX;
311             widget->description.coords[1] = std::max(offsetY - height, 1);
312             widget->description.coords[2] = std::min(offsetX + width, -1);
313             widget->description.coords[3] = offsetY;
314             widget->description.color[0]  = 1.0f;
315             widget->description.color[1]  = 0.0f;
316             widget->description.color[2]  = 0.294117647059f;
317             widget->description.color[3]  = 1.0f;
318         }
319     }
320 
321     {
322         RunningGraph *widget = new RunningGraph(60);
323         {
324             const int32_t fontSize = GetFontSize(0, kLargeFont);
325             const int32_t offsetX  = -50;
326             const int32_t offsetY  = 360;
327             const int32_t width    = 6 * static_cast<uint32_t>(widget->runningValues.size());
328             const int32_t height   = 100;
329 
330             widget->type      = WidgetType::RunningGraph;
331             widget->fontSize  = fontSize;
332             widget->coords[0] = offsetX - width;
333             widget->coords[1] = offsetY;
334             widget->coords[2] = offsetX;
335             widget->coords[3] = offsetY + height;
336             widget->color[0]  = 1.0f;
337             widget->color[1]  = 0.0f;
338             widget->color[2]  = 0.294117647059f;
339             widget->color[3]  = 0.78431372549f;
340         }
341         mState.mOverlayWidgets[WidgetId::VulkanShaderBufferDSHitRate].reset(widget);
342         {
343             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
344             const int32_t offsetX =
345                 mState.mOverlayWidgets[WidgetId::VulkanShaderBufferDSHitRate]->coords[0];
346             const int32_t offsetY =
347                 mState.mOverlayWidgets[WidgetId::VulkanShaderBufferDSHitRate]->coords[1];
348             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
349             const int32_t height = kFontGlyphHeights[fontSize];
350 
351             widget->description.type      = WidgetType::Text;
352             widget->description.fontSize  = fontSize;
353             widget->description.coords[0] = offsetX;
354             widget->description.coords[1] = std::max(offsetY - height, 1);
355             widget->description.coords[2] = std::min(offsetX + width, -1);
356             widget->description.coords[3] = offsetY;
357             widget->description.color[0]  = 1.0f;
358             widget->description.color[1]  = 0.0f;
359             widget->description.color[2]  = 0.294117647059f;
360             widget->description.color[3]  = 1.0f;
361         }
362     }
363 
364     {
365         RunningGraph *widget = new RunningGraph(120);
366         {
367             const int32_t fontSize = GetFontSize(0, kLargeFont);
368             const int32_t offsetX  = -50;
369             const int32_t offsetY  = -50;
370             const int32_t width    = 5 * static_cast<uint32_t>(widget->runningValues.size());
371             const int32_t height   = 100;
372 
373             widget->type      = WidgetType::RunningGraph;
374             widget->fontSize  = fontSize;
375             widget->coords[0] = offsetX - width;
376             widget->coords[1] = offsetY - height;
377             widget->coords[2] = offsetX;
378             widget->coords[3] = offsetY;
379             widget->color[0]  = 0.0f;
380             widget->color[1]  = 0.78431372549f;
381             widget->color[2]  = 0.294117647059f;
382             widget->color[3]  = 0.78431372549f;
383         }
384         mState.mOverlayWidgets[WidgetId::VulkanDynamicBufferAllocations].reset(widget);
385         {
386             const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
387             const int32_t offsetX =
388                 mState.mOverlayWidgets[WidgetId::VulkanDynamicBufferAllocations]->coords[2];
389             const int32_t offsetY =
390                 mState.mOverlayWidgets[WidgetId::VulkanDynamicBufferAllocations]->coords[1];
391             const int32_t width  = 40 * kFontGlyphWidths[fontSize];
392             const int32_t height = kFontGlyphHeights[fontSize];
393 
394             widget->description.type      = WidgetType::Text;
395             widget->description.fontSize  = fontSize;
396             widget->description.coords[0] = offsetX - width;
397             widget->description.coords[1] = offsetY - height;
398             widget->description.coords[2] = offsetX;
399             widget->description.coords[3] = offsetY;
400             widget->description.color[0]  = 0.0f;
401             widget->description.color[1]  = 0.78431372549f;
402             widget->description.color[2]  = 0.294117647059f;
403             widget->description.color[3]  = 1.0f;
404         }
405     }
406 }
407 
408 }  // namespace gl
409