Flutter Engine
The Flutter Engine
SkSLTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
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
11#include "include/core/SkData.h"
14#include "include/core/SkRect.h"
17#include "include/core/SkSpan.h"
40#include "src/sksl/SkSLUtil.h"
54#include "tests/Test.h"
55#include "tools/Resources.h"
56
57#include <algorithm>
58#include <cstddef>
59#include <cstdint>
60#include <memory>
61#include <regex>
62#include <string>
63#include <string_view>
64#include <vector>
65
66#if defined(SK_GRAPHITE)
74#if defined(SK_DAWN)
76#endif
77#endif
78
79using namespace skia_private;
80
81namespace SkSL { class Context; }
82struct GrContextOptions;
83
84static constexpr int kWidth = 2;
85static constexpr int kHeight = 2;
86
87enum class SkSLTestFlag : int {
88 /** `CPU` tests must pass when painted to a CPU-backed surface via SkRuntimeEffect. */
89 CPU = 1 << 0,
90
91 /**
92 * `ES3` tests must pass when executed directly on the CPU via the SkRasterPipeline backend.
93 * They aren't compatible with SkRuntimeEffect, since they use non-ES2 features.
94 */
95 ES3 = 1 << 1,
96
97 /** `GPU` tests must pass when painted to a GPU-backed surface via SkRuntimeEffect. */
98 GPU = 1 << 2,
99
100 /** `GPU_ES3` tests must pass on ES3-compatible GPUs when "enforce ES2 restrictions" is off. */
101 GPU_ES3 = 1 << 3,
102
103 /**
104 * `UsesNaN` tests rely on NaN values, so they are only expected to pass on GPUs that generate
105 * them (which is not a requirement, even with ES3).
106 */
107 UsesNaN = 1 << 4,
108};
109
111
112static constexpr bool is_cpu(SkSLTestFlags flags) {
114}
115
116static constexpr bool is_gpu(SkSLTestFlags flags) {
118}
119
120static constexpr bool is_strict_es2(SkSLTestFlags flags) {
122}
123
125 std::string_view name;
127};
128
129static constexpr float kUniformColorBlack[] = {0.0f, 0.0f, 0.0f, 1.0f};
130static constexpr float kUniformColorRed [] = {1.0f, 0.0f, 0.0f, 1.0f};
131static constexpr float kUniformColorGreen[] = {0.0f, 1.0f, 0.0f, 1.0f};
132static constexpr float kUniformColorBlue [] = {0.0f, 0.0f, 1.0f, 1.0f};
133static constexpr float kUniformColorWhite[] = {1.0f, 1.0f, 1.0f, 1.0f};
134static constexpr float kUniformTestInputs[] = {-1.25f, 0.0f, 0.75f, 2.25f};
135static constexpr float kUniformUnknownInput[] = {1.0f};
136static constexpr float kUniformTestMatrix2x2[] = {1.0f, 2.0f,
137 3.0f, 4.0f};
138static constexpr float kUniformTestMatrix3x3[] = {1.0f, 2.0f, 3.0f,
139 4.0f, 5.0f, 6.0f,
140 7.0f, 8.0f, 9.0f};
141static constexpr float kUniformTestMatrix4x4[] = {1.0f, 2.0f, 3.0f, 4.0f,
142 5.0f, 6.0f, 7.0f, 8.0f,
143 9.0f, 10.0f, 11.0f, 12.0f,
144 13.0f, 14.0f, 15.0f, 16.0f};
145static constexpr float kUniformTestArray[] = {1, 2, 3, 4, 5};
146static constexpr float kUniformTestArrayNegative[] = {-1, -2, -3, -4, -5};
147
148static constexpr UniformData kUniformData[] = {
149 {"colorBlack", kUniformColorBlack},
150 {"colorRed", kUniformColorRed},
151 {"colorGreen", kUniformColorGreen},
152 {"colorBlue", kUniformColorBlue},
153 {"colorWhite", kUniformColorWhite},
154 {"testInputs", kUniformTestInputs},
155 {"unknownInput", kUniformUnknownInput},
156 {"testMatrix2x2", kUniformTestMatrix2x2},
157 {"testMatrix3x3", kUniformTestMatrix3x3},
158 {"testMatrix4x4", kUniformTestMatrix4x4},
159 {"testArray", kUniformTestArray},
160 {"testArrayNegative", kUniformTestArrayNegative},
161};
162
165 sk_sp<SkRuntimeEffect> effect) {
166
168 for (const UniformData& data : kUniformData) {
170 if (uniform.fVar) {
171 uniform.set(data.span.data(), data.span.size());
172 }
173 }
174
175 sk_sp<SkShader> shader = builder.makeShader();
176 if (!shader) {
177 return SkBitmap{};
178 }
179
180 surface->getCanvas()->clear(SK_ColorBLACK);
181
182 SkPaint paintShader;
183 paintShader.setShader(shader);
184 surface->getCanvas()->drawRect(SkRect::MakeWH(kWidth, kHeight), paintShader);
185
187 REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
188 REPORTER_ASSERT(r, surface->readPixels(bitmap, /*srcX=*/0, /*srcY=*/0));
189 return bitmap;
190}
191
193#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
194 // The Metal shader compiler (which is also used under-the-hood for some GL/GLES contexts on
195 // these platforms) enables fast-math by default. That prevents NaN-based tests from passing:
196 // https://developer.apple.com/documentation/metal/mtlcompileoptions/1515914-fastmathenabled
197 return false;
198#else
199 // If we don't have infinity support, we definitely won't generate NaNs
200 if (!ctx->priv().caps()->shaderCaps()->fInfinitySupport) {
201 return false;
202 }
203
205 #version 300
206 uniform half4 colorGreen, colorRed;
207
208 half4 main(float2 xy) {
209 return isnan(colorGreen.r / colorGreen.b) ? colorGreen : colorRed;
210 }
211 )")).effect;
212 REPORTER_ASSERT(r, effect);
213
216
217 SkBitmap bitmap = bitmap_from_shader(r, surface.get(), effect);
218 REPORTER_ASSERT(r, !bitmap.empty());
219
220 SkColor color = bitmap.getColor(0, 0);
222 return color == SK_ColorGREEN;
223#endif
224}
225
227 const char* testFile,
228 const char* permutationSuffix) {
229 SkString resourcePath = SkStringPrintf("sksl/%s", testFile);
230 sk_sp<SkData> shaderData = GetResourceAsData(resourcePath.c_str());
231 if (!shaderData) {
232 ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
233 return SkString("");
234 }
235 return SkString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
236}
237
238static bool failure_is_expected(std::string_view deviceName, // "Geforce RTX4090"
239 std::string_view backendAPI, // "OpenGL"
240 std::string_view name, // "MatrixToVectorCast"
241 skiatest::TestType testType) { // skiatest::TestType::kGraphite
242 enum TestTypeMatcher { CPU, Ganesh, Graphite, GPU /* either Ganesh or Graphite */ };
243
244 struct TestDisable {
245 std::optional<std::regex> deviceName;
246 std::optional<std::string_view> backendAPI;
247 std::optional<TestTypeMatcher> testTypeMatcher;
248 std::optional<bool> platform;
249 };
250
252
253 // TODO(b/40044139): migrate test-disable list from dm_flags into this map
254 static SkNoDestructor<TestDisableMap> testDisableMap{[] {
255 #define ADRENO "Adreno \\(TM\\) "
256 #define NVIDIA "(Tegra|Quadro|RTX|GTX) "
257
258 TestDisableMap disables;
259 constexpr std::nullopt_t _ = std::nullopt;
260 using regex = std::regex;
261
262#if defined(SK_BUILD_FOR_UNIX)
263 constexpr bool kLinux = true;
264#else
265 constexpr bool kLinux = false;
266#endif
267#if defined(SK_BUILD_FOR_MAC)
268 constexpr bool kMac = true;
269#else
270 constexpr bool kMac = false;
271#endif
272#if defined(SK_BUILD_FOR_IOS)
273 constexpr bool kiOS = true;
274#else
275 constexpr bool kiOS = false;
276#endif
277#if defined(SK_BUILD_FOR_WIN)
278 constexpr bool kWindows = true;
279#else
280 constexpr bool kWindows = false;
281#endif
282#if defined(SK_BUILD_FOR_ANDROID)
283 constexpr bool kAndroid = true;
284#else
285 constexpr bool kAndroid = false;
286#endif
287
288 // - Apple --------------------------------------------------------------------------------
289 // MacOS/iOS do not handle short-circuit evaluation properly in OpenGL (chromium:307751)
290 for (const char* test : {"LogicalAndShortCircuit",
291 "LogicalOrShortCircuit"}) {
292 disables[test].push_back({_, "OpenGL", GPU, kMac || kiOS});
293 }
294
295 // ANGLE has a handful of Mac-specific bugs.
296 for (const char* test : {"MatrixScalarNoOpFolding", // anglebug.com/7525
297 "MatrixScalarMath", // anglebug.com/7525
298 "SwizzleIndexStore", // Apple bug FB12055941
299 "OutParamsAreDistinctFromGlobal", // anglebug.com/7145
300 "IntrinsicMixFloatES3"}) { // anglebug.com/7245
301 disables[test].push_back({_, "ANGLE", GPU, kMac});
302 }
303
304 // Switch fallthrough has some issues on iOS.
305 for (const char* test : {"SwitchWithFallthrough",
306 "SwitchWithFallthroughGroups"}) {
307 disables[test].push_back({_, "OpenGL", GPU, kiOS});
308 }
309
310 // - ARM ----------------------------------------------------------------------------------
311 // Mali 400 is a very old driver its share of quirks, particularly in relation to matrices.
312 for (const char* test : {"Matrices", // b/40043539
313 "MatrixNoOpFolding",
314 "MatrixScalarMath", // b/40043764
315 "MatrixSwizzleStore",
316 "MatrixScalarNoOpFolding", // b/40044644
317 "UnaryPositiveNegative",
318 "Cross"}) {
319 disables[test].push_back({regex("Mali-400"), _, GPU, _});
320 }
321
322 // - Nvidia -------------------------------------------------------------------------------
323 // Tegra3 has several issues, but the inability to break from a for loop is a common theme.
324 for (const char* test : {"Switch", // b/40043561
325 "SwitchDefaultOnly", // " "
326 "SwitchWithFallthrough", // " "
327 "SwitchWithFallthroughAndVarDecls", // " "
328 "SwitchWithFallthroughGroups", // " "
329 "SwitchWithLoops", // " "
330 "SwitchCaseFolding", // " "
331 "LoopFloat", // " "
332 "LoopInt", // " "
333 "MatrixScalarNoOpFolding", // b/40044644
334 "MatrixScalarMath", // b/40043764
335 "MatrixFoldingES2", // b/40043017
336 "MatrixEquality", // b/40043017
337 "IntrinsicFract",
338 "ModifiedStructParametersCannotBeInlined"}) {
339 disables[test].push_back({regex("Tegra 3"), _, GPU, _});
340 }
341
342 // Various Nvidia GPUs generate errors when assembling weird matrices, and erroneously
343 // constant-fold expressions with side-effects in constructors when compiling GLSL.
344 for (const char* test : {"MatrixConstructorsES2", // b/40043524
345 "MatrixConstructorsES3", // b/40043524
346 "MatrixScalarNoOpFolding", // b/40044644
347 "PreserveSideEffects", // b/40044140
348 "StructFieldNoFolding"}) { // b/40044479
349 disables[test].push_back({regex(NVIDIA), "OpenGL", _, _});
350 disables[test].push_back({regex(NVIDIA), "ANGLE GL", _, _});
351 }
352
353 disables["IntrinsicMixFloatES3"].push_back({regex("RTX "), "Vulkan", _, kWindows});
354
355 // The Golo features P400s with older and buggier drivers than usual.
356 for (const char* test : {"PreserveSideEffects", // b/40044140
357 "CommaSideEffects"}) {
358 disables[test].push_back({regex("Quadro P400"), _, _, kLinux});
359 }
360
361 // b/318725123
362 for (const char* test : {"UniformArray",
363 "TemporaryIndexLookup",
364 "MatrixIndexLookup"}) {
365 disables[test].push_back({regex("Quadro P400"), "Dawn Vulkan", Graphite, kWindows});
366 }
367
368 // - PowerVR ------------------------------------------------------------------------------
369 for (const char* test : {"OutParamsAreDistinct", // b/40044222
370 "OutParamsAreDistinctFromGlobal"}) {
371 disables[test].push_back({regex("PowerVR Rogue GE8300"), _, GPU, _});
372 }
373
374 // - Radeon -------------------------------------------------------------------------------
375 for (const char* test : {"DeadReturnES3", // b/301326132
376 "IntrinsicAll", // b/40045114
377 "MatrixConstructorsES3", // b/40043524
378 "MatrixScalarNoOpFolding", // b/40044644
379 "StructIndexStore", // b/40045236
380 "SwizzleIndexLookup", // b/40045254
381 "SwizzleIndexStore"}) { // b/40045254
382 disables[test].push_back({regex("Radeon.*(R9|HD)"), "OpenGL", GPU, _});
383 disables[test].push_back({regex("Radeon.*(R9|HD)"), "ANGLE GL", GPU, _});
384 }
385
386 // The Radeon Vega 6 doesn't return zero for the derivative of a uniform.
387 for (const char* test : {"IntrinsicDFdy",
388 "IntrinsicDFdx",
389 "IntrinsicFwidth"}) {
390 disables[test].push_back({regex("AMD RADV RENOIR"), _, GPU, _});
391 }
392
393 // - Adreno -------------------------------------------------------------------------------
394 // Disable broken tests on Android with Adreno GPUs (b/40043413, b/40045254)
395 for (const char* test : {"ArrayCast",
396 "ArrayComparison",
397 "CommaSideEffects",
398 "IntrinsicMixFloatES2",
399 "IntrinsicClampFloat",
400 "SwitchWithFallthrough",
401 "SwitchWithFallthroughGroups",
402 "SwizzleIndexLookup",
403 "SwizzleIndexStore"}) {
404 disables[test].push_back({regex(ADRENO "[3456]"), _, _, kAndroid});
405 }
406
407 // Older Adreno 5/6xx drivers report a pipeline error or silently fail when handling inouts.
408 for (const char* test : {"VoidInSequenceExpressions", // b/295217166
409 "InoutParameters", // b/40043966
410 "OutParams",
411 "OutParamsDoubleSwizzle",
412 "OutParamsNoInline",
413 "OutParamsFunctionCallInArgument"}) {
414 disables[test].push_back({regex(ADRENO "[56]"), "Vulkan", _, kAndroid});
415 }
416
417 for (const char* test : {"MatrixToVectorCast", // b/40043288
418 "StructsInFunctions"}) { // b/40043024
419 disables[test].push_back({regex(ADRENO "[345]"), "OpenGL", _, kAndroid});
420 }
421
422 // Constructing a matrix from vectors and scalars can be surprisingly finicky (b/40043539)
423 for (const char* test : {"Matrices",
424 "MatrixNoOpFolding"}) {
425 disables[test].push_back({regex(ADRENO "3"), "OpenGL", _, kAndroid});
426 }
427
428 // Adreno 600 doesn't handle isinf() in OpenGL correctly. (b/40043464)
429 disables["IntrinsicIsInf"].push_back({regex(ADRENO "6"), "OpenGL", _, kAndroid});
430
431 // Older Adreno drivers crash when presented with an empty block (b/40044390)
432 disables["EmptyBlocksES3"].push_back({regex(ADRENO "(540|630)"), _, _, kAndroid});
433
434 // Adrenos alias out-params to globals improperly (b/40044222)
435 disables["OutParamsAreDistinctFromGlobal"].push_back({regex(ADRENO "[3456]"), "OpenGL",
436 _, kAndroid});
437 // Adreno generates the wrong result for this test. (b/40044477)
438 disables["StructFieldFolding"].push_back({regex(ADRENO "[56]"), "OpenGL",
439 _, kAndroid});
440
441 // b/318726662
442 for (const char* test : {"PrefixExpressionsES2",
443 "MatrixToVectorCast",
444 "MatrixConstructorsES2"}) {
445 disables[test].push_back({regex(ADRENO "620"), "Vulkan", Graphite, kAndroid});
446 }
447
448 // - Intel --------------------------------------------------------------------------------
449 // Disable various tests on Intel.
450 // Intrinsic floor() on Intel + ANGLE + DirectX is broken (anglebug.com/5588)
451 disables["IntrinsicFloor"].push_back({regex("Intel.*(Iris|HD)"), "ANGLE D3D", _, _});
452
453 // Intrinsic not() and mix() are broken on Intel GPUs in Metal. (b/40045105)
454 for (const char* test : {"IntrinsicNot",
455 "IntrinsicMixFloatES3"}) {
456 disables[test].push_back({regex("Intel.*(Iris|6000)"), "Metal", _, kMac});
457 }
458
459 // Swizzled-index store is broken across many Intel GPUs. (b/40045254)
460 disables["SwizzleIndexStore"].push_back({regex("Intel"), "OpenGL", _, kMac});
461 disables["SwizzleIndexStore"].push_back({regex("Intel.*Iris"), _, _, kWindows});
462
463 // vec4(mat2) conversions can lead to a crash on Intel + ANGLE (b/40043275)
464 for (const char* test : {"VectorToMatrixCast",
465 "VectorScalarMath",
466 "TrivialArgumentsInlineDirectly"}) {
467 disables[test].push_back({regex("Intel"), "ANGLE", _, kWindows});
468 }
469
470 for (const char* test : {"MatrixFoldingES2",
471 "MatrixEquality",
472 "TemporaryIndexLookup", // b/40045228
473 "SwizzleIndexLookup"}) { // b/40045254
474 disables[test].push_back({regex("Intel.*(Iris|4400)"), "OpenGL", _, kWindows});
475 disables[test].push_back({regex("Intel.*(Iris|4400)"), "ANGLE", _, kWindows});
476 }
477
478 for (const char* test : {"ReturnsValueOnEveryPathES3", // b/40043548
479 "OutParamsAreDistinctFromGlobal", // b/40044222
480 "StructFieldFolding"}) { // b/40044477
481 disables[test].push_back({regex("Intel"), "OpenGL", _, kWindows});
482 disables[test].push_back({regex("Intel"), "ANGLE GL", _, kWindows});
483 }
484
485 for (const char* test : {"SwitchDefaultOnly", // b/40043548
486 "ReturnsValueOnEveryPathES3"}) { // b/40045205
487 disables[test].push_back({regex("Intel"), "Vulkan", _, kLinux});
488 }
489
490 for (const char* test : {"SwitchDefaultOnly"}) {
491 disables[test].push_back({regex("Intel"), "ANGLE", _, kWindows});
492 }
493
494 for (const char* test : {"SwizzleAsLValueES3"}) { // https://anglebug.com/8260
495 disables[test].push_back({regex("Intel"), _, _, kWindows});
496 disables[test].push_back({_, "ANGLE", _, kWindows});
497 }
498
499 // Some Intel GPUs don't return zero for the derivative of a uniform.
500 for (const char* test : {"IntrinsicDFdy",
501 "IntrinsicDFdx",
502 "IntrinsicFwidth"}) {
503 disables[test].push_back({regex("Intel"), _, GPU, _});
504 }
505
506 disables["LoopFloat"].push_back({regex("Intel.*(Iris|6000)"), _, _, kMac}); // b/40043507
507
508 #undef ADRENO
509 #undef NVIDIA
510
511 return disables;
512 }()};
513
514 if (const std::vector<TestDisable>* testDisables = testDisableMap->find(name)) {
515 for (const TestDisable& d : *testDisables) {
516 if (d.platform.has_value() && !*d.platform) {
517 continue; // disable applies to a different platform
518 }
519 if (d.backendAPI.has_value() && !skstd::contains(backendAPI, *d.backendAPI)) {
520 continue; // disable applies to a different backend API
521 }
522 if (d.deviceName.has_value() &&
523 !std::regex_search(deviceName.begin(), deviceName.end(), *d.deviceName)) {
524 continue; // disable applies to a different device
525 }
526 if (d.testTypeMatcher == CPU && testType != skiatest::TestType::kCPU) {
527 continue; // disable only applies to CPU
528 }
529 if (d.testTypeMatcher == Ganesh && testType != skiatest::TestType::kGanesh) {
530 continue; // disable only applies to Ganesh
531 }
532 if (d.testTypeMatcher == Graphite && testType != skiatest::TestType::kGraphite) {
533 continue; // disable only applies to Graphites
534 }
535 if (d.testTypeMatcher == GPU && testType == skiatest::TestType::kCPU) {
536 continue; // disable only applies to GPU
537 }
538 // This test was disabled.
539 return true;
540 }
541 }
542
543 // This test was not in our disable list.
544 return false;
545}
546
548 std::string_view deviceName,
549 std::string_view backendAPI,
551 const char* name,
552 const char* testFile,
553 skiatest::TestType testType,
554 const char* permutationSuffix,
556 SkString shaderString = load_source(r, testFile, permutationSuffix);
557 if (shaderString.isEmpty()) {
558 return;
559 }
561 if (!result.effect) {
562 ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
563 return;
564 }
565 if (failure_is_expected(deviceName, backendAPI, name, testType)) {
566 // Some driver bugs can be catastrophic (e.g. crashing dm entirely), so we don't even try to
567 // run a shader if we expect that it might fail.
568 SkDebugf("%s: skipped %.*s%s\n", testFile, (int)backendAPI.size(), backendAPI.data(),
569 permutationSuffix);
570 return;
571 }
572
574 if (bitmap.empty()) {
575 ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
576 return;
577 }
578
579 bool success = true;
581 for (int y = 0; y < kHeight; ++y) {
582 for (int x = 0; x < kWidth; ++x) {
583 color[y][x] = bitmap.getColor(x, y);
584 if (color[y][x] != SK_ColorGREEN) {
585 success = false;
586 }
587 }
588 }
589
590 if (!success) {
591 static_assert(kWidth == 2);
592 static_assert(kHeight == 2);
593
594 SkString message = SkStringPrintf("Expected%s: solid green. Actual output from %.*s using "
595 "%.*s:\n"
596 "RRGGBBAA RRGGBBAA\n"
597 "%02X%02X%02X%02X %02X%02X%02X%02X\n"
598 "%02X%02X%02X%02X %02X%02X%02X%02X",
599 permutationSuffix,
600 (int)deviceName.size(), deviceName.data(),
601 (int)backendAPI.size(), backendAPI.data(),
602
603 SkColorGetR(color[0][0]), SkColorGetG(color[0][0]),
604 SkColorGetB(color[0][0]), SkColorGetA(color[0][0]),
605
606 SkColorGetR(color[0][1]), SkColorGetG(color[0][1]),
607 SkColorGetB(color[0][1]), SkColorGetA(color[0][1]),
608
609 SkColorGetR(color[1][0]), SkColorGetG(color[1][0]),
610 SkColorGetB(color[1][0]), SkColorGetA(color[1][0]),
611
612 SkColorGetR(color[1][1]), SkColorGetG(color[1][1]),
613 SkColorGetB(color[1][1]), SkColorGetA(color[1][1]));
614
615 ERRORF(r, "%s", message.c_str());
616 }
617}
618
620 std::string_view deviceName,
621 std::string_view backendAPI,
623 const char* name,
624 const char* testFile,
625 skiatest::TestType testType,
626 bool strictES2) {
629 options.forceUnoptimized = false;
630 test_one_permutation(r, deviceName, backendAPI, surface, name, testFile, testType, "", options);
631
632 options.forceUnoptimized = true;
633 test_one_permutation(r, deviceName, backendAPI, surface, name, testFile, testType,
634 " (Unoptimized)", options);
635}
636
638 const char* name,
639 const char* testFile,
642
643 // Create a raster-backed surface.
646
647 test_permutations(r, "CPU", "SkRP", surface.get(), name, testFile,
648 skiatest::TestType::kCPU, /*strictES2=*/true);
649}
650
651#if defined(SK_GANESH)
652static void test_ganesh(skiatest::Reporter* r,
653 const sk_gpu_test::ContextInfo& ctxInfo,
654 const char* name,
655 const char* testFile,
657 GrDirectContext *ctx = ctxInfo.directContext();
658
659 // If this is an ES3-only test on a GPU which doesn't support SkSL ES3, return immediately.
660 bool shouldRunGPU = SkToBool(flags & SkSLTestFlag::GPU);
661 bool shouldRunGPU_ES3 =
664 if (!shouldRunGPU && !shouldRunGPU_ES3) {
665 return;
666 }
667
668 // If this is a test that requires the GPU to generate NaN values, check for that first.
670 if (!gpu_generates_nan(r, ctx)) {
671 return;
672 }
673 }
674
675 // Create a GPU-backed Ganesh surface.
678 std::string_view deviceName = ctx->priv().caps()->deviceName();
679 std::string_view backendAPI = skgpu::ContextTypeName(ctxInfo.type());
680
681 if (shouldRunGPU) {
682 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
683 skiatest::TestType::kGanesh, /*strictES2=*/true);
684 }
685 if (shouldRunGPU_ES3) {
686 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
687 skiatest::TestType::kGanesh, /*strictES2=*/false);
688 }
689}
690#endif
691
692#if defined(SK_GRAPHITE)
693// Note: SKSL_TEST sets CTS enforcement API level to max(kApiLevel_V, ctsEnforcement) for Graphite.
694static void test_graphite(skiatest::Reporter* r,
697 const char* name,
698 const char* testFile,
700 // If this is an ES3-only test on a GPU which doesn't support SkSL ES3, return immediately.
701 bool shouldRunGPU = SkToBool(flags & SkSLTestFlag::GPU);
702 bool shouldRunGPU_ES3 =
705 if (!shouldRunGPU && !shouldRunGPU_ES3) {
706 return;
707 }
708
709#if defined(SK_DAWN)
710 if (ctx->backend() == skgpu::BackendApi::kDawn) {
711 // If this is a test that requires the GPU to generate NaN values, we don't run it in Dawn.
712 // (WGSL/Dawn does not support infinity or NaN even if the GPU natively does.)
714 return;
715 }
716 }
717#endif
718
719 // Create a GPU-backed Graphite surface.
720 std::unique_ptr<skgpu::graphite::Recorder> recorder = ctx->makeRecorder();
721
726 std::string_view deviceName = ctx->priv().caps()->deviceName();
727 std::string_view backendAPI = skgpu::ContextTypeName(testCtx->contextType());
728
729 if (shouldRunGPU) {
730 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
731 skiatest::TestType::kGraphite, /*strictES2=*/true);
732 }
733 if (shouldRunGPU_ES3) {
734 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
735 skiatest::TestType::kGraphite, /*strictES2=*/false);
736 }
737}
738#endif
739
740static void test_clone(skiatest::Reporter* r, const char* testFile, SkSLTestFlags flags) {
741 SkString shaderString = load_source(r, testFile, "");
742 if (shaderString.isEmpty()) {
743 return;
744 }
746 // TODO(skia:11209): Can we just put the correct #version in the source files that need this?
749 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
751 if (!program) {
752 ERRORF(r, "%s", compiler.errorText().c_str());
753 return;
754 }
755
756 // Clone every expression in the program, and ensure that its clone generates the same
757 // description as the original.
758 class CloneVisitor : public SkSL::ProgramVisitor {
759 public:
760 CloneVisitor(skiatest::Reporter* r) : fReporter(r) {}
761
762 bool visitExpression(const SkSL::Expression& expr) override {
763 std::string original = expr.description();
764 std::string cloned = expr.clone()->description();
765 REPORTER_ASSERT(fReporter, original == cloned,
766 "Mismatch after clone!\nOriginal: %s\nCloned: %s\n",
767 original.c_str(), cloned.c_str());
768
769 return INHERITED::visitExpression(expr);
770 }
771
772 skiatest::Reporter* fReporter;
773
774 using INHERITED = ProgramVisitor;
775 };
776
777 CloneVisitor{r}.visit(*program);
778}
779
780static void report_rp_pass(skiatest::Reporter* r, const char* testFile, SkSLTestFlags flags) {
782 ERRORF(r, "NEW: %s", testFile);
783 }
784}
785
787 const char* testFile,
789 const char* reason) {
791 ERRORF(r, "%s: %s", testFile, reason);
792 }
793}
794
796 const char* testFile,
798 SkString shaderString = load_source(r, testFile, "");
799 if (shaderString.isEmpty()) {
800 return;
801 }
802
803 // In Raster Pipeline, we can compile and run test shaders directly, without involving a surface
804 // at all.
807 settings.fMaxVersionAllowed = SkSL::Version::k300;
808 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
810 if (!program) {
811 ERRORF(r, "%s: Unexpected compilation error\n%s", testFile, compiler.errorText().c_str());
812 return;
813 }
814 const SkSL::FunctionDeclaration* main = program->getFunction("main");
815 if (!main) {
816 ERRORF(r, "%s: Program must have a 'main' function", testFile);
817 return;
818 }
819
820 // Match up uniforms from the program against our list of test uniforms, and build up a data
821 // buffer of uniform floats.
822 size_t offset = 0;
824 const SkSL::Context& ctx(compiler.context());
825
826 for (const SkSL::ProgramElement* elem : program->elements()) {
827 // Variables (uniform, etc.)
828 if (elem->is<SkSL::GlobalVarDeclaration>()) {
830 const SkSL::VarDeclaration& varDecl = global.declaration()->as<SkSL::VarDeclaration>();
831 const SkSL::Variable& var = *varDecl.var();
832
833 if (var.type().isEffectChild()) {
834 ERRORF(r, "%s: Test program cannot contain child effects", testFile);
835 return;
836 }
837 // 'uniform' variables
838 if (var.modifierFlags().isUniform()) {
840 }
841 }
842 }
843
844 TArray<float> uniformValues;
845 for (const SkRuntimeEffect::Uniform& programUniform : uniforms) {
846 bool foundMatch = false;
847 for (const UniformData& data : kUniformData) {
848 if (data.name == programUniform.name) {
849 SkASSERT(data.span.size() * sizeof(float) == programUniform.sizeInBytes());
850 foundMatch = true;
851 uniformValues.push_back_n(data.span.size(), data.span.data());
852 break;
853 }
854 }
855 if (!foundMatch) {
856 report_rp_fail(r, testFile, flags, "unsupported uniform");
857 return;
858 }
859 }
860
861 // Compile our program.
862 SkArenaAlloc alloc(/*firstHeapAllocation=*/1000);
863 SkRasterPipeline pipeline(&alloc);
864 SkSL::DebugTracePriv debugTrace;
865 std::unique_ptr<SkSL::RP::Program> rasterProg =
867 *main->definition(),
868 &debugTrace);
869 if (!rasterProg) {
870 report_rp_fail(r, testFile, flags, "code is not supported");
871 return;
872 }
873
874 // Append the SkSL program to the raster pipeline.
876 rasterProg->appendStages(&pipeline, &alloc, /*callbacks=*/nullptr, SkSpan(uniformValues));
877
878 // Move the float values from RGBA into an 8888 memory buffer.
881 pipeline.append(SkRasterPipelineOp::store_8888, &outCtx);
882 pipeline.run(0, 0, 1, 1);
883
884 // Make sure the first pixel (exclusively) of `out` is green. If the program compiled
885 // successfully, we expect it to run without error, and will assert if it doesn't.
886 uint32_t expected = 0xFF00FF00;
887 if (out[0] != expected) {
888 ERRORF(r, "%s: Raster Pipeline failed. Expected solid green, got ARGB:%02X%02X%02X%02X",
889 testFile,
890 (out[0] >> 24) & 0xFF,
891 (out[0] >> 16) & 0xFF,
892 (out[0] >> 8) & 0xFF,
893 out[0] & 0xFF);
894 return;
895 }
896
897 // Success!
898 report_rp_pass(r, testFile, flags);
899}
900
901#if defined(SK_GANESH)
902#define DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) \
903 DEF_CONDITIONAL_GANESH_TEST_FOR_RENDERING_CONTEXTS(SkSL##name##_Ganesh, \
904 r, \
905 ctxInfo, \
906 is_gpu(flags), \
907 ctsEnforcement) { \
908 test_ganesh(r, ctxInfo, #name, path, flags); \
909 }
910#else
911#define DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) /* Ganesh is disabled */
912#endif
913
914#if defined(SK_GRAPHITE)
915static bool is_native_context_or_dawn(skgpu::ContextType type) {
917}
918
919#define DEF_GRAPHITE_SKSL_TEST(flags, ctsEnforcement, name, path) \
920 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_CONTEXTS(SkSL##name##_Graphite, \
921 is_native_context_or_dawn, \
922 r, \
923 context, \
924 testContext, \
925 /*opt_filter=*/nullptr, \
926 is_gpu(flags), \
927 ctsEnforcement) { \
928 test_graphite(r, context, testContext, #name, path, flags); \
929 }
930#else
931#define DEF_GRAPHITE_SKSL_TEST(flags, ctsEnforcement, name, path) /* Graphite is disabled */
932#endif
933
934#define SKSL_TEST(flags, ctsEnforcement, name, path) \
935 DEF_CONDITIONAL_TEST(SkSL##name##_CPU, r, is_cpu(flags)) { test_cpu(r, #name, path, flags); } \
936 DEF_TEST(SkSL##name##_RP, r) { test_raster_pipeline(r, path, flags); } \
937 DEF_TEST(SkSL##name##_Clone, r) { test_clone(r, path, flags); } \
938 DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) \
939 DEF_GRAPHITE_SKSL_TEST(flags, std::max(kApiLevel_V, ctsEnforcement), name, path)
940
941/**
942 * Test flags:
943 * - CPU: this test should pass on the CPU backend
944 * - GPU: this test should pass on the Ganesh GPU backends
945 * - GPU_ES3: this test should pass on an ES3-compatible GPU when "enforce ES2 restrictions" is off
946 *
947 * CtsEnforcement:
948 * Android CTS (go/wtf/cts) enforces that devices must pass this test at the given API level.
949 * CTS and Android SkQP builds should only run tests on devices greater than the provided API
950 * level, but other test binaries (dm/fm) should run every test, regardless of this value.
951 */
952
953// clang-format off
954
962[[maybe_unused]] constexpr auto kApiLevel_V = CtsEnforcement::kApiLevel_V;
964[[maybe_unused]] constexpr auto kNextRelease = CtsEnforcement::kNextRelease;
965
966SKSL_TEST(ES3 | GPU_ES3, kApiLevel_T, ArrayFolding, "folding/ArrayFolding.sksl")
967SKSL_TEST(CPU | GPU, kApiLevel_T, ArraySizeFolding, "folding/ArraySizeFolding.rts")
968SKSL_TEST(CPU | GPU, kApiLevel_T, AssignmentOps, "folding/AssignmentOps.rts")
969SKSL_TEST(CPU | GPU, kApiLevel_T, BoolFolding, "folding/BoolFolding.rts")
970SKSL_TEST(CPU | GPU, kApiLevel_T, CastFolding, "folding/CastFolding.rts")
971SKSL_TEST(CPU | GPU, kApiLevel_T, IntFoldingES2, "folding/IntFoldingES2.rts")
972SKSL_TEST(ES3 | GPU_ES3, kNever, IntFoldingES3, "folding/IntFoldingES3.sksl")
973SKSL_TEST(CPU | GPU, kApiLevel_T, FloatFolding, "folding/FloatFolding.rts")
974SKSL_TEST(CPU | GPU, kNextRelease,LogicalNot, "folding/LogicalNot.rts")
975SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixFoldingES2, "folding/MatrixFoldingES2.rts")
976SKSL_TEST(ES3 | GPU_ES3, kNever, MatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
977SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixNoOpFolding, "folding/MatrixNoOpFolding.rts")
978SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixScalarNoOpFolding, "folding/MatrixScalarNoOpFolding.rts")
979SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixVectorNoOpFolding, "folding/MatrixVectorNoOpFolding.rts")
980SKSL_TEST(CPU | GPU, kApiLevel_T, Negation, "folding/Negation.rts")
981SKSL_TEST(CPU | GPU, kApiLevel_T, PreserveSideEffects, "folding/PreserveSideEffects.rts")
982SKSL_TEST(CPU | GPU, kApiLevel_T, SelfAssignment, "folding/SelfAssignment.rts")
983SKSL_TEST(CPU | GPU, kApiLevel_T, ShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.rts")
984SKSL_TEST(CPU | GPU, kApiLevel_U, StructFieldFolding, "folding/StructFieldFolding.rts")
985SKSL_TEST(CPU | GPU, kApiLevel_U, StructFieldNoFolding, "folding/StructFieldNoFolding.rts")
986SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchCaseFolding, "folding/SwitchCaseFolding.rts")
987SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleFolding, "folding/SwizzleFolding.rts")
988SKSL_TEST(CPU | GPU, kApiLevel_U, TernaryFolding, "folding/TernaryFolding.rts")
989SKSL_TEST(CPU | GPU, kApiLevel_T, VectorScalarFolding, "folding/VectorScalarFolding.rts")
990SKSL_TEST(CPU | GPU, kApiLevel_T, VectorVectorFolding, "folding/VectorVectorFolding.rts")
991
992SKSL_TEST(CPU | GPU, kNextRelease,CommaExpressionsAllowInlining, "inliner/CommaExpressionsAllowInlining.sksl")
993SKSL_TEST(ES3 | GPU_ES3, kNever, DoWhileBodyMustBeInlinedIntoAScope, "inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
994SKSL_TEST(ES3 | GPU_ES3, kNever, DoWhileTestCannotBeInlined, "inliner/DoWhileTestCannotBeInlined.sksl")
995SKSL_TEST(CPU | GPU, kApiLevel_T, ForBodyMustBeInlinedIntoAScope, "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
996SKSL_TEST(ES3 | GPU_ES3, kNever, ForInitializerExpressionsCanBeInlined, "inliner/ForInitializerExpressionsCanBeInlined.sksl")
997SKSL_TEST(CPU | GPU, kApiLevel_T, ForWithoutReturnInsideCanBeInlined, "inliner/ForWithoutReturnInsideCanBeInlined.sksl")
998SKSL_TEST(CPU | GPU, kApiLevel_T, ForWithReturnInsideCannotBeInlined, "inliner/ForWithReturnInsideCannotBeInlined.sksl")
999SKSL_TEST(CPU | GPU, kApiLevel_T, IfBodyMustBeInlinedIntoAScope, "inliner/IfBodyMustBeInlinedIntoAScope.sksl")
1000SKSL_TEST(CPU | GPU, kApiLevel_T, IfElseBodyMustBeInlinedIntoAScope, "inliner/IfElseBodyMustBeInlinedIntoAScope.sksl")
1001SKSL_TEST(CPU | GPU, kApiLevel_T, IfElseChainWithReturnsCanBeInlined, "inliner/IfElseChainWithReturnsCanBeInlined.sksl")
1002SKSL_TEST(CPU | GPU, kApiLevel_T, IfTestCanBeInlined, "inliner/IfTestCanBeInlined.sksl")
1003SKSL_TEST(CPU | GPU, kApiLevel_T, IfWithReturnsCanBeInlined, "inliner/IfWithReturnsCanBeInlined.sksl")
1004SKSL_TEST(CPU | GPU, kApiLevel_T, InlineKeywordOverridesThreshold, "inliner/InlineKeywordOverridesThreshold.sksl")
1005SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerAvoidsVariableNameOverlap, "inliner/InlinerAvoidsVariableNameOverlap.sksl")
1006SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerElidesTempVarForReturnsInsideBlock, "inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl")
1007SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerUsesTempVarForMultipleReturns, "inliner/InlinerUsesTempVarForMultipleReturns.sksl")
1008SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerUsesTempVarForReturnsInsideBlockWithVar, "inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl")
1009SKSL_TEST(CPU | GPU, kApiLevel_T, InlineThreshold, "inliner/InlineThreshold.sksl")
1010SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, InlineUnscopedVariable, "inliner/InlineUnscopedVariable.sksl")
1011SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithModifiedArgument, "inliner/InlineWithModifiedArgument.sksl")
1012SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithNestedBigCalls, "inliner/InlineWithNestedBigCalls.sksl")
1013SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithUnmodifiedArgument, "inliner/InlineWithUnmodifiedArgument.sksl")
1014SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithUnnecessaryBlocks, "inliner/InlineWithUnnecessaryBlocks.sksl")
1015SKSL_TEST(CPU | GPU, kNextRelease,IntrinsicNameCollision, "inliner/IntrinsicNameCollision.sksl")
1016SKSL_TEST(CPU | GPU, kNextRelease,ModifiedArrayParametersCannotBeInlined, "inliner/ModifiedArrayParametersCannotBeInlined.sksl")
1017SKSL_TEST(CPU | GPU, kNextRelease,ModifiedStructParametersCannotBeInlined, "inliner/ModifiedStructParametersCannotBeInlined.sksl")
1018SKSL_TEST(CPU | GPU, kApiLevel_T, NoInline, "inliner/NoInline.sksl")
1019SKSL_TEST(CPU | GPU, kApiLevel_T, ShortCircuitEvaluationsCannotInlineRightHandSide, "inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl")
1020SKSL_TEST(ES3 | GPU_ES3, kNever, StaticSwitchInline, "inliner/StaticSwitch.sksl")
1021SKSL_TEST(CPU | GPU, kApiLevel_T, StructsCanBeInlinedSafely, "inliner/StructsCanBeInlinedSafely.sksl")
1022SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleCanBeInlinedDirectly, "inliner/SwizzleCanBeInlinedDirectly.sksl")
1023SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryResultsCannotBeInlined, "inliner/TernaryResultsCannotBeInlined.sksl")
1024SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryTestCanBeInlined, "inliner/TernaryTestCanBeInlined.sksl")
1025SKSL_TEST(CPU | GPU, kApiLevel_T, TrivialArgumentsInlineDirectly, "inliner/TrivialArgumentsInlineDirectly.sksl")
1026SKSL_TEST(ES3 | GPU_ES3, kNever, TrivialArgumentsInlineDirectlyES3, "inliner/TrivialArgumentsInlineDirectlyES3.sksl")
1027SKSL_TEST(CPU | GPU, kNextRelease,TypeShadowing, "inliner/TypeShadowing.sksl")
1028SKSL_TEST(ES3 | GPU_ES3, kNever, WhileBodyMustBeInlinedIntoAScope, "inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
1029SKSL_TEST(ES3 | GPU_ES3, kNever, WhileTestCannotBeInlined, "inliner/WhileTestCannotBeInlined.sksl")
1030
1031SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
1032SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicAbsInt, "intrinsics/AbsInt.sksl")
1033SKSL_TEST(CPU | GPU, kNever, IntrinsicAny, "intrinsics/Any.sksl")
1034SKSL_TEST(CPU | GPU, kNever, IntrinsicAll, "intrinsics/All.sksl")
1035SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicCeil, "intrinsics/Ceil.sksl")
1036SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicClampInt, "intrinsics/ClampInt.sksl")
1037SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicClampUInt, "intrinsics/ClampUInt.sksl")
1038SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicClampFloat, "intrinsics/ClampFloat.sksl")
1039SKSL_TEST(CPU | GPU, kNever, IntrinsicCross, "intrinsics/Cross.sksl")
1040SKSL_TEST(CPU | GPU, kNever, IntrinsicDegrees, "intrinsics/Degrees.sksl")
1041SKSL_TEST(GPU_ES3, kNever, IntrinsicDeterminant, "intrinsics/Determinant.sksl")
1042SKSL_TEST(GPU_ES3, kNever, IntrinsicDFdx, "intrinsics/DFdx.sksl")
1043SKSL_TEST(GPU_ES3, kNever, IntrinsicDFdy, "intrinsics/DFdy.sksl")
1044SKSL_TEST(CPU | GPU, kNever, IntrinsicDot, "intrinsics/Dot.sksl")
1045SKSL_TEST(CPU | GPU, kNever, IntrinsicFract, "intrinsics/Fract.sksl")
1046SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl")
1047SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl")
1048SKSL_TEST(CPU | GPU, kNever, IntrinsicFloor, "intrinsics/Floor.sksl")
1049SKSL_TEST(GPU_ES3, kNever, IntrinsicFwidth, "intrinsics/Fwidth.sksl")
1050SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicIntBitsToFloat, "intrinsics/IntBitsToFloat.sksl")
1051SKSL_TEST(GPU_ES3, kNever, IntrinsicIsInf, "intrinsics/IsInf.sksl")
1052SKSL_TEST(CPU | GPU, kNever, IntrinsicLength, "intrinsics/Length.sksl")
1053SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMatrixCompMultES2, "intrinsics/MatrixCompMultES2.sksl")
1054SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMatrixCompMultES3, "intrinsics/MatrixCompMultES3.sksl")
1055SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMaxFloat, "intrinsics/MaxFloat.sksl")
1056SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMaxInt, "intrinsics/MaxInt.sksl")
1057SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMaxUint, "intrinsics/MaxUint.sksl")
1058SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMinFloat, "intrinsics/MinFloat.sksl")
1059SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMinInt, "intrinsics/MinInt.sksl")
1060SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMinUint, "intrinsics/MinUint.sksl")
1061SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMixFloatES2, "intrinsics/MixFloatES2.sksl")
1062SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMixFloatES3, "intrinsics/MixFloatES3.sksl")
1063SKSL_TEST(GPU_ES3, kNever, IntrinsicModf, "intrinsics/Modf.sksl")
1064SKSL_TEST(CPU | GPU, kNever, IntrinsicNot, "intrinsics/Not.sksl")
1065SKSL_TEST(GPU_ES3, kNever, IntrinsicOuterProduct, "intrinsics/OuterProduct.sksl")
1066SKSL_TEST(CPU | GPU, kNever, IntrinsicRadians, "intrinsics/Radians.sksl")
1067SKSL_TEST(GPU_ES3, kNever, IntrinsicRound, "intrinsics/Round.sksl")
1068SKSL_TEST(GPU_ES3, kNever, IntrinsicRoundEven, "intrinsics/RoundEven.sksl")
1069SKSL_TEST(CPU | GPU, kNever, IntrinsicSaturate, "intrinsics/Saturate.sksl")
1070SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicSignFloat, "intrinsics/SignFloat.sksl")
1071SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicSignInt, "intrinsics/SignInt.sksl")
1072SKSL_TEST(CPU | GPU, kNever, IntrinsicSqrt, "intrinsics/Sqrt.sksl")
1073SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicStep, "intrinsics/Step.sksl")
1074SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicTrunc, "intrinsics/Trunc.sksl")
1075SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicTranspose, "intrinsics/Transpose.sksl")
1076SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicUintBitsToFloat, "intrinsics/UintBitsToFloat.sksl")
1077
1078SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayNarrowingConversions, "runtime/ArrayNarrowingConversions.rts")
1079SKSL_TEST(ES3 | GPU_ES3, kNever, Commutative, "runtime/Commutative.rts")
1080SKSL_TEST(CPU, kNever, DivideByZero, "runtime/DivideByZero.rts")
1081SKSL_TEST(CPU | GPU, kNextRelease,FunctionParameterAliasingFirst, "runtime/FunctionParameterAliasingFirst.rts")
1082SKSL_TEST(CPU | GPU, kNextRelease,FunctionParameterAliasingSecond, "runtime/FunctionParameterAliasingSecond.rts")
1083SKSL_TEST(CPU | GPU, kNextRelease,IfElseBinding, "runtime/IfElseBinding.rts")
1084SKSL_TEST(CPU | GPU, kNextRelease,IncrementDisambiguation, "runtime/IncrementDisambiguation.rts")
1085SKSL_TEST(CPU | GPU, kApiLevel_T, LoopFloat, "runtime/LoopFloat.rts")
1086SKSL_TEST(CPU | GPU, kApiLevel_T, LoopInt, "runtime/LoopInt.rts")
1087SKSL_TEST(CPU | GPU, kApiLevel_U, Ossfuzz52603, "runtime/Ossfuzz52603.rts")
1088SKSL_TEST(CPU | GPU, kApiLevel_T, QualifierOrder, "runtime/QualifierOrder.rts")
1089SKSL_TEST(CPU | GPU, kApiLevel_T, PrecisionQualifiers, "runtime/PrecisionQualifiers.rts")
1090
1091SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Arrays, "runtime/RecursiveComparison_Arrays.rts")
1092SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Structs, "runtime/RecursiveComparison_Structs.rts")
1093SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Types, "runtime/RecursiveComparison_Types.rts")
1094SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Vectors, "runtime/RecursiveComparison_Vectors.rts")
1095
1096SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayCast, "shared/ArrayCast.sksl")
1097SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayComparison, "shared/ArrayComparison.sksl")
1098SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayConstructors, "shared/ArrayConstructors.sksl")
1099SKSL_TEST(CPU | GPU, kNextRelease,ArrayFollowedByScalar, "shared/ArrayFollowedByScalar.sksl")
1100SKSL_TEST(CPU | GPU, kApiLevel_T, ArrayTypes, "shared/ArrayTypes.sksl")
1101SKSL_TEST(CPU | GPU, kApiLevel_T, Assignment, "shared/Assignment.sksl")
1102SKSL_TEST(CPU | GPU, kApiLevel_T, CastsRoundTowardZero, "shared/CastsRoundTowardZero.sksl")
1103SKSL_TEST(CPU | GPU, kApiLevel_T, CommaMixedTypes, "shared/CommaMixedTypes.sksl")
1104SKSL_TEST(CPU | GPU, kApiLevel_T, CommaSideEffects, "shared/CommaSideEffects.sksl")
1105SKSL_TEST(CPU | GPU, kApiLevel_U, CompileTimeConstantVariables, "shared/CompileTimeConstantVariables.sksl")
1106SKSL_TEST(ES3 | GPU_ES3, kNever, ConstantCompositeAccessViaConstantIndex, "shared/ConstantCompositeAccessViaConstantIndex.sksl")
1107SKSL_TEST(ES3 | GPU_ES3, kNever, ConstantCompositeAccessViaDynamicIndex, "shared/ConstantCompositeAccessViaDynamicIndex.sksl")
1108SKSL_TEST(CPU | GPU, kApiLevel_T, ConstantIf, "shared/ConstantIf.sksl")
1109SKSL_TEST(ES3 | GPU_ES3, kNever, ConstArray, "shared/ConstArray.sksl")
1110SKSL_TEST(CPU | GPU, kApiLevel_T, ConstVariableComparison, "shared/ConstVariableComparison.sksl")
1111SKSL_TEST(CPU | GPU, kNever, DeadGlobals, "shared/DeadGlobals.sksl")
1112SKSL_TEST(ES3 | GPU_ES3, kNever, DeadLoopVariable, "shared/DeadLoopVariable.sksl")
1113SKSL_TEST(CPU | GPU, kApiLevel_T, DeadIfStatement, "shared/DeadIfStatement.sksl")
1114SKSL_TEST(CPU | GPU, kApiLevel_T, DeadReturn, "shared/DeadReturn.sksl")
1115SKSL_TEST(ES3 | GPU_ES3, kNever, DeadReturnES3, "shared/DeadReturnES3.sksl")
1116SKSL_TEST(CPU | GPU, kApiLevel_T, DeadStripFunctions, "shared/DeadStripFunctions.sksl")
1117SKSL_TEST(CPU | GPU, kApiLevel_T, DependentInitializers, "shared/DependentInitializers.sksl")
1118SKSL_TEST(CPU | GPU, kApiLevel_U, DoubleNegation, "shared/DoubleNegation.sksl")
1119SKSL_TEST(ES3 | GPU_ES3, kNever, DoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
1120SKSL_TEST(CPU | GPU, kApiLevel_T, EmptyBlocksES2, "shared/EmptyBlocksES2.sksl")
1121SKSL_TEST(ES3 | GPU_ES3, kNever, EmptyBlocksES3, "shared/EmptyBlocksES3.sksl")
1122SKSL_TEST(CPU | GPU, kApiLevel_T, ForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
1123SKSL_TEST(ES3 | GPU_ES3, kNever, ForLoopMultipleInitES3, "shared/ForLoopMultipleInitES3.sksl")
1124SKSL_TEST(CPU | GPU, kNextRelease,ForLoopShadowing, "shared/ForLoopShadowing.sksl")
1125SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionAnonymousParameters, "shared/FunctionAnonymousParameters.sksl")
1126SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionArgTypeMatch, "shared/FunctionArgTypeMatch.sksl")
1127SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionReturnTypeMatch, "shared/FunctionReturnTypeMatch.sksl")
1128SKSL_TEST(CPU | GPU, kApiLevel_T, Functions, "shared/Functions.sksl")
1129SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionPrototype, "shared/FunctionPrototype.sksl")
1130SKSL_TEST(CPU | GPU, kApiLevel_T, GeometricIntrinsics, "shared/GeometricIntrinsics.sksl")
1131SKSL_TEST(CPU | GPU, kApiLevel_T, HelloWorld, "shared/HelloWorld.sksl")
1132SKSL_TEST(CPU | GPU, kApiLevel_T, Hex, "shared/Hex.sksl")
1133SKSL_TEST(ES3 | GPU_ES3, kNever, HexUnsigned, "shared/HexUnsigned.sksl")
1134SKSL_TEST(CPU | GPU, kNextRelease,IfStatement, "shared/IfStatement.sksl")
1135SKSL_TEST(CPU | GPU, kApiLevel_T, InoutParameters, "shared/InoutParameters.sksl")
1136SKSL_TEST(CPU | GPU, kApiLevel_U, InoutParamsAreDistinct, "shared/InoutParamsAreDistinct.sksl")
1137SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, IntegerDivisionES3, "shared/IntegerDivisionES3.sksl")
1138SKSL_TEST(CPU | GPU, kApiLevel_U, LogicalAndShortCircuit, "shared/LogicalAndShortCircuit.sksl")
1139SKSL_TEST(CPU | GPU, kApiLevel_U, LogicalOrShortCircuit, "shared/LogicalOrShortCircuit.sksl")
1140SKSL_TEST(CPU | GPU, kApiLevel_T, Matrices, "shared/Matrices.sksl")
1141SKSL_TEST(ES3 | GPU_ES3, kNever, MatricesNonsquare, "shared/MatricesNonsquare.sksl")
1142SKSL_TEST(CPU | GPU, kNever, MatrixConstructorsES2, "shared/MatrixConstructorsES2.sksl")
1143SKSL_TEST(ES3 | GPU_ES3, kNever, MatrixConstructorsES3, "shared/MatrixConstructorsES3.sksl")
1144SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixEquality, "shared/MatrixEquality.sksl")
1145SKSL_TEST(CPU | GPU, kNextRelease,MatrixIndexLookup, "shared/MatrixIndexLookup.sksl")
1146SKSL_TEST(CPU | GPU, kNextRelease,MatrixIndexStore, "shared/MatrixIndexStore.sksl")
1147SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixOpEqualsES2, "shared/MatrixOpEqualsES2.sksl")
1148SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, MatrixOpEqualsES3, "shared/MatrixOpEqualsES3.sksl")
1149SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixScalarMath, "shared/MatrixScalarMath.sksl")
1150SKSL_TEST(CPU | GPU, kNextRelease,MatrixSwizzleStore, "shared/MatrixSwizzleStore.sksl")
1151SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixToVectorCast, "shared/MatrixToVectorCast.sksl")
1152SKSL_TEST(CPU | GPU, kApiLevel_T, MultipleAssignments, "shared/MultipleAssignments.sksl")
1153SKSL_TEST(CPU | GPU, kApiLevel_T, NumberCasts, "shared/NumberCasts.sksl")
1154SKSL_TEST(CPU | GPU, kNextRelease,NestedComparisonIntrinsics, "shared/NestedComparisonIntrinsics.sksl")
1155SKSL_TEST(CPU | GPU, kApiLevel_T, OperatorsES2, "shared/OperatorsES2.sksl")
1156SKSL_TEST(GPU_ES3, kNever, OperatorsES3, "shared/OperatorsES3.sksl")
1157SKSL_TEST(CPU | GPU, kApiLevel_T, Ossfuzz36852, "shared/Ossfuzz36852.sksl")
1158SKSL_TEST(CPU | GPU, kApiLevel_T, OutParams, "shared/OutParams.sksl")
1159SKSL_TEST(CPU | GPU, kApiLevel_T, OutParamsAreDistinct, "shared/OutParamsAreDistinct.sksl")
1160SKSL_TEST(CPU | GPU, kApiLevel_U, OutParamsAreDistinctFromGlobal, "shared/OutParamsAreDistinctFromGlobal.sksl")
1161SKSL_TEST(ES3 | GPU_ES3, kNever, OutParamsFunctionCallInArgument, "shared/OutParamsFunctionCallInArgument.sksl")
1162SKSL_TEST(CPU | GPU, kApiLevel_T, OutParamsDoubleSwizzle, "shared/OutParamsDoubleSwizzle.sksl")
1163SKSL_TEST(CPU | GPU, kNextRelease,PostfixExpressions, "shared/PostfixExpressions.sksl")
1164SKSL_TEST(CPU | GPU, kNextRelease,PrefixExpressionsES2, "shared/PrefixExpressionsES2.sksl")
1165SKSL_TEST(ES3 | GPU_ES3, kNever, PrefixExpressionsES3, "shared/PrefixExpressionsES3.sksl")
1166SKSL_TEST(CPU | GPU, kApiLevel_T, ResizeMatrix, "shared/ResizeMatrix.sksl")
1167SKSL_TEST(ES3 | GPU_ES3, kNever, ResizeMatrixNonsquare, "shared/ResizeMatrixNonsquare.sksl")
1168SKSL_TEST(CPU | GPU, kApiLevel_T, ReturnsValueOnEveryPathES2, "shared/ReturnsValueOnEveryPathES2.sksl")
1169SKSL_TEST(ES3 | GPU_ES3, kNever, ReturnsValueOnEveryPathES3, "shared/ReturnsValueOnEveryPathES3.sksl")
1170SKSL_TEST(CPU | GPU, kApiLevel_T, ScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
1171SKSL_TEST(ES3 | GPU_ES3, kNever, ScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
1172SKSL_TEST(CPU | GPU, kApiLevel_T, ScopedSymbol, "shared/ScopedSymbol.sksl")
1173SKSL_TEST(CPU | GPU, kApiLevel_T, StackingVectorCasts, "shared/StackingVectorCasts.sksl")
1174SKSL_TEST(CPU | GPU_ES3, kNever, StaticSwitch, "shared/StaticSwitch.sksl")
1175SKSL_TEST(CPU | GPU, kApiLevel_T, StructArrayFollowedByScalar, "shared/StructArrayFollowedByScalar.sksl")
1176SKSL_TEST(CPU | GPU, kNextRelease,StructIndexLookup, "shared/StructIndexLookup.sksl")
1177SKSL_TEST(CPU | GPU, kNextRelease,StructIndexStore, "shared/StructIndexStore.sksl")
1178// TODO(skia:13920): StructComparison currently exposes a bug in SPIR-V codegen.
1179SKSL_TEST(ES3, kNextRelease,StructComparison, "shared/StructComparison.sksl")
1180SKSL_TEST(CPU | GPU, kApiLevel_T, StructsInFunctions, "shared/StructsInFunctions.sksl")
1181SKSL_TEST(CPU | GPU, kApiLevel_T, Switch, "shared/Switch.sksl")
1182SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchDefaultOnly, "shared/SwitchDefaultOnly.sksl")
1183SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchWithFallthrough, "shared/SwitchWithFallthrough.sksl")
1184SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchWithFallthroughAndVarDecls,"shared/SwitchWithFallthroughAndVarDecls.sksl")
1185SKSL_TEST(CPU | GPU, kApiLevel_V, SwitchWithFallthroughGroups, "shared/SwitchWithFallthroughGroups.sksl")
1186SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchWithLoops, "shared/SwitchWithLoops.sksl")
1187SKSL_TEST(ES3 | GPU_ES3, kNever, SwitchWithLoopsES3, "shared/SwitchWithLoopsES3.sksl")
1188SKSL_TEST(CPU | GPU, kNever, SwizzleAsLValue, "shared/SwizzleAsLValue.sksl")
1189SKSL_TEST(ES3 | GPU_ES3, kNever, SwizzleAsLValueES3, "shared/SwizzleAsLValueES3.sksl")
1190SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleBoolConstants, "shared/SwizzleBoolConstants.sksl")
1191SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleByConstantIndex, "shared/SwizzleByConstantIndex.sksl")
1192SKSL_TEST(ES3 | GPU_ES3, kNever, SwizzleByIndex, "shared/SwizzleByIndex.sksl")
1193SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleConstants, "shared/SwizzleConstants.sksl")
1194SKSL_TEST(CPU | GPU, kNextRelease,SwizzleIndexLookup, "shared/SwizzleIndexLookup.sksl")
1195SKSL_TEST(CPU | GPU, kNextRelease,SwizzleIndexStore, "shared/SwizzleIndexStore.sksl")
1196SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleLTRB, "shared/SwizzleLTRB.sksl")
1197SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleOpt, "shared/SwizzleOpt.sksl")
1198SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleScalar, "shared/SwizzleScalar.sksl")
1199SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleScalarBool, "shared/SwizzleScalarBool.sksl")
1200SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleScalarInt, "shared/SwizzleScalarInt.sksl")
1201SKSL_TEST(CPU | GPU, kNextRelease,TemporaryIndexLookup, "shared/TemporaryIndexLookup.sksl")
1202SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
1203SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryAsLValueFoldableTest, "shared/TernaryAsLValueFoldableTest.sksl")
1204SKSL_TEST(CPU | GPU, kNextRelease,TernaryComplexNesting, "shared/TernaryComplexNesting.sksl")
1205SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryExpression, "shared/TernaryExpression.sksl")
1206SKSL_TEST(CPU | GPU, kNextRelease,TernaryNesting, "shared/TernaryNesting.sksl")
1207SKSL_TEST(CPU | GPU, kNextRelease,TernaryOneZeroOptimization, "shared/TernaryOneZeroOptimization.sksl")
1208SKSL_TEST(CPU | GPU, kApiLevel_U, TernarySideEffects, "shared/TernarySideEffects.sksl")
1209SKSL_TEST(CPU | GPU, kApiLevel_T, UnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
1210SKSL_TEST(CPU | GPU, kApiLevel_T, UniformArray, "shared/UniformArray.sksl")
1211SKSL_TEST(CPU | GPU, kApiLevel_U, UniformMatrixResize, "shared/UniformMatrixResize.sksl")
1212SKSL_TEST(CPU | GPU, kApiLevel_T, UnusedVariables, "shared/UnusedVariables.sksl")
1213SKSL_TEST(CPU | GPU, kApiLevel_T, VectorConstructors, "shared/VectorConstructors.sksl")
1214SKSL_TEST(CPU | GPU, kApiLevel_T, VectorToMatrixCast, "shared/VectorToMatrixCast.sksl")
1215SKSL_TEST(CPU | GPU, kApiLevel_T, VectorScalarMath, "shared/VectorScalarMath.sksl")
1216SKSL_TEST(ES3 | GPU_ES3, kNever, WhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
1217
1218SKSL_TEST(CPU | GPU, kNextRelease,VoidInSequenceExpressions, "workarounds/VoidInSequenceExpressions.sksl")
const char * options
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define test(name)
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition: Resources.cpp:42
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
#define SkColorGetR(color)
Definition: SkColor.h:65
#define SkColorGetG(color)
Definition: SkColor.h:69
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
#define SkColorGetA(color)
Definition: SkColor.h:61
#define SkColorGetB(color)
Definition: SkColor.h:73
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static constexpr int SkRasterPipeline_kMaxStride_highp
#define INHERITED(method,...)
Definition: SkRecorder.cpp:128
static constexpr float kUniformTestMatrix3x3[]
Definition: SkSLTest.cpp:138
constexpr auto kApiLevel_T
Definition: SkSLTest.cpp:960
static void test_clone(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition: SkSLTest.cpp:740
constexpr auto kNever
Definition: SkSLTest.cpp:963
#define ADRENO
static SkBitmap bitmap_from_shader(skiatest::Reporter *r, SkSurface *surface, sk_sp< SkRuntimeEffect > effect)
Definition: SkSLTest.cpp:163
static constexpr float kUniformTestMatrix4x4[]
Definition: SkSLTest.cpp:141
static bool failure_is_expected(std::string_view deviceName, std::string_view backendAPI, std::string_view name, skiatest::TestType testType)
Definition: SkSLTest.cpp:238
static constexpr float kUniformColorGreen[]
Definition: SkSLTest.cpp:131
static constexpr bool is_strict_es2(SkSLTestFlags flags)
Definition: SkSLTest.cpp:120
static constexpr float kUniformColorWhite[]
Definition: SkSLTest.cpp:133
constexpr auto kNextRelease
Definition: SkSLTest.cpp:964
constexpr SkSLTestFlags CPU
Definition: SkSLTest.cpp:955
static void test_cpu(skiatest::Reporter *r, const char *name, const char *testFile, SkSLTestFlags flags)
Definition: SkSLTest.cpp:637
#define SKSL_TEST(flags, ctsEnforcement, name, path)
Definition: SkSLTest.cpp:934
constexpr auto kApiLevel_V
Definition: SkSLTest.cpp:962
static void test_raster_pipeline(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition: SkSLTest.cpp:795
static constexpr float kUniformTestArrayNegative[]
Definition: SkSLTest.cpp:146
static constexpr float kUniformColorBlack[]
Definition: SkSLTest.cpp:129
static constexpr float kUniformTestMatrix2x2[]
Definition: SkSLTest.cpp:136
static constexpr float kUniformTestInputs[]
Definition: SkSLTest.cpp:134
static bool gpu_generates_nan(skiatest::Reporter *r, GrDirectContext *ctx)
Definition: SkSLTest.cpp:192
static void report_rp_pass(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition: SkSLTest.cpp:780
static constexpr float kUniformColorRed[]
Definition: SkSLTest.cpp:130
#define NVIDIA
static constexpr bool is_gpu(SkSLTestFlags flags)
Definition: SkSLTest.cpp:116
static constexpr float kUniformColorBlue[]
Definition: SkSLTest.cpp:132
constexpr SkSLTestFlags ES3
Definition: SkSLTest.cpp:956
constexpr SkSLTestFlags UsesNaN
Definition: SkSLTest.cpp:959
constexpr SkSLTestFlags GPU
Definition: SkSLTest.cpp:957
static constexpr int kWidth
Definition: SkSLTest.cpp:84
static constexpr bool is_cpu(SkSLTestFlags flags)
Definition: SkSLTest.cpp:112
static constexpr UniformData kUniformData[]
Definition: SkSLTest.cpp:148
static constexpr float kUniformTestArray[]
Definition: SkSLTest.cpp:145
static void report_rp_fail(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags, const char *reason)
Definition: SkSLTest.cpp:786
SkSLTestFlag
Definition: SkSLTest.cpp:87
static void test_permutations(skiatest::Reporter *r, std::string_view deviceName, std::string_view backendAPI, SkSurface *surface, const char *name, const char *testFile, skiatest::TestType testType, bool strictES2)
Definition: SkSLTest.cpp:619
static void test_one_permutation(skiatest::Reporter *r, std::string_view deviceName, std::string_view backendAPI, SkSurface *surface, const char *name, const char *testFile, skiatest::TestType testType, const char *permutationSuffix, const SkRuntimeEffect::Options &options)
Definition: SkSLTest.cpp:547
static constexpr int kHeight
Definition: SkSLTest.cpp:85
constexpr auto kApiLevel_U
Definition: SkSLTest.cpp:961
constexpr SkSLTestFlags GPU_ES3
Definition: SkSLTest.cpp:958
static constexpr float kUniformUnknownInput[]
Definition: SkSLTest.cpp:135
static SkString load_source(skiatest::Reporter *r, const char *testFile, const char *permutationSuffix)
Definition: SkSLTest.cpp:226
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
#define ERRORF(r,...)
Definition: Test.h:293
GLenum type
const GrCaps * caps() const
const GrShaderCaps * shaderCaps() const
Definition: GrCaps.h:63
GrDirectContextPriv priv()
const uint8_t * bytes() const
Definition: SkData.h:43
size_t size() const
Definition: SkData.h:30
void setShader(sk_sp< SkShader > shader)
void run(size_t x, size_t y, size_t w, size_t h) const
void append(SkRasterPipelineOp, void *=nullptr)
void appendConstantColor(SkArenaAlloc *, const float rgba[4])
static SkRuntimeEffect::Uniform VarAsUniform(const SkSL::Variable &, const SkSL::Context &, size_t *offset)
static SkRuntimeEffect::Options ES3Options()
static Result MakeForShader(SkString sksl, const Options &)
virtual std::unique_ptr< Expression > clone(Position pos) const =0
std::string description() const final
std::unique_ptr< Statement > & declaration()
const T & as() const
Definition: SkSLIRNode.h:133
virtual bool visitExpression(typename T::Expression &expression)
bool isEmpty() const
Definition: SkString.h:130
const char * c_str() const
Definition: SkString.h:133
GrDirectContext * directContext() const
skgpu::ContextType type() const
const SkSL::ShaderCaps * shaderCaps() const
Definition: Caps.h:75
const Caps * caps() const
Definition: ContextPriv.h:32
BackendApi backend() const
Definition: Context.cpp:130
std::unique_ptr< Recorder > makeRecorder(const RecorderOptions &={})
Definition: Context.cpp:132
T * push_back_n(int n)
Definition: SkTArray.h:267
virtual skgpu::ContextType contextType()=0
DlColor color
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
VkSurfaceKHR surface
Definition: main.cc:49
FlutterSemanticsFlag flags
GAsyncResult * result
Win32Message message
double y
double x
constexpr SkColor4f kTransparent
Definition: SkColor.h:434
std::unique_ptr< RP::Program > MakeRasterPipelineProgram(const SkSL::Program &program, const FunctionDefinition &function, DebugTracePriv *debugTrace, bool writeTraceOps)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
Definition: bitmap.py:1
static uint8_t Hex(uint8_t value)
Definition: text_buffer.cc:167
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: main.py:1
compiler
Definition: malisc.py:17
skgpu::ganesh::TextureOp::Saturate Saturate
Definition: QuadPerEdgeAA.h:30
bool IsDawnBackend(skgpu::ContextType type)
Definition: ContextType.cpp:73
bool IsNativeBackend(skgpu::ContextType type)
Definition: ContextType.cpp:57
ContextType
Definition: ContextType.h:19
const char * ContextTypeName(skgpu::ContextType type)
Definition: ContextType.cpp:13
std::enable_if_t< sknonstd::is_bitmask_enum< E >::value, bool > constexpr Any(E e)
Definition: SkBitmaskEnum.h:16
constexpr bool contains(std::string_view str, std::string_view needle)
Definition: SkStringView.h:41
SeparatedVector2 offset
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
const SkRuntimeEffect::Uniform * fVar
bool set(const T val[], const int count)
sk_sp< SkRuntimeEffect > effect
bool fInfinitySupport
Definition: SkSLUtil.h:103
SkSL::Version supportedSkSLVerion() const
Definition: SkSLUtil.h:72
SkSpan< const float > span
Definition: SkSLTest.cpp:126
std::string_view name
Definition: SkSLTest.cpp:125
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63