OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCommonFlagsConfig.h" | 8 #include "SkCommonFlagsConfig.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include <initializer_list> | 10 #include <initializer_list> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl")); | 70 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl")); |
71 } | 71 } |
72 | 72 |
73 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { | 73 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { |
74 // Parses all default configs and returns correct "tag". | 74 // Parses all default configs and returns correct "tag". |
75 | 75 |
76 SkCommandLineFlags::StringArray config1 = make_string_array({ | 76 SkCommandLineFlags::StringArray config1 = make_string_array({ |
77 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", | 77 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", |
78 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", | 78 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", |
79 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", | 79 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", |
80 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4" | 80 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4",
"vk" |
81 }); | 81 }); |
82 | 82 |
83 SkCommandLineConfigArray configs; | 83 SkCommandLineConfigArray configs; |
84 ParseConfigs(config1, &configs); | 84 ParseConfigs(config1, &configs); |
85 | 85 |
86 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 86 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
87 for (int i = 0; i < config1.count(); ++i) { | 87 for (int i = 0; i < config1.count(); ++i) { |
88 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 88 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
89 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); | 89 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); |
90 } | 90 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()); | 154 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()); |
155 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4); | 155 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4); |
156 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR()); | 156 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR()); |
157 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseDIText()); | 157 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseDIText()); |
158 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()); | 158 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()); |
159 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorType() == kN3
2_SkColorType); | 159 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorType() == kN3
2_SkColorType); |
160 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getProfileType() == | 160 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getProfileType() == |
161 kSRGB_SkColorProfileType); | 161 kSRGB_SkColorProfileType); |
162 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()); | 162 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()); |
163 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4); | 163 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4); |
| 164 #ifdef SK_VULKAN |
| 165 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()); |
| 166 #endif |
164 #endif | 167 #endif |
165 } | 168 } |
166 | 169 |
167 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { | 170 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { |
168 SkCommandLineFlags::StringArray config1 = make_string_array({ | 171 SkCommandLineFlags::StringArray config1 = make_string_array({ |
169 "gpu(nvpr=true,dit=false)", | 172 "gpu(nvpr=true,dit=false)", |
170 "gpu(api=angle)", | 173 "gpu(api=angle)", |
171 "gpu(api=angle-gl)", | 174 "gpu(api=angle-gl)", |
172 "gpu(api=mesa,samples=77)", | 175 "gpu(api=mesa,samples=77)", |
173 "gpu(dit=true,api=commandbuffer)", | 176 "gpu(dit=true,api=commandbuffer)", |
174 "gpu()", | 177 "gpu()", |
175 "gpu(api=gles)", | 178 "gpu(api=gles)", |
176 "gpu(api=gl)" | 179 "gpu(api=gl)", |
| 180 "gpu(api=vulkan)", |
177 }); | 181 }); |
178 | 182 |
179 SkCommandLineConfigArray configs; | 183 SkCommandLineConfigArray configs; |
180 ParseConfigs(config1, &configs); | 184 ParseConfigs(config1, &configs); |
181 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 185 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
182 for (int i = 0; i < config1.count(); ++i) { | 186 for (int i = 0; i < config1.count(); ++i) { |
183 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 187 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
184 } | 188 } |
185 #if SK_SUPPORT_GPU | 189 #if SK_SUPPORT_GPU |
186 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == | 190 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == | 226 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == |
223 GrContextFactory::kGLES_ContextType); | 227 GrContextFactory::kGLES_ContextType); |
224 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); | 228 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); |
225 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); | 229 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); |
226 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); | 230 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); |
227 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == | 231 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == |
228 GrContextFactory::kGL_ContextType); | 232 GrContextFactory::kGL_ContextType); |
229 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); | 233 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); |
230 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); | 234 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); |
231 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); | 235 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); |
| 236 #ifdef SK_VULKAN |
| 237 REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() == |
| 238 GrContextFactory::kVulkan_ContextType); |
| 239 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); |
| 240 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); |
| 241 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); |
232 #endif | 242 #endif |
| 243 #endif |
233 } | 244 } |
234 | 245 |
235 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { | 246 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { |
236 SkCommandLineFlags::StringArray config1 = make_string_array({ | 247 SkCommandLineFlags::StringArray config1 = make_string_array({ |
237 "gpu(nvpr=1)", // Number as bool. | 248 "gpu(nvpr=1)", // Number as bool. |
238 "gpu(api=gl,)", // Trailing in comma. | 249 "gpu(api=gl,)", // Trailing in comma. |
239 "gpu(api=angle-glu)", // Unknown api. | 250 "gpu(api=angle-glu)", // Unknown api. |
240 "gpu(api=,samples=0)", // Empty api. | 251 "gpu(api=,samples=0)", // Empty api. |
241 "gpu(samples=true)", // Value true as a number. | 252 "gpu(samples=true)", // Value true as a number. |
242 "gpu(samples=0,samples=0)", // Duplicate option key. | 253 "gpu(samples=0,samples=0)", // Duplicate option key. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 REPORTER_ASSERT(reporter, | 359 REPORTER_ASSERT(reporter, |
349 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); | 360 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); |
350 } | 361 } |
351 } | 362 } |
352 #if SK_SUPPORT_GPU | 363 #if SK_SUPPORT_GPU |
353 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 364 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
354 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 365 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
355 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); | 366 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); |
356 #endif | 367 #endif |
357 } | 368 } |
OLD | NEW |