1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkCommonFlagsConfig.h"
9 #include "SkColorSpace_Base.h"
10 #include "Test.h"
11 #include <initializer_list>
12
13 using sk_gpu_test::GrContextFactory;
14
15 namespace {
16 // The code
17 // SkCommandLineFlags::StringArray FLAGS_config1 = make_string_array({"a", "b"})
18 // can be used to construct string array that one gets with command line flags.
19 // For example, the call above is equivalent of
20 // DEFINE_string(config1, "a b", "");
21 // in cases where the default command line flag value ("a b") is used.
22 // make_string_array can be used to construct StringArray strings that have spaces in
23 // them.
make_string_array(std::initializer_list<const char * > strings)24 SkCommandLineFlags::StringArray make_string_array(std::initializer_list<const char*> strings) {
25 SkTArray<SkString> array;
26 for (auto& s : strings) {
27 array.push_back(SkString(s));
28 }
29 return SkCommandLineFlags::StringArray(array);
30 }
31 }
DEF_TEST(ParseConfigs_Gpu,reporter)32 DEF_TEST(ParseConfigs_Gpu, reporter) {
33 // Parses a normal config and returns correct "tag".
34 // Simple GL config works
35 SkCommandLineFlags::StringArray config1 = make_string_array({"gl"});
36 SkCommandLineConfigArray configs;
37 ParseConfigs(config1, &configs);
38
39 REPORTER_ASSERT(reporter, configs.count() == 1);
40 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl"));
41 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0);
42 #if SK_SUPPORT_GPU
43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
44 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType()
45 == GrContextFactory::kGL_ContextType);
46 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false);
47 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseInstanced() == false);
48 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false);
49 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
50 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
51 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == nullptr);
52 #endif
53 }
54
DEF_TEST(ParseConfigs_OutParam,reporter)55 DEF_TEST(ParseConfigs_OutParam, reporter) {
56 // Clears the out parameter.
57 SkCommandLineFlags::StringArray config1 = make_string_array({"gles"});
58 SkCommandLineConfigArray configs;
59 ParseConfigs(config1, &configs);
60 REPORTER_ASSERT(reporter, configs.count() == 1);
61 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gles"));
62
63 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"});
64 ParseConfigs(config2, &configs);
65 REPORTER_ASSERT(reporter, configs.count() == 1);
66 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888"));
67
68 SkCommandLineFlags::StringArray config3 = make_string_array({"gl"});
69 ParseConfigs(config3, &configs);
70 REPORTER_ASSERT(reporter, configs.count() == 1);
71 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl"));
72 }
73
DEF_TEST(ParseConfigs_DefaultConfigs,reporter)74 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
75 // Parses all default configs and returns correct "tag".
76
77 SkCommandLineFlags::StringArray config1 = make_string_array({
78 "565", "8888", "debuggl", "gl", "gldft", "nullgl", "glmsaa8", "glmsaa4",
79 "nonrendering", "nullgl", "gles", "glnvpr8", "glnvpr4", "glnvprdit8", "glesnvprdit4",
80 "pdf", "skp", "svg", "xps", "angle_d3d11_es2", "angle_gl_es2", "commandbuffer", "mesa",
81 "hwui", "glf16", "glessrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk",
82 "glinst", "glinst4", "glinstdit4", "glinst8", "glinstdit8", "glesinst", "glesinst4",
83 "glesinstdit4", "glwide", "glnarrow"
84 });
85
86 SkCommandLineConfigArray configs;
87 ParseConfigs(config1, &configs);
88
89 auto srgbColorSpace = SkColorSpace::MakeSRGB();
90
91 REPORTER_ASSERT(reporter, configs.count() == config1.count());
92 for (int i = 0; i < config1.count(); ++i) {
93 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
94 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0);
95 }
96 #if SK_SUPPORT_GPU
97 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu());
98 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
99 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu());
100 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu());
101 REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getUseDIText());
102 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu());
103 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 8);
104 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 4);
105 REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu());
106 REPORTER_ASSERT(reporter, configs[9]->asConfigGpu());
107 REPORTER_ASSERT(reporter, configs[10]->asConfigGpu());
108 REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()->getSamples() == 8);
109 REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()->getUseNVPR());
110 REPORTER_ASSERT(reporter, !configs[11]->asConfigGpu()->getUseDIText());
111 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getSamples() == 4);
112 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseNVPR());
113 REPORTER_ASSERT(reporter, !configs[12]->asConfigGpu()->getUseDIText());
114 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 8);
115 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseNVPR());
116 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseDIText());
117 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getSamples() == 4);
118 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseNVPR());
119 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseDIText());
120 REPORTER_ASSERT(reporter, !configs[15]->asConfigGpu());
121 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu());
122 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu());
123 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu());
124 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu());
125 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
126 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorSpace());
127 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorSpace()->gammaIsLinear());
128 const SkMatrix44* srgbXYZ = as_CSB(srgbColorSpace)->toXYZD50();
129 SkASSERT(srgbXYZ);
130 const SkMatrix44* config25XYZ =
131 as_CSB(configs[24]->asConfigGpu()->getColorSpace())->toXYZD50();
132 SkASSERT(config25XYZ);
133 REPORTER_ASSERT(reporter, *config25XYZ == *srgbXYZ);
134 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
135 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
136 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
137 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getColorSpace());
138 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getColorSpace()->gammaIsLinear());
139 const SkMatrix44* config41XYZ =
140 as_CSB(configs[40]->asConfigGpu()->getColorSpace())->toXYZD50();
141 SkASSERT(config41XYZ);
142 REPORTER_ASSERT(reporter, *config41XYZ != *srgbXYZ);
143 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getContextType() ==
144 GrContextFactory::kGL_ContextType);
145 REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
146 REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorSpace());
147 REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorSpace()->gammaIsLinear());
148 REPORTER_ASSERT(reporter, *as_CSB(configs[41]->asConfigGpu()->getColorSpace())->toXYZD50() !=
149 *as_CSB(srgbColorSpace)->toXYZD50());
150 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getUseInstanced());
151 REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getContextType() ==
152 GrContextFactory::kGL_ContextType);
153 REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getUseInstanced());
154 REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getSamples() == 4);
155 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getContextType() ==
156 GrContextFactory::kGL_ContextType);
157 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getUseInstanced());
158 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getUseDIText());
159 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getSamples() == 4);
160 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getContextType() ==
161 GrContextFactory::kGL_ContextType);
162 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getUseInstanced());
163 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getSamples() == 8);
164 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getContextType() ==
165 GrContextFactory::kGL_ContextType);
166 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getUseInstanced());
167 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getUseDIText());
168 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getSamples() == 8);
169 REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getContextType() ==
170 GrContextFactory::kGLES_ContextType);
171 REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getUseInstanced());
172 REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getContextType() ==
173 GrContextFactory::kGLES_ContextType);
174 REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getUseInstanced());
175 REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getSamples() == 4);
176 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getContextType() ==
177 GrContextFactory::kGLES_ContextType);
178 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getUseInstanced());
179 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getUseDIText());
180 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getSamples() == 4);
181 REPORTER_ASSERT(reporter, configs[19]->asConfigGpu());
182 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu());
183 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu());
184 #if SK_MESA
185 REPORTER_ASSERT(reporter, configs[23]->asConfigGpu());
186 #else
187 REPORTER_ASSERT(reporter, !configs[22]->asConfigGpu());
188 #endif
189 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu());
190 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu());
191 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getSamples() == 4);
192 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getUseNVPR());
193 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu());
194 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getSamples() == 4);
195 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseNVPR());
196 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseDIText());
197 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu());
198 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
199 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
200 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu());
201 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getSamples() == 4);
202 #ifdef SK_VULKAN
203 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu());
204 #endif
205 #endif
206 }
207
DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect,reporter)208 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
209 SkCommandLineFlags::StringArray config1 = make_string_array({
210 "gpu[api=gl,nvpr=true,dit=false]",
211 "gpu[api=angle_d3d9_es2]",
212 "gpu[api=angle_gl_es3]",
213 "gpu[api=mesa,samples=77]",
214 "gpu[dit=true,api=commandbuffer]",
215 "gpu[api=gles]",
216 "gpu[api=gl]",
217 "gpu[api=vulkan]",
218 });
219
220 SkCommandLineConfigArray configs;
221 ParseConfigs(config1, &configs);
222 REPORTER_ASSERT(reporter, configs.count() == config1.count());
223 for (int i = 0; i < config1.count(); ++i) {
224 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
225 }
226 #if SK_SUPPORT_GPU
227 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() ==
228 GrContextFactory::kGL_ContextType);
229 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR());
230 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText());
231 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
232 REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() ==
233 GrContextFactory::kANGLE_D3D9_ES2_ContextType);
234 REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
235 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()->getContextType() ==
236 GrContextFactory::kANGLE_GL_ES3_ContextType);
237 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu());
238 #if SK_MESA
239 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()->getContextType() ==
240 GrContextFactory::kMESA_ContextType);
241 #else
242 REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu());
243 #endif
244 REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getContextType() ==
245 GrContextFactory::kCommandBuffer_ContextType);
246 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() ==
247 GrContextFactory::kGLES_ContextType);
248 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR());
249 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText());
250 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0);
251 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() ==
252 GrContextFactory::kGL_ContextType);
253 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR());
254 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText());
255 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0);
256 #ifdef SK_VULKAN
257 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() ==
258 GrContextFactory::kVulkan_ContextType);
259 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR());
260 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText());
261 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0);
262 #endif
263 #endif
264 }
265
DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect,reporter)266 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
267 SkCommandLineFlags::StringArray config1 = make_string_array({
268 "gpu[api=gl,nvpr=1]", // Number as bool.
269 "gpu[api=gl,]", // Trailing in comma.
270 "gpu[api=angle_glu]", // Unknown api.
271 "gpu[api=,samples=0]", // Empty api.
272 "gpu[api=gl,samples=true]", // Value true as a number.
273 "gpu[api=gl,samples=0,samples=0]", // Duplicate option key.
274 "gpu[,api=gl,samples=0]", // Leading comma.
275 "gpu[samples=54", // Missing closing parenthesis.
276 ",,",
277 "gpu[]", // Missing required api specifier
278 "gpu[samples=4]", // Missing required api specifier
279 "gpu[", // Missing bracket.
280 "samples=54" // No backend.
281 "gpu[nvpr=true ]", // Space.
282 });
283
284 SkCommandLineConfigArray configs;
285 ParseConfigs(config1, &configs);
286 REPORTER_ASSERT(reporter, configs.count() == config1.count());
287 for (int i = 0; i < config1.count(); ++i) {
288 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
289 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i]));
290 #if SK_SUPPORT_GPU
291 REPORTER_ASSERT(reporter, !configs[i]->asConfigGpu());
292 #endif
293 }
294 }
295
DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises,reporter)296 DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) {
297 // These just list explicitly some properties of the system.
298 SkCommandLineFlags::StringArray config1 = make_string_array({
299 // Options are not canonized -> two same configs have a different tag.
300 "gpu[api=gl,nvpr=true,dit=true]", "gpu[api=gl,dit=true,nvpr=true]",
301 "gpu[api=debuggl]", "gpu[api=gl]", "gpu[api=gles]", ""
302 "gpu[api=gl]", "gpu[api=gl,samples=0]", "gpu[api=gles,samples=0]"
303 });
304 SkCommandLineConfigArray configs;
305 ParseConfigs(config1, &configs);
306 REPORTER_ASSERT(reporter, configs.count() == config1.count());
307 for (int i = 0; i < config1.count(); ++i) {
308 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
309 #if SK_SUPPORT_GPU
310 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals("gpu"));
311 REPORTER_ASSERT(reporter, configs[i]->asConfigGpu());
312 #else
313 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i]));
314 #endif
315 }
316 }
DEF_TEST(ParseConfigs_ViaParsing,reporter)317 DEF_TEST(ParseConfigs_ViaParsing, reporter) {
318 SkCommandLineFlags::StringArray config1 = make_string_array({
319 "a-b-c-8888",
320 "zz-qq-gpu",
321 "a-angle_gl_es2"
322 });
323
324 SkCommandLineConfigArray configs;
325 ParseConfigs(config1, &configs);
326 const struct {
327 const char* backend;
328 const char* vias[3];
329 } expectedConfigs[] = {
330 {"8888", {"a", "b", "c"}},
331 {"gpu", {"zz", "qq", nullptr}},
332 {"gpu", { "a", nullptr, nullptr }}
333 };
334 for (int i = 0; i < config1.count(); ++i) {
335 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
336 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(expectedConfigs[i].backend));
337 for (int j = 0; j < static_cast<int>(SK_ARRAY_COUNT(expectedConfigs[i].vias)); ++j) {
338 if (!expectedConfigs[i].vias[j]) {
339 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == j);
340 break;
341 }
342 REPORTER_ASSERT(reporter,
343 configs[i]->getViaParts()[j].equals(expectedConfigs[i].vias[j]));
344 }
345 }
346 }
347
DEF_TEST(ParseConfigs_ViaParsingExtendedForm,reporter)348 DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
349 SkCommandLineFlags::StringArray config1 = make_string_array({
350 "zz-qq-gpu[api=gles]",
351 "abc-nbc-cbs-gpu[api=angle_d3d9_es2,samples=1]",
352 "a-gpu[api=gl",
353 "abc-def-angle_gl_es2[api=gles]",
354 });
355
356 SkCommandLineConfigArray configs;
357 ParseConfigs(config1, &configs);
358 const struct {
359 const char* backend;
360 const char* vias[3];
361 } expectedConfigs[] = {
362 #if SK_SUPPORT_GPU
363 {"gpu", {"zz", "qq", nullptr}},
364 {"gpu", {"abc", "nbc", "cbs"}},
365 #else
366 {"gpu[api=gles]", {"zz", "qq", nullptr}},
367 {"gpu[api=angle_d3d9_es2,samples=1]", {"abc", "nbc", "cbs"}},
368 #endif
369 {"gpu[api=gl", {"a", nullptr, nullptr}}, // Missing bracket makes this is not extended
370 // form but via still works as expected.
371 {"angle_gl_es2[api=gles]", {"abc", "def", nullptr}} // This is not extended form.
372 // angle_gl_es2 is an api type not a
373 // backend.
374 };
375 for (int i = 0; i < config1.count(); ++i) {
376 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
377 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(expectedConfigs[i].backend));
378 for (int j = 0; j < static_cast<int>(SK_ARRAY_COUNT(expectedConfigs[i].vias)); ++j) {
379 if (!expectedConfigs[i].vias[j]) {
380 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() ==
381 static_cast<int>(j));
382 break;
383 }
384 REPORTER_ASSERT(reporter,
385 configs[i]->getViaParts()[j].equals(expectedConfigs[i].vias[j]));
386 }
387 }
388 #if SK_SUPPORT_GPU
389 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
390 REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
391 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
392 REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu());
393 #endif
394 }
395