1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_overlay_widgets.py using data from overlay_widgets.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 // 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.498039215686;
52 widget->color[1] = 0.749019607843;
53 widget->color[2] = 1.0;
54 widget->color[3] = 1.0;
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.0;
75 widget->color[1] = 0.0;
76 widget->color[2] = 0.0;
77 widget->color[3] = 1.0;
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.0;
99 widget->color[1] = 0.0;
100 widget->color[2] = 0.0;
101 widget->color[3] = 1.0;
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.294117647059;
122 widget->color[1] = 0.78431372549;
123 widget->color[2] = 0.0;
124 widget->color[3] = 0.78431372549;
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.294117647059;
143 widget->description.color[1] = 0.78431372549;
144 widget->description.color[2] = 0.0;
145 widget->description.color[3] = 1.0;
146 }
147 }
148
149 {
150 RunningHistogram *widget = new RunningHistogram(50);
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.0;
165 widget->color[1] = 0.78431372549;
166 widget->color[2] = 0.294117647059;
167 widget->color[3] = 0.78431372549;
168 }
169 mState.mOverlayWidgets[WidgetId::VulkanSecondaryCommandBufferPoolWaste].reset(widget);
170 {
171 const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
172 const int32_t offsetX =
173 mState.mOverlayWidgets[WidgetId::VulkanSecondaryCommandBufferPoolWaste]->coords[0];
174 const int32_t offsetY =
175 mState.mOverlayWidgets[WidgetId::VulkanSecondaryCommandBufferPoolWaste]->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.0;
186 widget->description.color[1] = 0.78431372549;
187 widget->description.color[2] = 0.294117647059;
188 widget->description.color[3] = 1.0;
189 }
190 }
191 }
192
193 } // namespace gl
194