• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
8 #include "include/core/SkBitmap.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkColor.h"
11 #include "include/core/SkData.h"
12 #include "include/core/SkImageInfo.h"
13 #include "include/core/SkPaint.h"
14 #include "include/core/SkRect.h"
15 #include "include/core/SkRefCnt.h"
16 #include "include/core/SkShader.h"
17 #include "include/core/SkSpan.h"
18 #include "include/core/SkString.h"
19 #include "include/core/SkSurface.h"
20 #include "include/core/SkTypes.h"
21 #include "include/effects/SkRuntimeEffect.h"
22 #include "include/gpu/GpuTypes.h"
23 #include "include/gpu/GrDirectContext.h"
24 #include "include/gpu/ganesh/SkSurfaceGanesh.h"
25 #include "include/private/base/SkTArray.h"
26 #include "include/sksl/SkSLVersion.h"
27 #include "src/base/SkArenaAlloc.h"
28 #include "src/base/SkEnumBitMask.h"
29 #include "src/base/SkStringView.h"
30 #include "src/core/SkRasterPipeline.h"
31 #include "src/core/SkRasterPipelineOpContexts.h"
32 #include "src/core/SkRasterPipelineOpList.h"
33 #include "src/core/SkRuntimeEffectPriv.h"
34 #include "src/gpu/ganesh/GrCaps.h"
35 #include "src/gpu/ganesh/GrDirectContextPriv.h"
36 #include "src/gpu/ganesh/GrShaderCaps.h"
37 #include "src/sksl/SkSLCompiler.h"
38 #include "src/sksl/SkSLProgramKind.h"
39 #include "src/sksl/SkSLProgramSettings.h"
40 #include "src/sksl/SkSLUtil.h"
41 #include "src/sksl/analysis/SkSLProgramVisitor.h"
42 #include "src/sksl/codegen/SkSLRasterPipelineBuilder.h"
43 #include "src/sksl/codegen/SkSLRasterPipelineCodeGenerator.h"
44 #include "src/sksl/ir/SkSLFunctionDeclaration.h"
45 #include "src/sksl/ir/SkSLModifierFlags.h"
46 #include "src/sksl/ir/SkSLProgram.h"
47 #include "src/sksl/ir/SkSLProgramElement.h"
48 #include "src/sksl/ir/SkSLStatement.h"
49 #include "src/sksl/ir/SkSLType.h"
50 #include "src/sksl/ir/SkSLVarDeclarations.h"
51 #include "src/sksl/ir/SkSLVariable.h"
52 #include "src/sksl/tracing/SkSLDebugTracePriv.h"
53 #include "tests/CtsEnforcement.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)
67 #include "include/gpu/graphite/Context.h"
68 #include "include/gpu/graphite/ContextOptions.h"
69 #include "include/gpu/graphite/Recorder.h"
70 #include "include/gpu/graphite/Surface.h"
71 #include "src/gpu/graphite/Caps.h"
72 #include "src/gpu/graphite/ContextPriv.h"
73 #include "tools/graphite/GraphiteTestContext.h"
74 #if defined(SK_DAWN)
75 #include "src/gpu/graphite/dawn/DawnCaps.h"
76 #endif
77 #endif
78 
79 using namespace skia_private;
80 
81 namespace SkSL { class Context; }
82 struct GrContextOptions;
83 
84 static constexpr int kWidth = 2;
85 static constexpr int kHeight = 2;
86 
87 enum 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 
110 using SkSLTestFlags = SkEnumBitMask<SkSLTestFlag>;
111 
is_cpu(SkSLTestFlags flags)112 static constexpr bool is_cpu(SkSLTestFlags flags) {
113     return SkToBool(flags & SkSLTestFlag::CPU);
114 }
115 
is_gpu(SkSLTestFlags flags)116 static constexpr bool is_gpu(SkSLTestFlags flags) {
117     return (flags & SkSLTestFlag::GPU) || (flags & SkSLTestFlag::GPU_ES3);
118 }
119 
is_strict_es2(SkSLTestFlags flags)120 static constexpr bool is_strict_es2(SkSLTestFlags flags) {
121     return !(flags & SkSLTestFlag::GPU_ES3) && !(flags & SkSLTestFlag::ES3);
122 }
123 
124 struct UniformData {
125     std::string_view    name;
126     SkSpan<const float> span;
127 };
128 
129 static constexpr float kUniformColorBlack[]    = {0.0f, 0.0f, 0.0f, 1.0f};
130 static constexpr float kUniformColorRed  []    = {1.0f, 0.0f, 0.0f, 1.0f};
131 static constexpr float kUniformColorGreen[]    = {0.0f, 1.0f, 0.0f, 1.0f};
132 static constexpr float kUniformColorBlue []    = {0.0f, 0.0f, 1.0f, 1.0f};
133 static constexpr float kUniformColorWhite[]    = {1.0f, 1.0f, 1.0f, 1.0f};
134 static constexpr float kUniformTestInputs[]    = {-1.25f, 0.0f, 0.75f, 2.25f};
135 static constexpr float kUniformUnknownInput[]  = {1.0f};
136 static constexpr float kUniformTestMatrix2x2[] = {1.0f, 2.0f,
137                                                   3.0f, 4.0f};
138 static constexpr float kUniformTestMatrix3x3[] = {1.0f, 2.0f, 3.0f,
139                                                   4.0f, 5.0f, 6.0f,
140                                                   7.0f, 8.0f, 9.0f};
141 static 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};
145 static constexpr float kUniformTestArray[] = {1, 2, 3, 4, 5};
146 static constexpr float kUniformTestArrayNegative[] = {-1, -2, -3, -4, -5};
147 
148 static 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 
bitmap_from_shader(skiatest::Reporter * r,SkSurface * surface,sk_sp<SkRuntimeEffect> effect)163 static SkBitmap bitmap_from_shader(skiatest::Reporter* r,
164                                    SkSurface* surface,
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 
186     SkBitmap bitmap;
187     REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
188     REPORTER_ASSERT(r, surface->readPixels(bitmap, /*srcX=*/0, /*srcY=*/0));
189     return bitmap;
190 }
191 
gpu_generates_nan(skiatest::Reporter * r,GrDirectContext * ctx)192 static bool gpu_generates_nan(skiatest::Reporter* r, GrDirectContext* ctx) {
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 
204     auto effect = SkRuntimeEffect::MakeForShader(SkString(R"(
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 
214     const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
215     sk_sp<SkSurface> surface(SkSurfaces::RenderTarget(ctx, skgpu::Budgeted::kNo, info));
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);
221     REPORTER_ASSERT(r, color == SK_ColorGREEN || color == SK_ColorRED);
222     return color == SK_ColorGREEN;
223 #endif
224 }
225 
load_source(skiatest::Reporter * r,const char * testFile,const char * permutationSuffix)226 static SkString load_source(skiatest::Reporter* r,
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 
failure_is_expected(std::string_view deviceName,std::string_view backendAPI,std::string_view name,skiatest::TestType testType)238 static 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 
251     using TestDisableMap = THashMap<std::string_view, std::vector<TestDisable>>;
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 
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)547 static void test_one_permutation(skiatest::Reporter* r,
548                                  std::string_view deviceName,
549                                  std::string_view backendAPI,
550                                  SkSurface* surface,
551                                  const char* name,
552                                  const char* testFile,
553                                  skiatest::TestType testType,
554                                  const char* permutationSuffix,
555                                  const SkRuntimeEffect::Options& options) {
556     SkString shaderString = load_source(r, testFile, permutationSuffix);
557     if (shaderString.isEmpty()) {
558         return;
559     }
560     SkRuntimeEffect::Result result = SkRuntimeEffect::MakeForShader(shaderString, options);
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 
573     SkBitmap bitmap = bitmap_from_shader(r, surface, result.effect);
574     if (bitmap.empty()) {
575         ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
576         return;
577     }
578 
579     bool success = true;
580     SkColor color[kHeight][kWidth];
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 
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)619 static void test_permutations(skiatest::Reporter* r,
620                               std::string_view deviceName,
621                               std::string_view backendAPI,
622                               SkSurface* surface,
623                               const char* name,
624                               const char* testFile,
625                               skiatest::TestType testType,
626                               bool strictES2) {
627     SkRuntimeEffect::Options options = strictES2 ? SkRuntimeEffect::Options{}
628                                                  : SkRuntimeEffectPriv::ES3Options();
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 
test_cpu(skiatest::Reporter * r,const char * name,const char * testFile,SkSLTestFlags flags)637 static void test_cpu(skiatest::Reporter* r,
638                      const char* name,
639                      const char* testFile,
640                      SkSLTestFlags flags) {
641     SkASSERT(flags & SkSLTestFlag::CPU);
642 
643     // Create a raster-backed surface.
644     const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
645     sk_sp<SkSurface> surface(SkSurfaces::Raster(info));
646 
647     test_permutations(r, "CPU", "SkRP", surface.get(), name, testFile,
648                       skiatest::TestType::kCPU, /*strictES2=*/true);
649 }
650 
651 #if defined(SK_GANESH)
test_ganesh(skiatest::Reporter * r,const sk_gpu_test::ContextInfo & ctxInfo,const char * name,const char * testFile,SkSLTestFlags flags)652 static void test_ganesh(skiatest::Reporter* r,
653                         const sk_gpu_test::ContextInfo& ctxInfo,
654                         const char* name,
655                         const char* testFile,
656                         SkSLTestFlags flags) {
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 =
662             (flags & SkSLTestFlag::GPU_ES3) &&
663             (ctx->priv().caps()->shaderCaps()->supportedSkSLVerion() >= SkSL::Version::k300);
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.
669     if (flags & SkSLTestFlag::UsesNaN) {
670         if (!gpu_generates_nan(r, ctx)) {
671             return;
672         }
673     }
674 
675     // Create a GPU-backed Ganesh surface.
676     const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
677     sk_sp<SkSurface> surface(SkSurfaces::RenderTarget(ctx, skgpu::Budgeted::kNo, info));
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.
test_graphite(skiatest::Reporter * r,skgpu::graphite::Context * ctx,skiatest::graphite::GraphiteTestContext * testCtx,const char * name,const char * testFile,SkSLTestFlags flags)694 static void test_graphite(skiatest::Reporter* r,
695                           skgpu::graphite::Context* ctx,
696                           skiatest::graphite::GraphiteTestContext* testCtx,
697                           const char* name,
698                           const char* testFile,
699                           SkSLTestFlags flags) {
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 =
703             (flags & SkSLTestFlag::GPU_ES3) &&
704             (ctx->priv().caps()->shaderCaps()->supportedSkSLVerion() >= SkSL::Version::k300);
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.)
713         if (flags & SkSLTestFlag::UsesNaN) {
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 
722     const SkImageInfo info = SkImageInfo::Make({kWidth, kHeight},
723                                                 kRGBA_8888_SkColorType,
724                                                 kPremul_SkAlphaType);
725     sk_sp<SkSurface> surface = SkSurfaces::RenderTarget(recorder.get(), info);
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 
test_clone(skiatest::Reporter * r,const char * testFile,SkSLTestFlags flags)740 static 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     }
745     SkSL::ProgramSettings settings;
746     // TODO(skia:11209): Can we just put the correct #version in the source files that need this?
747     settings.fMaxVersionAllowed = is_strict_es2(flags) ? SkSL::Version::k100 : SkSL::Version::k300;
748     SkSL::Compiler compiler;
749     std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
750             SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
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 
report_rp_pass(skiatest::Reporter * r,const char * testFile,SkSLTestFlags flags)780 static void report_rp_pass(skiatest::Reporter* r, const char* testFile, SkSLTestFlags flags) {
781     if (!(flags & SkSLTestFlag::CPU) && !(flags & SkSLTestFlag::ES3)) {
782         ERRORF(r, "NEW: %s", testFile);
783     }
784 }
785 
report_rp_fail(skiatest::Reporter * r,const char * testFile,SkSLTestFlags flags,const char * reason)786 static void report_rp_fail(skiatest::Reporter* r,
787                            const char* testFile,
788                            SkSLTestFlags flags,
789                            const char* reason) {
790     if ((flags & SkSLTestFlag::CPU) || (flags & SkSLTestFlag::ES3)) {
791         ERRORF(r, "%s: %s", testFile, reason);
792     }
793 }
794 
test_raster_pipeline(skiatest::Reporter * r,const char * testFile,SkSLTestFlags flags)795 static void test_raster_pipeline(skiatest::Reporter* r,
796                                  const char* testFile,
797                                  SkSLTestFlags flags) {
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.
805     SkSL::Compiler compiler;
806     SkSL::ProgramSettings settings;
807     settings.fMaxVersionAllowed = SkSL::Version::k300;
808     std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
809             SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
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;
823     TArray<SkRuntimeEffect::Uniform> uniforms;
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>()) {
829             const SkSL::GlobalVarDeclaration& global = elem->as<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()) {
839                 uniforms.push_back(SkRuntimeEffectPriv::VarAsUniform(var, ctx, &offset));
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 =
866             SkSL::MakeRasterPipelineProgram(*program,
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.
875     pipeline.appendConstantColor(&alloc, SkColors::kTransparent);
876     rasterProg->appendStages(&pipeline, &alloc, /*callbacks=*/nullptr, SkSpan(uniformValues));
877 
878     // Move the float values from RGBA into an 8888 memory buffer.
879     uint32_t out[SkRasterPipeline_kMaxStride_highp] = {};
880     SkRasterPipeline_MemoryCtx outCtx{/*pixels=*/out, /*stride=*/SkRasterPipeline_kMaxStride_highp};
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)
is_native_context_or_dawn(skgpu::ContextType type)915 static bool is_native_context_or_dawn(skgpu::ContextType type) {
916     return skgpu::IsNativeBackend(type) || skgpu::IsDawnBackend(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 
955 constexpr SkSLTestFlags CPU = SkSLTestFlag::CPU;
956 constexpr SkSLTestFlags ES3 = SkSLTestFlag::ES3;
957 constexpr SkSLTestFlags GPU = SkSLTestFlag::GPU;
958 constexpr SkSLTestFlags GPU_ES3 = SkSLTestFlag::GPU_ES3;
959 constexpr SkSLTestFlags UsesNaN = SkSLTestFlag::UsesNaN;
960 constexpr auto kApiLevel_T = CtsEnforcement::kApiLevel_T;
961 constexpr auto kApiLevel_U = CtsEnforcement::kApiLevel_U;
962 [[maybe_unused]] constexpr auto kApiLevel_V = CtsEnforcement::kApiLevel_V;
963 constexpr auto kNever = CtsEnforcement::kNever;
964 [[maybe_unused]] constexpr auto kNextRelease = CtsEnforcement::kNextRelease;
965 
966 SKSL_TEST(ES3 | GPU_ES3, kApiLevel_T, ArrayFolding,                    "folding/ArrayFolding.sksl")
967 SKSL_TEST(CPU | GPU,     kApiLevel_T, ArraySizeFolding,                "folding/ArraySizeFolding.rts")
968 SKSL_TEST(CPU | GPU,     kApiLevel_T, AssignmentOps,                   "folding/AssignmentOps.rts")
969 SKSL_TEST(CPU | GPU,     kApiLevel_T, BoolFolding,                     "folding/BoolFolding.rts")
970 SKSL_TEST(CPU | GPU,     kApiLevel_T, CastFolding,                     "folding/CastFolding.rts")
971 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntFoldingES2,                   "folding/IntFoldingES2.rts")
972 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntFoldingES3,                   "folding/IntFoldingES3.sksl")
973 SKSL_TEST(CPU | GPU,     kApiLevel_T, FloatFolding,                    "folding/FloatFolding.rts")
974 SKSL_TEST(CPU | GPU,     kNextRelease,LogicalNot,                      "folding/LogicalNot.rts")
975 SKSL_TEST(CPU | GPU,     kApiLevel_T, MatrixFoldingES2,                "folding/MatrixFoldingES2.rts")
976 SKSL_TEST(ES3 | GPU_ES3, kNever,      MatrixFoldingES3,                "folding/MatrixFoldingES3.sksl")
977 SKSL_TEST(CPU | GPU,     kApiLevel_U, MatrixNoOpFolding,               "folding/MatrixNoOpFolding.rts")
978 SKSL_TEST(CPU | GPU,     kApiLevel_U, MatrixScalarNoOpFolding,         "folding/MatrixScalarNoOpFolding.rts")
979 SKSL_TEST(CPU | GPU,     kApiLevel_U, MatrixVectorNoOpFolding,         "folding/MatrixVectorNoOpFolding.rts")
980 SKSL_TEST(CPU | GPU,     kApiLevel_T, Negation,                        "folding/Negation.rts")
981 SKSL_TEST(CPU | GPU,     kApiLevel_T, PreserveSideEffects,             "folding/PreserveSideEffects.rts")
982 SKSL_TEST(CPU | GPU,     kApiLevel_T, SelfAssignment,                  "folding/SelfAssignment.rts")
983 SKSL_TEST(CPU | GPU,     kApiLevel_T, ShortCircuitBoolFolding,         "folding/ShortCircuitBoolFolding.rts")
984 SKSL_TEST(CPU | GPU,     kApiLevel_U, StructFieldFolding,              "folding/StructFieldFolding.rts")
985 SKSL_TEST(CPU | GPU,     kApiLevel_U, StructFieldNoFolding,            "folding/StructFieldNoFolding.rts")
986 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwitchCaseFolding,               "folding/SwitchCaseFolding.rts")
987 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleFolding,                  "folding/SwizzleFolding.rts")
988 SKSL_TEST(CPU | GPU,     kApiLevel_U, TernaryFolding,                  "folding/TernaryFolding.rts")
989 SKSL_TEST(CPU | GPU,     kApiLevel_T, VectorScalarFolding,             "folding/VectorScalarFolding.rts")
990 SKSL_TEST(CPU | GPU,     kApiLevel_T, VectorVectorFolding,             "folding/VectorVectorFolding.rts")
991 
992 SKSL_TEST(CPU | GPU,     kNextRelease,CommaExpressionsAllowInlining,                    "inliner/CommaExpressionsAllowInlining.sksl")
993 SKSL_TEST(ES3 | GPU_ES3, kNever,      DoWhileBodyMustBeInlinedIntoAScope,               "inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
994 SKSL_TEST(ES3 | GPU_ES3, kNever,      DoWhileTestCannotBeInlined,                       "inliner/DoWhileTestCannotBeInlined.sksl")
995 SKSL_TEST(CPU | GPU,     kApiLevel_T, ForBodyMustBeInlinedIntoAScope,                   "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
996 SKSL_TEST(ES3 | GPU_ES3, kNever,      ForInitializerExpressionsCanBeInlined,            "inliner/ForInitializerExpressionsCanBeInlined.sksl")
997 SKSL_TEST(CPU | GPU,     kApiLevel_T, ForWithoutReturnInsideCanBeInlined,               "inliner/ForWithoutReturnInsideCanBeInlined.sksl")
998 SKSL_TEST(CPU | GPU,     kApiLevel_T, ForWithReturnInsideCannotBeInlined,               "inliner/ForWithReturnInsideCannotBeInlined.sksl")
999 SKSL_TEST(CPU | GPU,     kApiLevel_T, IfBodyMustBeInlinedIntoAScope,                    "inliner/IfBodyMustBeInlinedIntoAScope.sksl")
1000 SKSL_TEST(CPU | GPU,     kApiLevel_T, IfElseBodyMustBeInlinedIntoAScope,                "inliner/IfElseBodyMustBeInlinedIntoAScope.sksl")
1001 SKSL_TEST(CPU | GPU,     kApiLevel_T, IfElseChainWithReturnsCanBeInlined,               "inliner/IfElseChainWithReturnsCanBeInlined.sksl")
1002 SKSL_TEST(CPU | GPU,     kApiLevel_T, IfTestCanBeInlined,                               "inliner/IfTestCanBeInlined.sksl")
1003 SKSL_TEST(CPU | GPU,     kApiLevel_T, IfWithReturnsCanBeInlined,                        "inliner/IfWithReturnsCanBeInlined.sksl")
1004 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlineKeywordOverridesThreshold,                  "inliner/InlineKeywordOverridesThreshold.sksl")
1005 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlinerAvoidsVariableNameOverlap,                 "inliner/InlinerAvoidsVariableNameOverlap.sksl")
1006 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlinerElidesTempVarForReturnsInsideBlock,        "inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl")
1007 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlinerUsesTempVarForMultipleReturns,             "inliner/InlinerUsesTempVarForMultipleReturns.sksl")
1008 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlinerUsesTempVarForReturnsInsideBlockWithVar,   "inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl")
1009 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlineThreshold,                                  "inliner/InlineThreshold.sksl")
1010 SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, InlineUnscopedVariable,                           "inliner/InlineUnscopedVariable.sksl")
1011 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlineWithModifiedArgument,                       "inliner/InlineWithModifiedArgument.sksl")
1012 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlineWithNestedBigCalls,                         "inliner/InlineWithNestedBigCalls.sksl")
1013 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlineWithUnmodifiedArgument,                     "inliner/InlineWithUnmodifiedArgument.sksl")
1014 SKSL_TEST(CPU | GPU,     kApiLevel_T, InlineWithUnnecessaryBlocks,                      "inliner/InlineWithUnnecessaryBlocks.sksl")
1015 SKSL_TEST(CPU | GPU,     kNextRelease,IntrinsicNameCollision,                           "inliner/IntrinsicNameCollision.sksl")
1016 SKSL_TEST(CPU | GPU,     kNextRelease,ModifiedArrayParametersCannotBeInlined,           "inliner/ModifiedArrayParametersCannotBeInlined.sksl")
1017 SKSL_TEST(CPU | GPU,     kNextRelease,ModifiedStructParametersCannotBeInlined,          "inliner/ModifiedStructParametersCannotBeInlined.sksl")
1018 SKSL_TEST(CPU | GPU,     kApiLevel_T, NoInline,                                         "inliner/NoInline.sksl")
1019 SKSL_TEST(CPU | GPU,     kApiLevel_T, ShortCircuitEvaluationsCannotInlineRightHandSide, "inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl")
1020 SKSL_TEST(ES3 | GPU_ES3, kNever,      StaticSwitchInline,                               "inliner/StaticSwitch.sksl")
1021 SKSL_TEST(CPU | GPU,     kApiLevel_T, StructsCanBeInlinedSafely,                        "inliner/StructsCanBeInlinedSafely.sksl")
1022 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleCanBeInlinedDirectly,                      "inliner/SwizzleCanBeInlinedDirectly.sksl")
1023 SKSL_TEST(CPU | GPU,     kApiLevel_T, TernaryResultsCannotBeInlined,                    "inliner/TernaryResultsCannotBeInlined.sksl")
1024 SKSL_TEST(CPU | GPU,     kApiLevel_T, TernaryTestCanBeInlined,                          "inliner/TernaryTestCanBeInlined.sksl")
1025 SKSL_TEST(CPU | GPU,     kApiLevel_T, TrivialArgumentsInlineDirectly,                   "inliner/TrivialArgumentsInlineDirectly.sksl")
1026 SKSL_TEST(ES3 | GPU_ES3, kNever,      TrivialArgumentsInlineDirectlyES3,                "inliner/TrivialArgumentsInlineDirectlyES3.sksl")
1027 SKSL_TEST(CPU | GPU,     kNextRelease,TypeShadowing,                                    "inliner/TypeShadowing.sksl")
1028 SKSL_TEST(ES3 | GPU_ES3, kNever,      WhileBodyMustBeInlinedIntoAScope,                 "inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
1029 SKSL_TEST(ES3 | GPU_ES3, kNever,      WhileTestCannotBeInlined,                         "inliner/WhileTestCannotBeInlined.sksl")
1030 
1031 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicAbsFloat,               "intrinsics/AbsFloat.sksl")
1032 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicAbsInt,                 "intrinsics/AbsInt.sksl")
1033 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicAny,                    "intrinsics/Any.sksl")
1034 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicAll,                    "intrinsics/All.sksl")
1035 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicCeil,                   "intrinsics/Ceil.sksl")
1036 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicClampInt,               "intrinsics/ClampInt.sksl")
1037 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicClampUInt,              "intrinsics/ClampUInt.sksl")
1038 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicClampFloat,             "intrinsics/ClampFloat.sksl")
1039 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicCross,                  "intrinsics/Cross.sksl")
1040 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicDegrees,                "intrinsics/Degrees.sksl")
1041 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicDeterminant,            "intrinsics/Determinant.sksl")
1042 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicDFdx,                   "intrinsics/DFdx.sksl")
1043 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicDFdy,                   "intrinsics/DFdy.sksl")
1044 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicDot,                    "intrinsics/Dot.sksl")
1045 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicFract,                  "intrinsics/Fract.sksl")
1046 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicFloatBitsToInt,         "intrinsics/FloatBitsToInt.sksl")
1047 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicFloatBitsToUint,        "intrinsics/FloatBitsToUint.sksl")
1048 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicFloor,                  "intrinsics/Floor.sksl")
1049 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicFwidth,                 "intrinsics/Fwidth.sksl")
1050 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicIntBitsToFloat,         "intrinsics/IntBitsToFloat.sksl")
1051 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicIsInf,                  "intrinsics/IsInf.sksl")
1052 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicLength,                 "intrinsics/Length.sksl")
1053 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicMatrixCompMultES2,      "intrinsics/MatrixCompMultES2.sksl")
1054 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicMatrixCompMultES3,      "intrinsics/MatrixCompMultES3.sksl")
1055 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicMaxFloat,               "intrinsics/MaxFloat.sksl")
1056 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicMaxInt,                 "intrinsics/MaxInt.sksl")
1057 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicMaxUint,                "intrinsics/MaxUint.sksl")
1058 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicMinFloat,               "intrinsics/MinFloat.sksl")
1059 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicMinInt,                 "intrinsics/MinInt.sksl")
1060 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicMinUint,                "intrinsics/MinUint.sksl")
1061 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicMixFloatES2,            "intrinsics/MixFloatES2.sksl")
1062 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicMixFloatES3,            "intrinsics/MixFloatES3.sksl")
1063 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicModf,                   "intrinsics/Modf.sksl")
1064 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicNot,                    "intrinsics/Not.sksl")
1065 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicOuterProduct,           "intrinsics/OuterProduct.sksl")
1066 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicRadians,                "intrinsics/Radians.sksl")
1067 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicRound,                  "intrinsics/Round.sksl")
1068 SKSL_TEST(GPU_ES3,       kNever,      IntrinsicRoundEven,              "intrinsics/RoundEven.sksl")
1069 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicSaturate,               "intrinsics/Saturate.sksl")
1070 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicSignFloat,              "intrinsics/SignFloat.sksl")
1071 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicSignInt,                "intrinsics/SignInt.sksl")
1072 SKSL_TEST(CPU | GPU,     kNever,      IntrinsicSqrt,                   "intrinsics/Sqrt.sksl")
1073 SKSL_TEST(CPU | GPU,     kApiLevel_T, IntrinsicStep,                   "intrinsics/Step.sksl")
1074 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicTrunc,                  "intrinsics/Trunc.sksl")
1075 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicTranspose,              "intrinsics/Transpose.sksl")
1076 SKSL_TEST(ES3 | GPU_ES3, kNever,      IntrinsicUintBitsToFloat,        "intrinsics/UintBitsToFloat.sksl")
1077 
1078 SKSL_TEST(ES3 | GPU_ES3, kNever,      ArrayNarrowingConversions,       "runtime/ArrayNarrowingConversions.rts")
1079 SKSL_TEST(ES3 | GPU_ES3, kNever,      Commutative,                     "runtime/Commutative.rts")
1080 SKSL_TEST(CPU,           kNever,      DivideByZero,                    "runtime/DivideByZero.rts")
1081 SKSL_TEST(CPU | GPU,     kNextRelease,FunctionParameterAliasingFirst,  "runtime/FunctionParameterAliasingFirst.rts")
1082 SKSL_TEST(CPU | GPU,     kNextRelease,FunctionParameterAliasingSecond, "runtime/FunctionParameterAliasingSecond.rts")
1083 SKSL_TEST(CPU | GPU,     kNextRelease,IfElseBinding,                   "runtime/IfElseBinding.rts")
1084 SKSL_TEST(CPU | GPU,     kNextRelease,IncrementDisambiguation,         "runtime/IncrementDisambiguation.rts")
1085 SKSL_TEST(CPU | GPU,     kApiLevel_T, LoopFloat,                       "runtime/LoopFloat.rts")
1086 SKSL_TEST(CPU | GPU,     kApiLevel_T, LoopInt,                         "runtime/LoopInt.rts")
1087 SKSL_TEST(CPU | GPU,     kApiLevel_U, Ossfuzz52603,                    "runtime/Ossfuzz52603.rts")
1088 SKSL_TEST(CPU | GPU,     kApiLevel_T, QualifierOrder,                  "runtime/QualifierOrder.rts")
1089 SKSL_TEST(CPU | GPU,     kApiLevel_T, PrecisionQualifiers,             "runtime/PrecisionQualifiers.rts")
1090 
1091 SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Arrays,  "runtime/RecursiveComparison_Arrays.rts")
1092 SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Structs, "runtime/RecursiveComparison_Structs.rts")
1093 SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Types,   "runtime/RecursiveComparison_Types.rts")
1094 SKSL_TEST(ES3 | GPU_ES3 | UsesNaN, kNever, RecursiveComparison_Vectors, "runtime/RecursiveComparison_Vectors.rts")
1095 
1096 SKSL_TEST(ES3 | GPU_ES3, kNever,      ArrayCast,                       "shared/ArrayCast.sksl")
1097 SKSL_TEST(ES3 | GPU_ES3, kNever,      ArrayComparison,                 "shared/ArrayComparison.sksl")
1098 SKSL_TEST(ES3 | GPU_ES3, kNever,      ArrayConstructors,               "shared/ArrayConstructors.sksl")
1099 SKSL_TEST(CPU | GPU,     kNextRelease,ArrayFollowedByScalar,           "shared/ArrayFollowedByScalar.sksl")
1100 SKSL_TEST(CPU | GPU,     kApiLevel_T, ArrayTypes,                      "shared/ArrayTypes.sksl")
1101 SKSL_TEST(CPU | GPU,     kApiLevel_T, Assignment,                      "shared/Assignment.sksl")
1102 SKSL_TEST(CPU | GPU,     kApiLevel_T, CastsRoundTowardZero,            "shared/CastsRoundTowardZero.sksl")
1103 SKSL_TEST(CPU | GPU,     kApiLevel_T, CommaMixedTypes,                 "shared/CommaMixedTypes.sksl")
1104 SKSL_TEST(CPU | GPU,     kApiLevel_T, CommaSideEffects,                "shared/CommaSideEffects.sksl")
1105 SKSL_TEST(CPU | GPU,     kApiLevel_U, CompileTimeConstantVariables,    "shared/CompileTimeConstantVariables.sksl")
1106 SKSL_TEST(ES3 | GPU_ES3, kNever,      ConstantCompositeAccessViaConstantIndex, "shared/ConstantCompositeAccessViaConstantIndex.sksl")
1107 SKSL_TEST(ES3 | GPU_ES3, kNever,      ConstantCompositeAccessViaDynamicIndex,  "shared/ConstantCompositeAccessViaDynamicIndex.sksl")
1108 SKSL_TEST(CPU | GPU,     kApiLevel_T, ConstantIf,                      "shared/ConstantIf.sksl")
1109 SKSL_TEST(ES3 | GPU_ES3, kNever,      ConstArray,                      "shared/ConstArray.sksl")
1110 SKSL_TEST(CPU | GPU,     kApiLevel_T, ConstVariableComparison,         "shared/ConstVariableComparison.sksl")
1111 SKSL_TEST(CPU | GPU,     kNever,      DeadGlobals,                     "shared/DeadGlobals.sksl")
1112 SKSL_TEST(ES3 | GPU_ES3, kNever,      DeadLoopVariable,                "shared/DeadLoopVariable.sksl")
1113 SKSL_TEST(CPU | GPU,     kApiLevel_T, DeadIfStatement,                 "shared/DeadIfStatement.sksl")
1114 SKSL_TEST(CPU | GPU,     kApiLevel_T, DeadReturn,                      "shared/DeadReturn.sksl")
1115 SKSL_TEST(ES3 | GPU_ES3, kNever,      DeadReturnES3,                   "shared/DeadReturnES3.sksl")
1116 SKSL_TEST(CPU | GPU,     kApiLevel_T, DeadStripFunctions,              "shared/DeadStripFunctions.sksl")
1117 SKSL_TEST(CPU | GPU,     kApiLevel_T, DependentInitializers,           "shared/DependentInitializers.sksl")
1118 SKSL_TEST(CPU | GPU,     kApiLevel_U, DoubleNegation,                  "shared/DoubleNegation.sksl")
1119 SKSL_TEST(ES3 | GPU_ES3, kNever,      DoWhileControlFlow,              "shared/DoWhileControlFlow.sksl")
1120 SKSL_TEST(CPU | GPU,     kApiLevel_T, EmptyBlocksES2,                  "shared/EmptyBlocksES2.sksl")
1121 SKSL_TEST(ES3 | GPU_ES3, kNever,      EmptyBlocksES3,                  "shared/EmptyBlocksES3.sksl")
1122 SKSL_TEST(CPU | GPU,     kApiLevel_T, ForLoopControlFlow,              "shared/ForLoopControlFlow.sksl")
1123 SKSL_TEST(ES3 | GPU_ES3, kNever,      ForLoopMultipleInitES3,          "shared/ForLoopMultipleInitES3.sksl")
1124 SKSL_TEST(CPU | GPU,     kNextRelease,ForLoopShadowing,                "shared/ForLoopShadowing.sksl")
1125 SKSL_TEST(CPU | GPU,     kApiLevel_T, FunctionAnonymousParameters,     "shared/FunctionAnonymousParameters.sksl")
1126 SKSL_TEST(CPU | GPU,     kApiLevel_T, FunctionArgTypeMatch,            "shared/FunctionArgTypeMatch.sksl")
1127 SKSL_TEST(CPU | GPU,     kApiLevel_T, FunctionReturnTypeMatch,         "shared/FunctionReturnTypeMatch.sksl")
1128 SKSL_TEST(CPU | GPU,     kApiLevel_T, Functions,                       "shared/Functions.sksl")
1129 SKSL_TEST(CPU | GPU,     kApiLevel_T, FunctionPrototype,               "shared/FunctionPrototype.sksl")
1130 SKSL_TEST(CPU | GPU,     kApiLevel_T, GeometricIntrinsics,             "shared/GeometricIntrinsics.sksl")
1131 SKSL_TEST(CPU | GPU,     kApiLevel_T, HelloWorld,                      "shared/HelloWorld.sksl")
1132 SKSL_TEST(CPU | GPU,     kApiLevel_T, Hex,                             "shared/Hex.sksl")
1133 SKSL_TEST(ES3 | GPU_ES3, kNever,      HexUnsigned,                     "shared/HexUnsigned.sksl")
1134 SKSL_TEST(CPU | GPU,     kNextRelease,IfStatement,                     "shared/IfStatement.sksl")
1135 SKSL_TEST(CPU | GPU,     kApiLevel_T, InoutParameters,                 "shared/InoutParameters.sksl")
1136 SKSL_TEST(CPU | GPU,     kApiLevel_U, InoutParamsAreDistinct,          "shared/InoutParamsAreDistinct.sksl")
1137 SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, IntegerDivisionES3,              "shared/IntegerDivisionES3.sksl")
1138 SKSL_TEST(CPU | GPU,     kApiLevel_U, LogicalAndShortCircuit,          "shared/LogicalAndShortCircuit.sksl")
1139 SKSL_TEST(CPU | GPU,     kApiLevel_U, LogicalOrShortCircuit,           "shared/LogicalOrShortCircuit.sksl")
1140 SKSL_TEST(CPU | GPU,     kApiLevel_T, Matrices,                        "shared/Matrices.sksl")
1141 SKSL_TEST(ES3 | GPU_ES3, kNever,      MatricesNonsquare,               "shared/MatricesNonsquare.sksl")
1142 SKSL_TEST(CPU | GPU,     kNever,      MatrixConstructorsES2,           "shared/MatrixConstructorsES2.sksl")
1143 SKSL_TEST(ES3 | GPU_ES3, kNever,      MatrixConstructorsES3,           "shared/MatrixConstructorsES3.sksl")
1144 SKSL_TEST(CPU | GPU,     kApiLevel_T, MatrixEquality,                  "shared/MatrixEquality.sksl")
1145 SKSL_TEST(CPU | GPU,     kNextRelease,MatrixIndexLookup,               "shared/MatrixIndexLookup.sksl")
1146 SKSL_TEST(CPU | GPU,     kNextRelease,MatrixIndexStore,                "shared/MatrixIndexStore.sksl")
1147 SKSL_TEST(CPU | GPU,     kApiLevel_U, MatrixOpEqualsES2,               "shared/MatrixOpEqualsES2.sksl")
1148 SKSL_TEST(ES3 | GPU_ES3, kApiLevel_U, MatrixOpEqualsES3,               "shared/MatrixOpEqualsES3.sksl")
1149 SKSL_TEST(CPU | GPU,     kApiLevel_T, MatrixScalarMath,                "shared/MatrixScalarMath.sksl")
1150 SKSL_TEST(CPU | GPU,     kNextRelease,MatrixSwizzleStore,              "shared/MatrixSwizzleStore.sksl")
1151 SKSL_TEST(CPU | GPU,     kApiLevel_T, MatrixToVectorCast,              "shared/MatrixToVectorCast.sksl")
1152 SKSL_TEST(CPU | GPU,     kApiLevel_T, MultipleAssignments,             "shared/MultipleAssignments.sksl")
1153 SKSL_TEST(CPU | GPU,     kApiLevel_T, NumberCasts,                     "shared/NumberCasts.sksl")
1154 SKSL_TEST(CPU | GPU,     kNextRelease,NestedComparisonIntrinsics,      "shared/NestedComparisonIntrinsics.sksl")
1155 SKSL_TEST(CPU | GPU,     kApiLevel_T, OperatorsES2,                    "shared/OperatorsES2.sksl")
1156 SKSL_TEST(GPU_ES3,       kNever,      OperatorsES3,                    "shared/OperatorsES3.sksl")
1157 SKSL_TEST(CPU | GPU,     kApiLevel_T, Ossfuzz36852,                    "shared/Ossfuzz36852.sksl")
1158 SKSL_TEST(CPU | GPU,     kApiLevel_T, OutParams,                       "shared/OutParams.sksl")
1159 SKSL_TEST(CPU | GPU,     kApiLevel_T, OutParamsAreDistinct,            "shared/OutParamsAreDistinct.sksl")
1160 SKSL_TEST(CPU | GPU,     kApiLevel_U, OutParamsAreDistinctFromGlobal,  "shared/OutParamsAreDistinctFromGlobal.sksl")
1161 SKSL_TEST(ES3 | GPU_ES3, kNever,      OutParamsFunctionCallInArgument, "shared/OutParamsFunctionCallInArgument.sksl")
1162 SKSL_TEST(CPU | GPU,     kApiLevel_T, OutParamsDoubleSwizzle,          "shared/OutParamsDoubleSwizzle.sksl")
1163 SKSL_TEST(CPU | GPU,     kNextRelease,PostfixExpressions,              "shared/PostfixExpressions.sksl")
1164 SKSL_TEST(CPU | GPU,     kNextRelease,PrefixExpressionsES2,            "shared/PrefixExpressionsES2.sksl")
1165 SKSL_TEST(ES3 | GPU_ES3, kNever,      PrefixExpressionsES3,            "shared/PrefixExpressionsES3.sksl")
1166 SKSL_TEST(CPU | GPU,     kApiLevel_T, ResizeMatrix,                    "shared/ResizeMatrix.sksl")
1167 SKSL_TEST(ES3 | GPU_ES3, kNever,      ResizeMatrixNonsquare,           "shared/ResizeMatrixNonsquare.sksl")
1168 SKSL_TEST(CPU | GPU,     kApiLevel_T, ReturnsValueOnEveryPathES2,      "shared/ReturnsValueOnEveryPathES2.sksl")
1169 SKSL_TEST(ES3 | GPU_ES3, kNever,      ReturnsValueOnEveryPathES3,      "shared/ReturnsValueOnEveryPathES3.sksl")
1170 SKSL_TEST(CPU | GPU,     kApiLevel_T, ScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
1171 SKSL_TEST(ES3 | GPU_ES3, kNever,      ScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
1172 SKSL_TEST(CPU | GPU,     kApiLevel_T, ScopedSymbol,                    "shared/ScopedSymbol.sksl")
1173 SKSL_TEST(CPU | GPU,     kApiLevel_T, StackingVectorCasts,             "shared/StackingVectorCasts.sksl")
1174 SKSL_TEST(CPU | GPU_ES3, kNever,      StaticSwitch,                    "shared/StaticSwitch.sksl")
1175 SKSL_TEST(CPU | GPU,     kApiLevel_T, StructArrayFollowedByScalar,     "shared/StructArrayFollowedByScalar.sksl")
1176 SKSL_TEST(CPU | GPU,     kNextRelease,StructIndexLookup,               "shared/StructIndexLookup.sksl")
1177 SKSL_TEST(CPU | GPU,     kNextRelease,StructIndexStore,                "shared/StructIndexStore.sksl")
1178 // TODO(skia:13920): StructComparison currently exposes a bug in SPIR-V codegen.
1179 SKSL_TEST(ES3,           kNextRelease,StructComparison,                "shared/StructComparison.sksl")
1180 SKSL_TEST(CPU | GPU,     kApiLevel_T, StructsInFunctions,              "shared/StructsInFunctions.sksl")
1181 SKSL_TEST(CPU | GPU,     kApiLevel_T, Switch,                          "shared/Switch.sksl")
1182 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwitchDefaultOnly,               "shared/SwitchDefaultOnly.sksl")
1183 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwitchWithFallthrough,           "shared/SwitchWithFallthrough.sksl")
1184 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwitchWithFallthroughAndVarDecls,"shared/SwitchWithFallthroughAndVarDecls.sksl")
1185 SKSL_TEST(CPU | GPU,     kApiLevel_V, SwitchWithFallthroughGroups,     "shared/SwitchWithFallthroughGroups.sksl")
1186 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwitchWithLoops,                 "shared/SwitchWithLoops.sksl")
1187 SKSL_TEST(ES3 | GPU_ES3, kNever,      SwitchWithLoopsES3,              "shared/SwitchWithLoopsES3.sksl")
1188 SKSL_TEST(CPU | GPU,     kNever,      SwizzleAsLValue,                 "shared/SwizzleAsLValue.sksl")
1189 SKSL_TEST(ES3 | GPU_ES3, kNever,      SwizzleAsLValueES3,              "shared/SwizzleAsLValueES3.sksl")
1190 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleBoolConstants,            "shared/SwizzleBoolConstants.sksl")
1191 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleByConstantIndex,          "shared/SwizzleByConstantIndex.sksl")
1192 SKSL_TEST(ES3 | GPU_ES3, kNever,      SwizzleByIndex,                  "shared/SwizzleByIndex.sksl")
1193 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleConstants,                "shared/SwizzleConstants.sksl")
1194 SKSL_TEST(CPU | GPU,     kNextRelease,SwizzleIndexLookup,              "shared/SwizzleIndexLookup.sksl")
1195 SKSL_TEST(CPU | GPU,     kNextRelease,SwizzleIndexStore,               "shared/SwizzleIndexStore.sksl")
1196 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleLTRB,                     "shared/SwizzleLTRB.sksl")
1197 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleOpt,                      "shared/SwizzleOpt.sksl")
1198 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleScalar,                   "shared/SwizzleScalar.sksl")
1199 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleScalarBool,               "shared/SwizzleScalarBool.sksl")
1200 SKSL_TEST(CPU | GPU,     kApiLevel_T, SwizzleScalarInt,                "shared/SwizzleScalarInt.sksl")
1201 SKSL_TEST(CPU | GPU,     kNextRelease,TemporaryIndexLookup,            "shared/TemporaryIndexLookup.sksl")
1202 SKSL_TEST(CPU | GPU,     kApiLevel_T, TernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
1203 SKSL_TEST(CPU | GPU,     kApiLevel_T, TernaryAsLValueFoldableTest,     "shared/TernaryAsLValueFoldableTest.sksl")
1204 SKSL_TEST(CPU | GPU,     kNextRelease,TernaryComplexNesting,           "shared/TernaryComplexNesting.sksl")
1205 SKSL_TEST(CPU | GPU,     kApiLevel_T, TernaryExpression,               "shared/TernaryExpression.sksl")
1206 SKSL_TEST(CPU | GPU,     kNextRelease,TernaryNesting,                  "shared/TernaryNesting.sksl")
1207 SKSL_TEST(CPU | GPU,     kNextRelease,TernaryOneZeroOptimization,      "shared/TernaryOneZeroOptimization.sksl")
1208 SKSL_TEST(CPU | GPU,     kApiLevel_U, TernarySideEffects,              "shared/TernarySideEffects.sksl")
1209 SKSL_TEST(CPU | GPU,     kApiLevel_T, UnaryPositiveNegative,           "shared/UnaryPositiveNegative.sksl")
1210 SKSL_TEST(CPU | GPU,     kApiLevel_T, UniformArray,                    "shared/UniformArray.sksl")
1211 SKSL_TEST(CPU | GPU,     kApiLevel_U, UniformMatrixResize,             "shared/UniformMatrixResize.sksl")
1212 SKSL_TEST(CPU | GPU,     kApiLevel_T, UnusedVariables,                 "shared/UnusedVariables.sksl")
1213 SKSL_TEST(CPU | GPU,     kApiLevel_T, VectorConstructors,              "shared/VectorConstructors.sksl")
1214 SKSL_TEST(CPU | GPU,     kApiLevel_T, VectorToMatrixCast,              "shared/VectorToMatrixCast.sksl")
1215 SKSL_TEST(CPU | GPU,     kApiLevel_T, VectorScalarMath,                "shared/VectorScalarMath.sksl")
1216 SKSL_TEST(ES3 | GPU_ES3, kNever,      WhileLoopControlFlow,            "shared/WhileLoopControlFlow.sksl")
1217 
1218 SKSL_TEST(CPU | GPU,     kNextRelease,VoidInSequenceExpressions,       "workarounds/VoidInSequenceExpressions.sksl")
1219