Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
167 SkRuntimeShaderBuilder builder(effect);
168 for (const UniformData& data : kUniformData) {
169 SkRuntimeShaderBuilder::BuilderUniform uniform = builder.uniform(data.name);
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 disables["SwitchWithFallthrough"].push_back({_, "OpenGL", GPU, kiOS});
306
307 // - ARM ----------------------------------------------------------------------------------
308 // Mali 400 is a very old driver its share of quirks, particularly in relation to matrices.
309 for (const char* test : {"Matrices", // b/40043539
310 "MatrixNoOpFolding",
311 "MatrixScalarMath", // b/40043764
312 "MatrixSwizzleStore",
313 "MatrixScalarNoOpFolding", // b/40044644
314 "UnaryPositiveNegative",
315 "Cross"}) {
316 disables[test].push_back({regex("Mali-400"), _, GPU, _});
317 }
318
319 // - Nvidia -------------------------------------------------------------------------------
320 // Tegra3 has several issues, but the inability to break from a for loop is a common theme.
321 for (const char* test : {"Switch", // b/40043561
322 "SwitchDefaultOnly", // " "
323 "SwitchWithFallthrough", // " "
324 "SwitchWithFallthroughAndVarDecls", // " "
325 "SwitchWithLoops", // " "
326 "SwitchCaseFolding", // " "
327 "LoopFloat", // " "
328 "LoopInt", // " "
329 "MatrixScalarNoOpFolding", // b/40044644
330 "MatrixScalarMath", // b/40043764
331 "MatrixFoldingES2", // b/40043017
332 "MatrixEquality", // b/40043017
333 "IntrinsicFract",
334 "ModifiedStructParametersCannotBeInlined"}) {
335 disables[test].push_back({regex("Tegra 3"), _, GPU, _});
336 }
337
338 // Various Nvidia GPUs generate errors when assembling weird matrices, and erroneously
339 // constant-fold expressions with side-effects in constructors when compiling GLSL.
340 for (const char* test : {"MatrixConstructorsES2", // b/40043524
341 "MatrixConstructorsES3", // b/40043524
342 "MatrixScalarNoOpFolding", // b/40044644
343 "PreserveSideEffects", // b/40044140
344 "StructFieldNoFolding"}) { // b/40044479
345 disables[test].push_back({regex(NVIDIA), "OpenGL", _, _});
346 disables[test].push_back({regex(NVIDIA), "ANGLE GL", _, _});
347 }
348
349 disables["IntrinsicMixFloatES3"].push_back({regex("RTX "), "Vulkan", _, kWindows});
350
351 // The Golo features P400s with older and buggier drivers than usual.
352 for (const char* test : {"PreserveSideEffects", // b/40044140
353 "CommaSideEffects"}) {
354 disables[test].push_back({regex("Quadro P400"), _, _, kLinux});
355 }
356
357 // b/318725123
358 for (const char* test : {"UniformArray",
359 "TemporaryIndexLookup",
360 "MatrixIndexLookup"}) {
361 disables[test].push_back({regex("Quadro P400"), "Dawn Vulkan", Graphite, kWindows});
362 }
363
364 // - PowerVR ------------------------------------------------------------------------------
365 for (const char* test : {"OutParamsAreDistinct", // b/40044222
366 "OutParamsAreDistinctFromGlobal"}) {
367 disables[test].push_back({regex("PowerVR Rogue GE8300"), _, GPU, _});
368 }
369
370 // - Radeon -------------------------------------------------------------------------------
371 for (const char* test : {"DeadReturnES3", // b/301326132
372 "IntrinsicAll", // b/40045114
373 "MatrixConstructorsES3", // b/40043524
374 "MatrixScalarNoOpFolding", // b/40044644
375 "StructIndexStore", // b/40045236
376 "SwizzleIndexLookup", // b/40045254
377 "SwizzleIndexStore"}) { // b/40045254
378 disables[test].push_back({regex("Radeon.*(R9|HD)"), "OpenGL", GPU, _});
379 disables[test].push_back({regex("Radeon.*(R9|HD)"), "ANGLE GL", GPU, _});
380 }
381
382 // The Radeon Vega 6 doesn't return zero for the derivative of a uniform.
383 for (const char* test : {"IntrinsicDFdy",
384 "IntrinsicDFdx",
385 "IntrinsicFwidth"}) {
386 disables[test].push_back({regex("AMD RADV RENOIR"), _, GPU, _});
387 }
388
389 // - Adreno -------------------------------------------------------------------------------
390 // Disable broken tests on Android with Adreno GPUs (b/40043413, b/40045254)
391 for (const char* test : {"ArrayCast",
392 "ArrayComparison",
393 "CommaSideEffects",
394 "IntrinsicMixFloatES2",
395 "IntrinsicClampFloat",
396 "SwitchWithFallthrough",
397 "SwizzleIndexLookup",
398 "SwizzleIndexStore"}) {
399 disables[test].push_back({regex(ADRENO "[3456]"), _, _, kAndroid});
400 }
401
402 // Older Adreno 5/6xx drivers report a pipeline error or silently fail when handling inouts.
403 for (const char* test : {"VoidInSequenceExpressions", // b/295217166
404 "InoutParameters", // b/40043966
405 "OutParams",
406 "OutParamsDoubleSwizzle",
407 "OutParamsNoInline",
408 "OutParamsFunctionCallInArgument"}) {
409 disables[test].push_back({regex(ADRENO "[56]"), "Vulkan", _, kAndroid});
410 }
411
412 for (const char* test : {"MatrixToVectorCast", // b/40043288
413 "StructsInFunctions"}) { // b/40043024
414 disables[test].push_back({regex(ADRENO "[345]"), "OpenGL", _, kAndroid});
415 }
416
417 // Constructing a matrix from vectors and scalars can be surprisingly finicky (b/40043539)
418 for (const char* test : {"Matrices",
419 "MatrixNoOpFolding"}) {
420 disables[test].push_back({regex(ADRENO "3"), "OpenGL", _, kAndroid});
421 }
422
423 // Adreno 600 doesn't handle isinf() in OpenGL correctly. (b/40043464)
424 disables["IntrinsicIsInf"].push_back({regex(ADRENO "6"), "OpenGL", _, kAndroid});
425
426 // Older Adreno drivers crash when presented with an empty block (b/40044390)
427 disables["EmptyBlocksES3"].push_back({regex(ADRENO "(540|630)"), _, _, kAndroid});
428
429 // Adrenos alias out-params to globals improperly (b/40044222)
430 disables["OutParamsAreDistinctFromGlobal"].push_back({regex(ADRENO "[3456]"), "OpenGL",
431 _, kAndroid});
432 // Adreno generates the wrong result for this test. (b/40044477)
433 disables["StructFieldFolding"].push_back({regex(ADRENO "[56]"), "OpenGL",
434 _, kAndroid});
435
436 // b/318726662
437 for (const char* test : {"PrefixExpressionsES2",
438 "MatrixToVectorCast",
439 "MatrixConstructorsES2"}) {
440 disables[test].push_back({regex(ADRENO "620"), "Vulkan", Graphite, kAndroid});
441 }
442
443 // - Intel --------------------------------------------------------------------------------
444 // Disable various tests on Intel.
445 // Intrinsic floor() on Intel + ANGLE + DirectX is broken (anglebug.com/5588)
446 disables["IntrinsicFloor"].push_back({regex("Intel.*(Iris|HD)"), "ANGLE D3D", _, _});
447
448 // Intrinsic not() and mix() are broken on Intel GPUs in Metal. (b/40045105)
449 for (const char* test : {"IntrinsicNot",
450 "IntrinsicMixFloatES3"}) {
451 disables[test].push_back({regex("Intel.*(Iris|6000)"), "Metal", _, kMac});
452 }
453
454 // Swizzled-index store is broken across many Intel GPUs. (b/40045254)
455 disables["SwizzleIndexStore"].push_back({regex("Intel"), "OpenGL", _, kMac});
456 disables["SwizzleIndexStore"].push_back({regex("Intel.*Iris"), _, _, kWindows});
457
458 // vec4(mat2) conversions can lead to a crash on Intel + ANGLE (b/40043275)
459 for (const char* test : {"VectorToMatrixCast",
460 "VectorScalarMath",
461 "TrivialArgumentsInlineDirectly"}) {
462 disables[test].push_back({regex("Intel"), "ANGLE", _, kWindows});
463 }
464
465 for (const char* test : {"MatrixFoldingES2",
466 "MatrixEquality",
467 "TemporaryIndexLookup", // b/40045228
468 "SwizzleIndexLookup"}) { // b/40045254
469 disables[test].push_back({regex("Intel.*(Iris|4400)"), "OpenGL", _, kWindows});
470 disables[test].push_back({regex("Intel.*(Iris|4400)"), "ANGLE", _, kWindows});
471 }
472
473 for (const char* test : {"ReturnsValueOnEveryPathES3", // b/40043548
474 "OutParamsAreDistinctFromGlobal", // b/40044222
475 "StructFieldFolding"}) { // b/40044477
476 disables[test].push_back({regex("Intel"), "OpenGL", _, kWindows});
477 disables[test].push_back({regex("Intel"), "ANGLE GL", _, kWindows});
478 }
479
480 for (const char* test : {"SwitchDefaultOnly", // b/40043548
481 "ReturnsValueOnEveryPathES3"}) { // b/40045205
482 disables[test].push_back({regex("Intel"), "Vulkan", _, kLinux});
483 }
484
485 for (const char* test : {"SwitchDefaultOnly"}) {
486 disables[test].push_back({regex("Intel"), "ANGLE", _, kWindows});
487 }
488
489 for (const char* test : {"SwizzleAsLValueES3"}) { // https://anglebug.com/8260
490 disables[test].push_back({regex("Intel"), _, _, kWindows});
491 disables[test].push_back({_, "ANGLE", _, kWindows});
492 }
493
494 // Some Intel GPUs don't return zero for the derivative of a uniform.
495 for (const char* test : {"IntrinsicDFdy",
496 "IntrinsicDFdx",
497 "IntrinsicFwidth"}) {
498 disables[test].push_back({regex("Intel"), _, GPU, _});
499 }
500
501 disables["LoopFloat"].push_back({regex("Intel.*(Iris|6000)"), _, _, kMac}); // b/40043507
502
503 #undef ADRENO
504 #undef NVIDIA
505
506 return disables;
507 }()};
508
509 if (const std::vector<TestDisable>* testDisables = testDisableMap->find(name)) {
510 for (const TestDisable& d : *testDisables) {
511 if (d.platform.has_value() && !*d.platform) {
512 continue; // disable applies to a different platform
513 }
514 if (d.backendAPI.has_value() && !skstd::contains(backendAPI, *d.backendAPI)) {
515 continue; // disable applies to a different backend API
516 }
517 if (d.deviceName.has_value() &&
518 !std::regex_search(deviceName.begin(), deviceName.end(), *d.deviceName)) {
519 continue; // disable applies to a different device
520 }
521 if (d.testTypeMatcher == CPU && testType != skiatest::TestType::kCPU) {
522 continue; // disable only applies to CPU
523 }
524 if (d.testTypeMatcher == Ganesh && testType != skiatest::TestType::kGanesh) {
525 continue; // disable only applies to Ganesh
526 }
527 if (d.testTypeMatcher == Graphite && testType != skiatest::TestType::kGraphite) {
528 continue; // disable only applies to Graphites
529 }
530 if (d.testTypeMatcher == GPU && testType == skiatest::TestType::kCPU) {
531 continue; // disable only applies to GPU
532 }
533 // This test was disabled.
534 return true;
535 }
536 }
537
538 // This test was not in our disable list.
539 return false;
540}
541
543 std::string_view deviceName,
544 std::string_view backendAPI,
546 const char* name,
547 const char* testFile,
548 skiatest::TestType testType,
549 const char* permutationSuffix,
551 SkString shaderString = load_source(r, testFile, permutationSuffix);
552 if (shaderString.isEmpty()) {
553 return;
554 }
556 if (!result.effect) {
557 ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
558 return;
559 }
560 if (failure_is_expected(deviceName, backendAPI, name, testType)) {
561 // Some driver bugs can be catastrophic (e.g. crashing dm entirely), so we don't even try to
562 // run a shader if we expect that it might fail.
563 SkDebugf("%s: skipped %.*s%s\n", testFile, (int)backendAPI.size(), backendAPI.data(),
564 permutationSuffix);
565 return;
566 }
567
569 if (bitmap.empty()) {
570 ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
571 return;
572 }
573
574 bool success = true;
576 for (int y = 0; y < kHeight; ++y) {
577 for (int x = 0; x < kWidth; ++x) {
578 color[y][x] = bitmap.getColor(x, y);
579 if (color[y][x] != SK_ColorGREEN) {
580 success = false;
581 }
582 }
583 }
584
585 if (!success) {
586 static_assert(kWidth == 2);
587 static_assert(kHeight == 2);
588
589 SkString message = SkStringPrintf("Expected%s: solid green. Actual output from %.*s using "
590 "%.*s:\n"
591 "RRGGBBAA RRGGBBAA\n"
592 "%02X%02X%02X%02X %02X%02X%02X%02X\n"
593 "%02X%02X%02X%02X %02X%02X%02X%02X",
594 permutationSuffix,
595 (int)deviceName.size(), deviceName.data(),
596 (int)backendAPI.size(), backendAPI.data(),
597
598 SkColorGetR(color[0][0]), SkColorGetG(color[0][0]),
599 SkColorGetB(color[0][0]), SkColorGetA(color[0][0]),
600
601 SkColorGetR(color[0][1]), SkColorGetG(color[0][1]),
602 SkColorGetB(color[0][1]), SkColorGetA(color[0][1]),
603
604 SkColorGetR(color[1][0]), SkColorGetG(color[1][0]),
605 SkColorGetB(color[1][0]), SkColorGetA(color[1][0]),
606
607 SkColorGetR(color[1][1]), SkColorGetG(color[1][1]),
608 SkColorGetB(color[1][1]), SkColorGetA(color[1][1]));
609
610 ERRORF(r, "%s", message.c_str());
611 }
612}
613
615 std::string_view deviceName,
616 std::string_view backendAPI,
618 const char* name,
619 const char* testFile,
620 skiatest::TestType testType,
621 bool strictES2) {
624 options.forceUnoptimized = false;
625 test_one_permutation(r, deviceName, backendAPI, surface, name, testFile, testType, "", options);
626
627 options.forceUnoptimized = true;
628 test_one_permutation(r, deviceName, backendAPI, surface, name, testFile, testType,
629 " (Unoptimized)", options);
630}
631
633 const char* name,
634 const char* testFile,
637
638 // Create a raster-backed surface.
641
642 test_permutations(r, "CPU", "SkRP", surface.get(), name, testFile,
643 skiatest::TestType::kCPU, /*strictES2=*/true);
644}
645
646#if defined(SK_GANESH)
647static void test_ganesh(skiatest::Reporter* r,
648 const sk_gpu_test::ContextInfo& ctxInfo,
649 const char* name,
650 const char* testFile,
652 GrDirectContext *ctx = ctxInfo.directContext();
653
654 // If this is an ES3-only test on a GPU which doesn't support SkSL ES3, return immediately.
655 bool shouldRunGPU = SkToBool(flags & SkSLTestFlag::GPU);
656 bool shouldRunGPU_ES3 =
659 if (!shouldRunGPU && !shouldRunGPU_ES3) {
660 return;
661 }
662
663 // If this is a test that requires the GPU to generate NaN values, check for that first.
665 if (!gpu_generates_nan(r, ctx)) {
666 return;
667 }
668 }
669
670 // Create a GPU-backed Ganesh surface.
673 std::string_view deviceName = ctx->priv().caps()->deviceName();
674 std::string_view backendAPI = skgpu::ContextTypeName(ctxInfo.type());
675
676 if (shouldRunGPU) {
677 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
678 skiatest::TestType::kGanesh, /*strictES2=*/true);
679 }
680 if (shouldRunGPU_ES3) {
681 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
682 skiatest::TestType::kGanesh, /*strictES2=*/false);
683 }
684}
685#endif
686
687#if defined(SK_GRAPHITE)
688// Note: SKSL_TEST sets CTS enforcement API level to max(kApiLevel_V, ctsEnforcement) for Graphite.
689static void test_graphite(skiatest::Reporter* r,
692 const char* name,
693 const char* testFile,
695 // If this is an ES3-only test on a GPU which doesn't support SkSL ES3, return immediately.
696 bool shouldRunGPU = SkToBool(flags & SkSLTestFlag::GPU);
697 bool shouldRunGPU_ES3 =
700 if (!shouldRunGPU && !shouldRunGPU_ES3) {
701 return;
702 }
703
704#if defined(SK_DAWN)
705 if (ctx->backend() == skgpu::BackendApi::kDawn) {
706 // If this is a test that requires the GPU to generate NaN values, we don't run it in Dawn.
707 // (WGSL/Dawn does not support infinity or NaN even if the GPU natively does.)
709 return;
710 }
711 }
712#endif
713
714 // Create a GPU-backed Graphite surface.
715 std::unique_ptr<skgpu::graphite::Recorder> recorder = ctx->makeRecorder();
716
721 std::string_view deviceName = ctx->priv().caps()->deviceName();
722 std::string_view backendAPI = skgpu::ContextTypeName(testCtx->contextType());
723
724 if (shouldRunGPU) {
725 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
726 skiatest::TestType::kGraphite, /*strictES2=*/true);
727 }
728 if (shouldRunGPU_ES3) {
729 test_permutations(r, deviceName, backendAPI, surface.get(), name, testFile,
730 skiatest::TestType::kGraphite, /*strictES2=*/false);
731 }
732}
733#endif
734
735static void test_clone(skiatest::Reporter* r, const char* testFile, SkSLTestFlags flags) {
736 SkString shaderString = load_source(r, testFile, "");
737 if (shaderString.isEmpty()) {
738 return;
739 }
740 SkSL::ProgramSettings settings;
741 // TODO(skia:11209): Can we just put the correct #version in the source files that need this?
742 settings.fMaxVersionAllowed = is_strict_es2(flags) ? SkSL::Version::k100 : SkSL::Version::k300;
744 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
745 SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
746 if (!program) {
747 ERRORF(r, "%s", compiler.errorText().c_str());
748 return;
749 }
750
751 // Clone every expression in the program, and ensure that its clone generates the same
752 // description as the original.
753 class CloneVisitor : public SkSL::ProgramVisitor {
754 public:
755 CloneVisitor(skiatest::Reporter* r) : fReporter(r) {}
756
757 bool visitExpression(const SkSL::Expression& expr) override {
758 std::string original = expr.description();
759 std::string cloned = expr.clone()->description();
760 REPORTER_ASSERT(fReporter, original == cloned,
761 "Mismatch after clone!\nOriginal: %s\nCloned: %s\n",
762 original.c_str(), cloned.c_str());
763
764 return INHERITED::visitExpression(expr);
765 }
766
767 skiatest::Reporter* fReporter;
768
769 using INHERITED = ProgramVisitor;
770 };
771
772 CloneVisitor{r}.visit(*program);
773}
774
775static void report_rp_pass(skiatest::Reporter* r, const char* testFile, SkSLTestFlags flags) {
777 ERRORF(r, "NEW: %s", testFile);
778 }
779}
780
782 const char* testFile,
784 const char* reason) {
786 ERRORF(r, "%s: %s", testFile, reason);
787 }
788}
789
791 const char* testFile,
793 SkString shaderString = load_source(r, testFile, "");
794 if (shaderString.isEmpty()) {
795 return;
796 }
797
798 // In Raster Pipeline, we can compile and run test shaders directly, without involving a surface
799 // at all.
801 SkSL::ProgramSettings settings;
802 settings.fMaxVersionAllowed = SkSL::Version::k300;
803 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
804 SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
805 if (!program) {
806 ERRORF(r, "%s: Unexpected compilation error\n%s", testFile, compiler.errorText().c_str());
807 return;
808 }
809 const SkSL::FunctionDeclaration* main = program->getFunction("main");
810 if (!main) {
811 ERRORF(r, "%s: Program must have a 'main' function", testFile);
812 return;
813 }
814
815 // Match up uniforms from the program against our list of test uniforms, and build up a data
816 // buffer of uniform floats.
817 size_t offset = 0;
819 const SkSL::Context& ctx(compiler.context());
820
821 for (const SkSL::ProgramElement* elem : program->elements()) {
822 // Variables (uniform, etc.)
823 if (elem->is<SkSL::GlobalVarDeclaration>()) {
825 const SkSL::VarDeclaration& varDecl = global.declaration()->as<SkSL::VarDeclaration>();
826 const SkSL::Variable& var = *varDecl.var();
827
828 if (var.type().isEffectChild()) {
829 ERRORF(r, "%s: Test program cannot contain child effects", testFile);
830 return;
831 }
832 // 'uniform' variables
833 if (var.modifierFlags().isUniform()) {
835 }
836 }
837 }
838
839 TArray<float> uniformValues;
840 for (const SkRuntimeEffect::Uniform& programUniform : uniforms) {
841 bool foundMatch = false;
842 for (const UniformData& data : kUniformData) {
843 if (data.name == programUniform.name) {
844 SkASSERT(data.span.size() * sizeof(float) == programUniform.sizeInBytes());
845 foundMatch = true;
846 uniformValues.push_back_n(data.span.size(), data.span.data());
847 break;
848 }
849 }
850 if (!foundMatch) {
851 report_rp_fail(r, testFile, flags, "unsupported uniform");
852 return;
853 }
854 }
855
856 // Compile our program.
857 SkArenaAlloc alloc(/*firstHeapAllocation=*/1000);
858 SkRasterPipeline pipeline(&alloc);
859 SkSL::DebugTracePriv debugTrace;
860 std::unique_ptr<SkSL::RP::Program> rasterProg =
862 *main->definition(),
863 &debugTrace);
864 if (!rasterProg) {
865 report_rp_fail(r, testFile, flags, "code is not supported");
866 return;
867 }
868
869 // Append the SkSL program to the raster pipeline.
871 rasterProg->appendStages(&pipeline, &alloc, /*callbacks=*/nullptr, SkSpan(uniformValues));
872
873 // Move the float values from RGBA into an 8888 memory buffer.
874 uint32_t out[SkRasterPipeline_kMaxStride_highp] = {};
875 SkRasterPipeline_MemoryCtx outCtx{/*pixels=*/out, /*stride=*/SkRasterPipeline_kMaxStride_highp};
876 pipeline.append(SkRasterPipelineOp::store_8888, &outCtx);
877 pipeline.run(0, 0, 1, 1);
878
879 // Make sure the first pixel (exclusively) of `out` is green. If the program compiled
880 // successfully, we expect it to run without error, and will assert if it doesn't.
881 uint32_t expected = 0xFF00FF00;
882 if (out[0] != expected) {
883 ERRORF(r, "%s: Raster Pipeline failed. Expected solid green, got ARGB:%02X%02X%02X%02X",
884 testFile,
885 (out[0] >> 24) & 0xFF,
886 (out[0] >> 16) & 0xFF,
887 (out[0] >> 8) & 0xFF,
888 out[0] & 0xFF);
889 return;
890 }
891
892 // Success!
893 report_rp_pass(r, testFile, flags);
894}
895
896#if defined(SK_GANESH)
897#define DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) \
898 DEF_CONDITIONAL_GANESH_TEST_FOR_RENDERING_CONTEXTS(SkSL##name##_Ganesh, \
899 r, \
900 ctxInfo, \
901 is_gpu(flags), \
902 ctsEnforcement) { \
903 test_ganesh(r, ctxInfo, #name, path, flags); \
904 }
905#else
906#define DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) /* Ganesh is disabled */
907#endif
908
909#if defined(SK_GRAPHITE)
910static bool is_native_context_or_dawn(skgpu::ContextType type) {
912}
913
914#define DEF_GRAPHITE_SKSL_TEST(flags, ctsEnforcement, name, path) \
915 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_CONTEXTS(SkSL##name##_Graphite, \
916 is_native_context_or_dawn, \
917 r, \
918 context, \
919 testContext, \
920 /*opt_filter=*/nullptr, \
921 is_gpu(flags), \
922 ctsEnforcement) { \
923 test_graphite(r, context, testContext, #name, path, flags); \
924 }
925#else
926#define DEF_GRAPHITE_SKSL_TEST(flags, ctsEnforcement, name, path) /* Graphite is disabled */
927#endif
928
929#define SKSL_TEST(flags, ctsEnforcement, name, path) \
930 DEF_CONDITIONAL_TEST(SkSL##name##_CPU, r, is_cpu(flags)) { test_cpu(r, #name, path, flags); } \
931 DEF_TEST(SkSL##name##_RP, r) { test_raster_pipeline(r, path, flags); } \
932 DEF_TEST(SkSL##name##_Clone, r) { test_clone(r, path, flags); } \
933 DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) \
934 DEF_GRAPHITE_SKSL_TEST(flags, std::max(kApiLevel_V, ctsEnforcement), name, path)
935
936/**
937 * Test flags:
938 * - CPU: this test should pass on the CPU backend
939 * - GPU: this test should pass on the Ganesh GPU backends
940 * - GPU_ES3: this test should pass on an ES3-compatible GPU when "enforce ES2 restrictions" is off
941 *
942 * CtsEnforcement:
943 * Android CTS (go/wtf/cts) enforces that devices must pass this test at the given API level.
944 * CTS and Android SkQP builds should only run tests on devices greater than the provided API
945 * level, but other test binaries (dm/fm) should run every test, regardless of this value.
946 */
947
948// clang-format off
949
957[[maybe_unused]] constexpr auto kApiLevel_V = CtsEnforcement::kApiLevel_V;
959[[maybe_unused]] constexpr auto kNextRelease = CtsEnforcement::kNextRelease;
960
961SKSL_TEST(ES3 | GPU_ES3, kApiLevel_T, ArrayFolding, "folding/ArrayFolding.sksl")
962SKSL_TEST(CPU | GPU, kApiLevel_T, ArraySizeFolding, "folding/ArraySizeFolding.rts")
963SKSL_TEST(CPU | GPU, kApiLevel_T, AssignmentOps, "folding/AssignmentOps.rts")
964SKSL_TEST(CPU | GPU, kApiLevel_T, BoolFolding, "folding/BoolFolding.rts")
965SKSL_TEST(CPU | GPU, kApiLevel_T, CastFolding, "folding/CastFolding.rts")
966SKSL_TEST(CPU | GPU, kApiLevel_T, IntFoldingES2, "folding/IntFoldingES2.rts")
967SKSL_TEST(ES3 | GPU_ES3, kNever, IntFoldingES3, "folding/IntFoldingES3.sksl")
968SKSL_TEST(CPU | GPU, kApiLevel_T, FloatFolding, "folding/FloatFolding.rts")
969SKSL_TEST(CPU | GPU, kNextRelease,LogicalNot, "folding/LogicalNot.rts")
970SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixFoldingES2, "folding/MatrixFoldingES2.rts")
971SKSL_TEST(ES3 | GPU_ES3, kNever, MatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
972SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixNoOpFolding, "folding/MatrixNoOpFolding.rts")
973SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixScalarNoOpFolding, "folding/MatrixScalarNoOpFolding.rts")
974SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixVectorNoOpFolding, "folding/MatrixVectorNoOpFolding.rts")
975SKSL_TEST(CPU | GPU, kApiLevel_T, Negation, "folding/Negation.rts")
976SKSL_TEST(CPU | GPU, kApiLevel_T, PreserveSideEffects, "folding/PreserveSideEffects.rts")
977SKSL_TEST(CPU | GPU, kApiLevel_T, SelfAssignment, "folding/SelfAssignment.rts")
978SKSL_TEST(CPU | GPU, kApiLevel_T, ShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.rts")
979SKSL_TEST(CPU | GPU, kApiLevel_U, StructFieldFolding, "folding/StructFieldFolding.rts")
980SKSL_TEST(CPU | GPU, kApiLevel_U, StructFieldNoFolding, "folding/StructFieldNoFolding.rts")
981SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchCaseFolding, "folding/SwitchCaseFolding.rts")
982SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleFolding, "folding/SwizzleFolding.rts")
983SKSL_TEST(CPU | GPU, kApiLevel_U, TernaryFolding, "folding/TernaryFolding.rts")
984SKSL_TEST(CPU | GPU, kApiLevel_T, VectorScalarFolding, "folding/VectorScalarFolding.rts")
985SKSL_TEST(CPU | GPU, kApiLevel_T, VectorVectorFolding, "folding/VectorVectorFolding.rts")
986
987SKSL_TEST(CPU | GPU, kNextRelease,CommaExpressionsAllowInlining, "inliner/CommaExpressionsAllowInlining.sksl")
988SKSL_TEST(ES3 | GPU_ES3, kNever, DoWhileBodyMustBeInlinedIntoAScope, "inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
989SKSL_TEST(ES3 | GPU_ES3, kNever, DoWhileTestCannotBeInlined, "inliner/DoWhileTestCannotBeInlined.sksl")
990SKSL_TEST(CPU | GPU, kApiLevel_T, ForBodyMustBeInlinedIntoAScope, "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
991SKSL_TEST(ES3 | GPU_ES3, kNever, ForInitializerExpressionsCanBeInlined, "inliner/ForInitializerExpressionsCanBeInlined.sksl")
992SKSL_TEST(CPU | GPU, kApiLevel_T, ForWithoutReturnInsideCanBeInlined, "inliner/ForWithoutReturnInsideCanBeInlined.sksl")
993SKSL_TEST(CPU | GPU, kApiLevel_T, ForWithReturnInsideCannotBeInlined, "inliner/ForWithReturnInsideCannotBeInlined.sksl")
994SKSL_TEST(CPU | GPU, kApiLevel_T, IfBodyMustBeInlinedIntoAScope, "inliner/IfBodyMustBeInlinedIntoAScope.sksl")
995SKSL_TEST(CPU | GPU, kApiLevel_T, IfElseBodyMustBeInlinedIntoAScope, "inliner/IfElseBodyMustBeInlinedIntoAScope.sksl")
996SKSL_TEST(CPU | GPU, kApiLevel_T, IfElseChainWithReturnsCanBeInlined, "inliner/IfElseChainWithReturnsCanBeInlined.sksl")
997SKSL_TEST(CPU | GPU, kApiLevel_T, IfTestCanBeInlined, "inliner/IfTestCanBeInlined.sksl")
998SKSL_TEST(CPU | GPU, kApiLevel_T, IfWithReturnsCanBeInlined, "inliner/IfWithReturnsCanBeInlined.sksl")
999SKSL_TEST(CPU | GPU, kApiLevel_T, InlineKeywordOverridesThreshold, "inliner/InlineKeywordOverridesThreshold.sksl")
1000SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerAvoidsVariableNameOverlap, "inliner/InlinerAvoidsVariableNameOverlap.sksl")
1001SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerElidesTempVarForReturnsInsideBlock, "inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl")
1002SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerUsesTempVarForMultipleReturns, "inliner/InlinerUsesTempVarForMultipleReturns.sksl")
1003SKSL_TEST(CPU | GPU, kApiLevel_T, InlinerUsesTempVarForReturnsInsideBlockWithVar, "inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl")
1004SKSL_TEST(CPU | GPU, kApiLevel_T, InlineThreshold, "inliner/InlineThreshold.sksl")
1005SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, InlineUnscopedVariable, "inliner/InlineUnscopedVariable.sksl")
1006SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithModifiedArgument, "inliner/InlineWithModifiedArgument.sksl")
1007SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithNestedBigCalls, "inliner/InlineWithNestedBigCalls.sksl")
1008SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithUnmodifiedArgument, "inliner/InlineWithUnmodifiedArgument.sksl")
1009SKSL_TEST(CPU | GPU, kApiLevel_T, InlineWithUnnecessaryBlocks, "inliner/InlineWithUnnecessaryBlocks.sksl")
1010SKSL_TEST(CPU | GPU, kNextRelease,IntrinsicNameCollision, "inliner/IntrinsicNameCollision.sksl")
1011SKSL_TEST(CPU | GPU, kNextRelease,ModifiedArrayParametersCannotBeInlined, "inliner/ModifiedArrayParametersCannotBeInlined.sksl")
1012SKSL_TEST(CPU | GPU, kNextRelease,ModifiedStructParametersCannotBeInlined, "inliner/ModifiedStructParametersCannotBeInlined.sksl")
1013SKSL_TEST(CPU | GPU, kApiLevel_T, NoInline, "inliner/NoInline.sksl")
1014SKSL_TEST(CPU | GPU, kApiLevel_T, ShortCircuitEvaluationsCannotInlineRightHandSide, "inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl")
1015SKSL_TEST(ES3 | GPU_ES3, kNever, StaticSwitchInline, "inliner/StaticSwitch.sksl")
1016SKSL_TEST(CPU | GPU, kApiLevel_T, StructsCanBeInlinedSafely, "inliner/StructsCanBeInlinedSafely.sksl")
1017SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleCanBeInlinedDirectly, "inliner/SwizzleCanBeInlinedDirectly.sksl")
1018SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryResultsCannotBeInlined, "inliner/TernaryResultsCannotBeInlined.sksl")
1019SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryTestCanBeInlined, "inliner/TernaryTestCanBeInlined.sksl")
1020SKSL_TEST(CPU | GPU, kApiLevel_T, TrivialArgumentsInlineDirectly, "inliner/TrivialArgumentsInlineDirectly.sksl")
1021SKSL_TEST(ES3 | GPU_ES3, kNever, TrivialArgumentsInlineDirectlyES3, "inliner/TrivialArgumentsInlineDirectlyES3.sksl")
1022SKSL_TEST(CPU | GPU, kNextRelease,TypeShadowing, "inliner/TypeShadowing.sksl")
1023SKSL_TEST(ES3 | GPU_ES3, kNever, WhileBodyMustBeInlinedIntoAScope, "inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
1024SKSL_TEST(ES3 | GPU_ES3, kNever, WhileTestCannotBeInlined, "inliner/WhileTestCannotBeInlined.sksl")
1025
1026SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
1027SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicAbsInt, "intrinsics/AbsInt.sksl")
1028SKSL_TEST(CPU | GPU, kNever, IntrinsicAny, "intrinsics/Any.sksl")
1029SKSL_TEST(CPU | GPU, kNever, IntrinsicAll, "intrinsics/All.sksl")
1030SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicCeil, "intrinsics/Ceil.sksl")
1031SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicClampInt, "intrinsics/ClampInt.sksl")
1032SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicClampUInt, "intrinsics/ClampUInt.sksl")
1033SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicClampFloat, "intrinsics/ClampFloat.sksl")
1034SKSL_TEST(CPU | GPU, kNever, IntrinsicCross, "intrinsics/Cross.sksl")
1035SKSL_TEST(CPU | GPU, kNever, IntrinsicDegrees, "intrinsics/Degrees.sksl")
1036SKSL_TEST(GPU_ES3, kNever, IntrinsicDeterminant, "intrinsics/Determinant.sksl")
1037SKSL_TEST(GPU_ES3, kNever, IntrinsicDFdx, "intrinsics/DFdx.sksl")
1038SKSL_TEST(GPU_ES3, kNever, IntrinsicDFdy, "intrinsics/DFdy.sksl")
1039SKSL_TEST(CPU | GPU, kNever, IntrinsicDot, "intrinsics/Dot.sksl")
1040SKSL_TEST(CPU | GPU, kNever, IntrinsicFract, "intrinsics/Fract.sksl")
1041SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl")
1042SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl")
1043SKSL_TEST(CPU | GPU, kNever, IntrinsicFloor, "intrinsics/Floor.sksl")
1044SKSL_TEST(GPU_ES3, kNever, IntrinsicFwidth, "intrinsics/Fwidth.sksl")
1045SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicIntBitsToFloat, "intrinsics/IntBitsToFloat.sksl")
1046SKSL_TEST(GPU_ES3, kNever, IntrinsicIsInf, "intrinsics/IsInf.sksl")
1047SKSL_TEST(CPU | GPU, kNever, IntrinsicLength, "intrinsics/Length.sksl")
1048SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMatrixCompMultES2, "intrinsics/MatrixCompMultES2.sksl")
1049SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMatrixCompMultES3, "intrinsics/MatrixCompMultES3.sksl")
1050SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMaxFloat, "intrinsics/MaxFloat.sksl")
1051SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMaxInt, "intrinsics/MaxInt.sksl")
1052SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMaxUint, "intrinsics/MaxUint.sksl")
1053SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMinFloat, "intrinsics/MinFloat.sksl")
1054SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMinInt, "intrinsics/MinInt.sksl")
1055SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMinUint, "intrinsics/MinUint.sksl")
1056SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicMixFloatES2, "intrinsics/MixFloatES2.sksl")
1057SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicMixFloatES3, "intrinsics/MixFloatES3.sksl")
1058SKSL_TEST(GPU_ES3, kNever, IntrinsicModf, "intrinsics/Modf.sksl")
1059SKSL_TEST(CPU | GPU, kNever, IntrinsicNot, "intrinsics/Not.sksl")
1060SKSL_TEST(GPU_ES3, kNever, IntrinsicOuterProduct, "intrinsics/OuterProduct.sksl")
1061SKSL_TEST(CPU | GPU, kNever, IntrinsicRadians, "intrinsics/Radians.sksl")
1062SKSL_TEST(GPU_ES3, kNever, IntrinsicRound, "intrinsics/Round.sksl")
1063SKSL_TEST(GPU_ES3, kNever, IntrinsicRoundEven, "intrinsics/RoundEven.sksl")
1064SKSL_TEST(CPU | GPU, kNever, IntrinsicSaturate, "intrinsics/Saturate.sksl")
1065SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicSignFloat, "intrinsics/SignFloat.sksl")
1066SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicSignInt, "intrinsics/SignInt.sksl")
1067SKSL_TEST(CPU | GPU, kNever, IntrinsicSqrt, "intrinsics/Sqrt.sksl")
1068SKSL_TEST(CPU | GPU, kApiLevel_T, IntrinsicStep, "intrinsics/Step.sksl")
1069SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicTrunc, "intrinsics/Trunc.sksl")
1070SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicTranspose, "intrinsics/Transpose.sksl")
1071SKSL_TEST(ES3 | GPU_ES3, kNever, IntrinsicUintBitsToFloat, "intrinsics/UintBitsToFloat.sksl")
1072
1073SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayNarrowingConversions, "runtime/ArrayNarrowingConversions.rts")
1074SKSL_TEST(ES3 | GPU_ES3, kNever, Commutative, "runtime/Commutative.rts")
1075SKSL_TEST(CPU, kNever, DivideByZero, "runtime/DivideByZero.rts")
1076SKSL_TEST(CPU | GPU, kNextRelease,FunctionParameterAliasingFirst, "runtime/FunctionParameterAliasingFirst.rts")
1077SKSL_TEST(CPU | GPU, kNextRelease,FunctionParameterAliasingSecond, "runtime/FunctionParameterAliasingSecond.rts")
1078SKSL_TEST(CPU | GPU, kNextRelease,IncrementDisambiguation, "runtime/IncrementDisambiguation.rts")
1079SKSL_TEST(CPU | GPU, kApiLevel_T, LoopFloat, "runtime/LoopFloat.rts")
1080SKSL_TEST(CPU | GPU, kApiLevel_T, LoopInt, "runtime/LoopInt.rts")
1081SKSL_TEST(CPU | GPU, kApiLevel_U, Ossfuzz52603, "runtime/Ossfuzz52603.rts")
1082SKSL_TEST(CPU | GPU, kApiLevel_T, QualifierOrder, "runtime/QualifierOrder.rts")
1083SKSL_TEST(CPU | GPU, kApiLevel_T, PrecisionQualifiers, "runtime/PrecisionQualifiers.rts")
1084
1085SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Arrays, "runtime/RecursiveComparison_Arrays.rts")
1086SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Structs, "runtime/RecursiveComparison_Structs.rts")
1087SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Types, "runtime/RecursiveComparison_Types.rts")
1088SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Vectors, "runtime/RecursiveComparison_Vectors.rts")
1089
1090SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayCast, "shared/ArrayCast.sksl")
1091SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayComparison, "shared/ArrayComparison.sksl")
1092SKSL_TEST(ES3 | GPU_ES3, kNever, ArrayConstructors, "shared/ArrayConstructors.sksl")
1093SKSL_TEST(CPU | GPU, kNextRelease,ArrayFollowedByScalar, "shared/ArrayFollowedByScalar.sksl")
1094SKSL_TEST(CPU | GPU, kApiLevel_T, ArrayTypes, "shared/ArrayTypes.sksl")
1095SKSL_TEST(CPU | GPU, kApiLevel_T, Assignment, "shared/Assignment.sksl")
1096SKSL_TEST(CPU | GPU, kApiLevel_T, CastsRoundTowardZero, "shared/CastsRoundTowardZero.sksl")
1097SKSL_TEST(CPU | GPU, kApiLevel_T, CommaMixedTypes, "shared/CommaMixedTypes.sksl")
1098SKSL_TEST(CPU | GPU, kApiLevel_T, CommaSideEffects, "shared/CommaSideEffects.sksl")
1099SKSL_TEST(CPU | GPU, kApiLevel_U, CompileTimeConstantVariables, "shared/CompileTimeConstantVariables.sksl")
1100SKSL_TEST(ES3 | GPU_ES3, kNever, ConstantCompositeAccessViaConstantIndex, "shared/ConstantCompositeAccessViaConstantIndex.sksl")
1101SKSL_TEST(ES3 | GPU_ES3, kNever, ConstantCompositeAccessViaDynamicIndex, "shared/ConstantCompositeAccessViaDynamicIndex.sksl")
1102SKSL_TEST(CPU | GPU, kApiLevel_T, ConstantIf, "shared/ConstantIf.sksl")
1103SKSL_TEST(ES3 | GPU_ES3, kNever, ConstArray, "shared/ConstArray.sksl")
1104SKSL_TEST(CPU | GPU, kApiLevel_T, ConstVariableComparison, "shared/ConstVariableComparison.sksl")
1105SKSL_TEST(CPU | GPU, kNever, DeadGlobals, "shared/DeadGlobals.sksl")
1106SKSL_TEST(ES3 | GPU_ES3, kNever, DeadLoopVariable, "shared/DeadLoopVariable.sksl")
1107SKSL_TEST(CPU | GPU, kApiLevel_T, DeadIfStatement, "shared/DeadIfStatement.sksl")
1108SKSL_TEST(CPU | GPU, kApiLevel_T, DeadReturn, "shared/DeadReturn.sksl")
1109SKSL_TEST(ES3 | GPU_ES3, kNever, DeadReturnES3, "shared/DeadReturnES3.sksl")
1110SKSL_TEST(CPU | GPU, kApiLevel_T, DeadStripFunctions, "shared/DeadStripFunctions.sksl")
1111SKSL_TEST(CPU | GPU, kApiLevel_T, DependentInitializers, "shared/DependentInitializers.sksl")
1112SKSL_TEST(CPU | GPU, kApiLevel_U, DoubleNegation, "shared/DoubleNegation.sksl")
1113SKSL_TEST(ES3 | GPU_ES3, kNever, DoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
1114SKSL_TEST(CPU | GPU, kApiLevel_T, EmptyBlocksES2, "shared/EmptyBlocksES2.sksl")
1115SKSL_TEST(ES3 | GPU_ES3, kNever, EmptyBlocksES3, "shared/EmptyBlocksES3.sksl")
1116SKSL_TEST(CPU | GPU, kApiLevel_T, ForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
1117SKSL_TEST(ES3 | GPU_ES3, kNever, ForLoopMultipleInitES3, "shared/ForLoopMultipleInitES3.sksl")
1118SKSL_TEST(CPU | GPU, kNextRelease,ForLoopShadowing, "shared/ForLoopShadowing.sksl")
1119SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionAnonymousParameters, "shared/FunctionAnonymousParameters.sksl")
1120SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionArgTypeMatch, "shared/FunctionArgTypeMatch.sksl")
1121SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionReturnTypeMatch, "shared/FunctionReturnTypeMatch.sksl")
1122SKSL_TEST(CPU | GPU, kApiLevel_T, Functions, "shared/Functions.sksl")
1123SKSL_TEST(CPU | GPU, kApiLevel_T, FunctionPrototype, "shared/FunctionPrototype.sksl")
1124SKSL_TEST(CPU | GPU, kApiLevel_T, GeometricIntrinsics, "shared/GeometricIntrinsics.sksl")
1126SKSL_TEST(CPU | GPU, kApiLevel_T, Hex, "shared/Hex.sksl")
1127SKSL_TEST(ES3 | GPU_ES3, kNever, HexUnsigned, "shared/HexUnsigned.sksl")
1128SKSL_TEST(CPU | GPU, kNextRelease,IfStatement, "shared/IfStatement.sksl")
1129SKSL_TEST(CPU | GPU, kApiLevel_T, InoutParameters, "shared/InoutParameters.sksl")
1130SKSL_TEST(CPU | GPU, kApiLevel_U, InoutParamsAreDistinct, "shared/InoutParamsAreDistinct.sksl")
1131SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, IntegerDivisionES3, "shared/IntegerDivisionES3.sksl")
1132SKSL_TEST(CPU | GPU, kApiLevel_U, LogicalAndShortCircuit, "shared/LogicalAndShortCircuit.sksl")
1133SKSL_TEST(CPU | GPU, kApiLevel_U, LogicalOrShortCircuit, "shared/LogicalOrShortCircuit.sksl")
1134SKSL_TEST(CPU | GPU, kApiLevel_T, Matrices, "shared/Matrices.sksl")
1135SKSL_TEST(ES3 | GPU_ES3, kNever, MatricesNonsquare, "shared/MatricesNonsquare.sksl")
1136SKSL_TEST(CPU | GPU, kNever, MatrixConstructorsES2, "shared/MatrixConstructorsES2.sksl")
1137SKSL_TEST(ES3 | GPU_ES3, kNever, MatrixConstructorsES3, "shared/MatrixConstructorsES3.sksl")
1138SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixEquality, "shared/MatrixEquality.sksl")
1139SKSL_TEST(CPU | GPU, kNextRelease,MatrixIndexLookup, "shared/MatrixIndexLookup.sksl")
1140SKSL_TEST(CPU | GPU, kNextRelease,MatrixIndexStore, "shared/MatrixIndexStore.sksl")
1141SKSL_TEST(CPU | GPU, kApiLevel_U, MatrixOpEqualsES2, "shared/MatrixOpEqualsES2.sksl")
1142SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, MatrixOpEqualsES3, "shared/MatrixOpEqualsES3.sksl")
1143SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixScalarMath, "shared/MatrixScalarMath.sksl")
1144SKSL_TEST(CPU | GPU, kNextRelease,MatrixSwizzleStore, "shared/MatrixSwizzleStore.sksl")
1145SKSL_TEST(CPU | GPU, kApiLevel_T, MatrixToVectorCast, "shared/MatrixToVectorCast.sksl")
1146SKSL_TEST(CPU | GPU, kApiLevel_T, MultipleAssignments, "shared/MultipleAssignments.sksl")
1147SKSL_TEST(CPU | GPU, kApiLevel_T, NumberCasts, "shared/NumberCasts.sksl")
1148SKSL_TEST(CPU | GPU, kNextRelease,NestedComparisonIntrinsics, "shared/NestedComparisonIntrinsics.sksl")
1149SKSL_TEST(CPU | GPU, kApiLevel_T, OperatorsES2, "shared/OperatorsES2.sksl")
1150SKSL_TEST(GPU_ES3, kNever, OperatorsES3, "shared/OperatorsES3.sksl")
1151SKSL_TEST(CPU | GPU, kApiLevel_T, Ossfuzz36852, "shared/Ossfuzz36852.sksl")
1152SKSL_TEST(CPU | GPU, kApiLevel_T, OutParams, "shared/OutParams.sksl")
1153SKSL_TEST(CPU | GPU, kApiLevel_T, OutParamsAreDistinct, "shared/OutParamsAreDistinct.sksl")
1154SKSL_TEST(CPU | GPU, kApiLevel_U, OutParamsAreDistinctFromGlobal, "shared/OutParamsAreDistinctFromGlobal.sksl")
1155SKSL_TEST(ES3 | GPU_ES3, kNever, OutParamsFunctionCallInArgument, "shared/OutParamsFunctionCallInArgument.sksl")
1156SKSL_TEST(CPU | GPU, kApiLevel_T, OutParamsDoubleSwizzle, "shared/OutParamsDoubleSwizzle.sksl")
1157SKSL_TEST(CPU | GPU, kNextRelease,PostfixExpressions, "shared/PostfixExpressions.sksl")
1158SKSL_TEST(CPU | GPU, kNextRelease,PrefixExpressionsES2, "shared/PrefixExpressionsES2.sksl")
1159SKSL_TEST(ES3 | GPU_ES3, kNever, PrefixExpressionsES3, "shared/PrefixExpressionsES3.sksl")
1160SKSL_TEST(CPU | GPU, kApiLevel_T, ResizeMatrix, "shared/ResizeMatrix.sksl")
1161SKSL_TEST(ES3 | GPU_ES3, kNever, ResizeMatrixNonsquare, "shared/ResizeMatrixNonsquare.sksl")
1162SKSL_TEST(CPU | GPU, kApiLevel_T, ReturnsValueOnEveryPathES2, "shared/ReturnsValueOnEveryPathES2.sksl")
1163SKSL_TEST(ES3 | GPU_ES3, kNever, ReturnsValueOnEveryPathES3, "shared/ReturnsValueOnEveryPathES3.sksl")
1164SKSL_TEST(CPU | GPU, kApiLevel_T, ScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
1165SKSL_TEST(ES3 | GPU_ES3, kNever, ScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
1166SKSL_TEST(CPU | GPU, kApiLevel_T, ScopedSymbol, "shared/ScopedSymbol.sksl")
1167SKSL_TEST(CPU | GPU, kApiLevel_T, StackingVectorCasts, "shared/StackingVectorCasts.sksl")
1168SKSL_TEST(CPU | GPU_ES3, kNever, StaticSwitch, "shared/StaticSwitch.sksl")
1169SKSL_TEST(CPU | GPU, kApiLevel_T, StructArrayFollowedByScalar, "shared/StructArrayFollowedByScalar.sksl")
1170SKSL_TEST(CPU | GPU, kNextRelease,StructIndexLookup, "shared/StructIndexLookup.sksl")
1171SKSL_TEST(CPU | GPU, kNextRelease,StructIndexStore, "shared/StructIndexStore.sksl")
1172// TODO(skia:13920): StructComparison currently exposes a bug in SPIR-V codegen.
1173SKSL_TEST(ES3, kNextRelease,StructComparison, "shared/StructComparison.sksl")
1174SKSL_TEST(CPU | GPU, kApiLevel_T, StructsInFunctions, "shared/StructsInFunctions.sksl")
1175SKSL_TEST(CPU | GPU, kApiLevel_T, Switch, "shared/Switch.sksl")
1176SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchDefaultOnly, "shared/SwitchDefaultOnly.sksl")
1177SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchWithFallthrough, "shared/SwitchWithFallthrough.sksl")
1178SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchWithFallthroughAndVarDecls,"shared/SwitchWithFallthroughAndVarDecls.sksl")
1179SKSL_TEST(CPU | GPU, kApiLevel_T, SwitchWithLoops, "shared/SwitchWithLoops.sksl")
1180SKSL_TEST(ES3 | GPU_ES3, kNever, SwitchWithLoopsES3, "shared/SwitchWithLoopsES3.sksl")
1181SKSL_TEST(CPU | GPU, kNever, SwizzleAsLValue, "shared/SwizzleAsLValue.sksl")
1182SKSL_TEST(ES3 | GPU_ES3, kNever, SwizzleAsLValueES3, "shared/SwizzleAsLValueES3.sksl")
1183SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleBoolConstants, "shared/SwizzleBoolConstants.sksl")
1184SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleByConstantIndex, "shared/SwizzleByConstantIndex.sksl")
1185SKSL_TEST(ES3 | GPU_ES3, kNever, SwizzleByIndex, "shared/SwizzleByIndex.sksl")
1186SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleConstants, "shared/SwizzleConstants.sksl")
1187SKSL_TEST(CPU | GPU, kNextRelease,SwizzleIndexLookup, "shared/SwizzleIndexLookup.sksl")
1188SKSL_TEST(CPU | GPU, kNextRelease,SwizzleIndexStore, "shared/SwizzleIndexStore.sksl")
1189SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleLTRB, "shared/SwizzleLTRB.sksl")
1190SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleOpt, "shared/SwizzleOpt.sksl")
1191SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleScalar, "shared/SwizzleScalar.sksl")
1192SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleScalarBool, "shared/SwizzleScalarBool.sksl")
1193SKSL_TEST(CPU | GPU, kApiLevel_T, SwizzleScalarInt, "shared/SwizzleScalarInt.sksl")
1194SKSL_TEST(CPU | GPU, kNextRelease,TemporaryIndexLookup, "shared/TemporaryIndexLookup.sksl")
1195SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
1196SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryAsLValueFoldableTest, "shared/TernaryAsLValueFoldableTest.sksl")
1197SKSL_TEST(CPU | GPU, kNextRelease,TernaryComplexNesting, "shared/TernaryComplexNesting.sksl")
1198SKSL_TEST(CPU | GPU, kApiLevel_T, TernaryExpression, "shared/TernaryExpression.sksl")
1199SKSL_TEST(CPU | GPU, kNextRelease,TernaryNesting, "shared/TernaryNesting.sksl")
1200SKSL_TEST(CPU | GPU, kNextRelease,TernaryOneZeroOptimization, "shared/TernaryOneZeroOptimization.sksl")
1201SKSL_TEST(CPU | GPU, kApiLevel_U, TernarySideEffects, "shared/TernarySideEffects.sksl")
1202SKSL_TEST(CPU | GPU, kApiLevel_T, UnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
1203SKSL_TEST(CPU | GPU, kApiLevel_T, UniformArray, "shared/UniformArray.sksl")
1204SKSL_TEST(CPU | GPU, kApiLevel_U, UniformMatrixResize, "shared/UniformMatrixResize.sksl")
1205SKSL_TEST(CPU | GPU, kApiLevel_T, UnusedVariables, "shared/UnusedVariables.sksl")
1206SKSL_TEST(CPU | GPU, kApiLevel_T, VectorConstructors, "shared/VectorConstructors.sksl")
1207SKSL_TEST(CPU | GPU, kApiLevel_T, VectorToMatrixCast, "shared/VectorToMatrixCast.sksl")
1208SKSL_TEST(CPU | GPU, kApiLevel_T, VectorScalarMath, "shared/VectorScalarMath.sksl")
1209SKSL_TEST(ES3 | GPU_ES3, kNever, WhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
1210
1211SKSL_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)
SkColor4f color
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,...)
static constexpr float kUniformTestMatrix3x3[]
Definition SkSLTest.cpp:138
constexpr auto kApiLevel_T
Definition SkSLTest.cpp:955
static void test_clone(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:735
constexpr auto kNever
Definition SkSLTest.cpp:958
#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:959
constexpr SkSLTestFlags CPU
Definition SkSLTest.cpp:950
static void test_cpu(skiatest::Reporter *r, const char *name, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:632
#define SKSL_TEST(flags, ctsEnforcement, name, path)
Definition SkSLTest.cpp:929
constexpr auto kApiLevel_V
Definition SkSLTest.cpp:957
static void test_raster_pipeline(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:790
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:775
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:951
constexpr SkSLTestFlags UsesNaN
Definition SkSLTest.cpp:954
constexpr SkSLTestFlags GPU
Definition SkSLTest.cpp:952
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:781
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:614
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:542
static constexpr int kHeight
Definition SkSLTest.cpp:85
constexpr auto kApiLevel_U
Definition SkSLTest.cpp:956
constexpr SkSLTestFlags GPU_ES3
Definition SkSLTest.cpp:953
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
SK_API SkString static SkString SkStringPrintf()
Definition SkString.h:287
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
const GrCaps * caps() const
const GrShaderCaps * shaderCaps() const
Definition GrCaps.h:63
GrDirectContextPriv priv()
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:74
const Caps * caps() const
Definition ContextPriv.h:32
BackendApi backend() const
Definition Context.cpp:128
std::unique_ptr< Recorder > makeRecorder(const RecorderOptions &={})
Definition Context.cpp:130
T * push_back_n(int n)
Definition SkTArray.h:262
virtual skgpu::ContextType contextType()=0
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
VkSurfaceKHR surface
Definition main.cc:49
FlutterSemanticsFlag flags
GAsyncResult * result
const char * name
Definition fuchsia.cc:50
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 main.py:1
bool IsDawnBackend(skgpu::ContextType type)
bool IsNativeBackend(skgpu::ContextType type)
const char * ContextTypeName(skgpu::ContextType type)
constexpr bool contains(std::string_view str, std::string_view needle)
Point 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