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 "gm/gm.h"
9 #include "include/core/SkBitmap.h"
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkData.h"
12 #include "include/core/SkFont.h"
13 #include "include/core/SkPaint.h"
14 #include "include/core/SkSize.h"
15 #include "include/core/SkString.h"
16 #include "include/core/SkSurface.h"
17 #include "include/effects/SkGradientShader.h"
18 #include "include/effects/SkImageFilters.h"
19 #include "include/effects/SkRuntimeEffect.h"
20 #include "include/private/SkSLDefines.h" // for kDefaultInlineThreshold
21 #include "include/utils/SkRandom.h"
22 #include "src/core/SkRuntimeEffectPriv.h"
23 #include "src/gpu/GrCaps.h"
24 #include "src/gpu/GrDirectContextPriv.h"
25 #include "tests/Test.h"
26 #include "tools/Resources.h"
27 #include "tools/ToolUtils.h"
28
29 static constexpr int kWidth = 2;
30 static constexpr int kHeight = 2;
31
32 template <typename T>
set_uniform(SkRuntimeShaderBuilder * builder,const char * name,const T & value)33 static void set_uniform(SkRuntimeShaderBuilder* builder, const char* name, const T& value) {
34 SkRuntimeShaderBuilder::BuilderUniform uniform = builder->uniform(name);
35 if (uniform.fVar) {
36 uniform = value;
37 }
38 }
39
40 template <typename T>
set_uniform_array(SkRuntimeShaderBuilder * builder,const char * name,SkSpan<T> values)41 static void set_uniform_array(SkRuntimeShaderBuilder* builder, const char* name, SkSpan<T> values) {
42 SkRuntimeShaderBuilder::BuilderUniform uniform = builder->uniform(name);
43 if (uniform.fVar) {
44 uniform.set(values.data(), values.size());
45 }
46 }
47
test_one_permutation(skiatest::Reporter * r,SkSurface * surface,const char * testFile,const char * permutationSuffix,const SkRuntimeEffect::Options & options)48 static void test_one_permutation(skiatest::Reporter* r,
49 SkSurface* surface,
50 const char* testFile,
51 const char* permutationSuffix,
52 const SkRuntimeEffect::Options& options) {
53 SkString resourcePath = SkStringPrintf("sksl/%s", testFile);
54 sk_sp<SkData> shaderData = GetResourceAsData(resourcePath.c_str());
55 if (!shaderData) {
56 ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
57 return;
58 }
59
60 SkString shaderString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
61 SkRuntimeEffect::Result result = SkRuntimeEffect::MakeForShader(shaderString, options);
62 if (!result.effect) {
63 ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
64 return;
65 }
66
67 static constexpr float kArray[5] = {1, 2, 3, 4, 5};
68
69 SkRuntimeShaderBuilder builder(result.effect);
70 set_uniform(&builder, "colorBlack", SkV4{0, 0, 0, 1});
71 set_uniform(&builder, "colorRed", SkV4{1, 0, 0, 1});
72 set_uniform(&builder, "colorGreen", SkV4{0, 1, 0, 1});
73 set_uniform(&builder, "colorBlue", SkV4{0, 0, 1, 1});
74 set_uniform(&builder, "colorWhite", SkV4{1, 1, 1, 1});
75 set_uniform(&builder, "testInputs", SkV4{-1.25, 0, 0.75, 2.25});
76 set_uniform(&builder, "testMatrix2x2", std::array<float,4>{1, 2,
77 3, 4});
78 set_uniform(&builder, "testMatrix3x3", std::array<float,9>{1, 2, 3,
79 4, 5, 6,
80 7, 8, 9});
81 set_uniform(&builder, "unknownInput", 1.0f);
82 set_uniform(&builder, "testMatrix2x2", std::array<float,4>{1, 2,
83 3, 4});
84 set_uniform(&builder, "testMatrix3x3", std::array<float,9>{1, 2, 3,
85 4, 5, 6,
86 7, 8, 9});
87 set_uniform_array(&builder, "testArray", SkMakeSpan(kArray));
88
89 sk_sp<SkShader> shader = builder.makeShader(/*localMatrix=*/nullptr, /*isOpaque=*/true);
90 if (!shader) {
91 ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
92 return;
93 }
94
95 SkPaint paintShader;
96 paintShader.setShader(shader);
97 surface->getCanvas()->drawRect(SkRect::MakeWH(kWidth, kHeight), paintShader);
98
99 SkBitmap bitmap;
100 REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
101 REPORTER_ASSERT(r, surface->readPixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(),
102 /*srcX=*/0, /*srcY=*/0));
103
104 bool success = true;
105 SkColor color[kHeight][kWidth];
106 for (int y = 0; y < kHeight; ++y) {
107 for (int x = 0; x < kWidth; ++x) {
108 color[y][x] = bitmap.getColor(x, y);
109 if (color[y][x] != SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00)) {
110 success = false;
111 }
112 }
113 }
114
115 if (!success) {
116 static_assert(kWidth == 2);
117 static_assert(kHeight == 2);
118 ERRORF(r, "Expected: solid green. Actual:\n"
119 "RRGGBBAA RRGGBBAA\n"
120 "%02X%02X%02X%02X %02X%02X%02X%02X\n"
121 "%02X%02X%02X%02X %02X%02X%02X%02X",
122 SkColorGetR(color[0][0]), SkColorGetG(color[0][0]),
123 SkColorGetB(color[0][0]), SkColorGetA(color[0][0]),
124
125 SkColorGetR(color[0][1]), SkColorGetG(color[0][1]),
126 SkColorGetB(color[0][1]), SkColorGetA(color[0][1]),
127
128 SkColorGetR(color[1][0]), SkColorGetG(color[1][0]),
129 SkColorGetB(color[1][0]), SkColorGetA(color[1][0]),
130
131 SkColorGetR(color[1][1]), SkColorGetG(color[1][1]),
132 SkColorGetB(color[1][1]), SkColorGetA(color[1][1]));
133 }
134 }
135
test_permutations(skiatest::Reporter * r,SkSurface * surface,const char * testFile,bool worksInES2)136 static void test_permutations(skiatest::Reporter* r,
137 SkSurface* surface,
138 const char* testFile,
139 bool worksInES2) {
140 SkRuntimeEffect::Options options =
141 worksInES2 ? SkRuntimeEffect::Options{} : SkRuntimeEffectPriv::ES3Options();
142 options.forceNoInline = false;
143 test_one_permutation(r, surface, testFile, "", options);
144
145 options.forceNoInline = true;
146 test_one_permutation(r, surface, testFile, " (NoInline)", options);
147 }
148
test_cpu(skiatest::Reporter * r,const char * testFile)149 static void test_cpu(skiatest::Reporter* r, const char* testFile) {
150 const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
151 sk_sp<SkSurface> surface(SkSurface::MakeRaster(info));
152
153 test_permutations(r, surface.get(), testFile, /*worksInES2=*/true);
154 }
155
test_gpu(skiatest::Reporter * r,GrDirectContext * ctx,const char * testFile)156 static void test_gpu(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
157 const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
158 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
159
160 test_permutations(r, surface.get(), testFile, /*worksInES2=*/true);
161 }
162
test_es3(skiatest::Reporter * r,GrDirectContext * ctx,const char * testFile)163 static void test_es3(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
164 if (!ctx->priv().caps()->shaderCaps()->supportsSkSLES3()) {
165 return;
166 }
167 // ES3-only tests never run on the CPU, because SkVM lacks support for many non-ES2 features.
168 const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
169 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
170
171 test_permutations(r, surface.get(), testFile, /*worksInES2=*/false);
172 }
173
174 #define SKSL_TEST_CPU(name, path) \
175 DEF_TEST(name ## _CPU, r) { \
176 test_cpu(r, path); \
177 }
178 #define SKSL_TEST_GPU(name, path) \
179 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
180 test_gpu(r, ctxInfo.directContext(), path); \
181 }
182 #define SKSL_TEST_ES3(name, path) \
183 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
184 test_es3(r, ctxInfo.directContext(), path); \
185 }
186 #define SKSL_TEST(name, path) SKSL_TEST_CPU(name, path) SKSL_TEST_GPU(name, path)
187
188 SKSL_TEST(SkSLArraySizeFolding, "folding/ArraySizeFolding.sksl")
189 SKSL_TEST(SkSLAssignmentOps, "folding/AssignmentOps.sksl")
190 SKSL_TEST(SkSLBoolFolding, "folding/BoolFolding.sksl")
191 SKSL_TEST(SkSLCastFolding, "folding/CastFolding.sksl")
192 SKSL_TEST(SkSLIntFoldingES2, "folding/IntFoldingES2.sksl")
193 SKSL_TEST_ES3(SkSLIntFoldingES3, "folding/IntFoldingES3.sksl")
194 SKSL_TEST(SkSLFloatFolding, "folding/FloatFolding.sksl")
195 // skbug.com/11919: Fails on Nexus5/7, and Intel GPUs
196 SKSL_TEST_CPU(SkSLMatrixFoldingES2, "folding/MatrixFoldingES2.sksl")
197 SKSL_TEST_ES3(SkSLMatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
198 SKSL_TEST(SkSLSelfAssignment, "folding/SelfAssignment.sksl")
199 SKSL_TEST(SkSLShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.sksl")
200 SKSL_TEST(SkSLSwizzleFolding, "folding/SwizzleFolding.sksl")
201 SKSL_TEST(SkSLVectorScalarFolding, "folding/VectorScalarFolding.sksl")
202 SKSL_TEST(SkSLVectorVectorFolding, "folding/VectorVectorFolding.sksl")
203
204 SKSL_TEST_ES3(SkSLDoWhileBodyMustBeInlinedIntoAScope,
205 "inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
206 SKSL_TEST_ES3(SkSLDoWhileTestCannotBeInlined, "inliner/DoWhileTestCannotBeInlined.sksl")
207 SKSL_TEST(SkSLForBodyMustBeInlinedIntoAScope, "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
208 SKSL_TEST_ES3(SkSLForInitializerExpressionsCanBeInlined,
209 "inliner/ForInitializerExpressionsCanBeInlined.sksl")
210 SKSL_TEST(SkSLForWithoutReturnInsideCanBeInlined, "inliner/ForWithoutReturnInsideCanBeInlined.sksl")
211 SKSL_TEST(SkSLForWithReturnInsideCannotBeInlined, "inliner/ForWithReturnInsideCannotBeInlined.sksl")
212 SKSL_TEST(SkSLIfBodyMustBeInlinedIntoAScope, "inliner/IfBodyMustBeInlinedIntoAScope.sksl")
213 SKSL_TEST(SkSLIfElseBodyMustBeInlinedIntoAScope, "inliner/IfElseBodyMustBeInlinedIntoAScope.sksl")
214 SKSL_TEST(SkSLIfElseChainWithReturnsCanBeInlined, "inliner/IfElseChainWithReturnsCanBeInlined.sksl")
215 SKSL_TEST(SkSLIfTestCanBeInlined, "inliner/IfTestCanBeInlined.sksl")
216 SKSL_TEST(SkSLIfWithReturnsCanBeInlined, "inliner/IfWithReturnsCanBeInlined.sksl")
217 SKSL_TEST(SkSLInlineKeywordOverridesThreshold, "inliner/InlineKeywordOverridesThreshold.sksl")
218 SKSL_TEST(SkSLInlinerAvoidsVariableNameOverlap, "inliner/InlinerAvoidsVariableNameOverlap.sksl")
219 SKSL_TEST(SkSLInlinerElidesTempVarForReturnsInsideBlock,
220 "inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl")
221 SKSL_TEST(SkSLInlinerUsesTempVarForMultipleReturns,
222 "inliner/InlinerUsesTempVarForMultipleReturns.sksl")
223 SKSL_TEST(SkSLInlinerUsesTempVarForReturnsInsideBlockWithVar,
224 "inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl")
225 SKSL_TEST(SkSLInlineThreshold, "inliner/InlineThreshold.sksl")
226 // skbug.com/11919: Fails on Adreno + Vulkan
227 SKSL_TEST_CPU(SkSLInlineWithInoutArgument, "inliner/InlineWithInoutArgument.sksl")
228 SKSL_TEST(SkSLInlineWithModifiedArgument, "inliner/InlineWithModifiedArgument.sksl")
229 SKSL_TEST(SkSLInlineWithNestedBigCalls, "inliner/InlineWithNestedBigCalls.sksl")
230 SKSL_TEST(SkSLInlineWithUnmodifiedArgument, "inliner/InlineWithUnmodifiedArgument.sksl")
231 SKSL_TEST(SkSLInlineWithUnnecessaryBlocks, "inliner/InlineWithUnnecessaryBlocks.sksl")
232 SKSL_TEST(SkSLNoInline, "inliner/NoInline.sksl")
233 SKSL_TEST(SkSLShortCircuitEvaluationsCannotInlineRightHandSide,
234 "inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl")
235 SKSL_TEST_ES3(SkSLStaticSwitchInline, "inliner/StaticSwitch.sksl")
236 SKSL_TEST(SkSLStructsCanBeInlinedSafely, "inliner/StructsCanBeInlinedSafely.sksl")
237 SKSL_TEST(SkSLSwizzleCanBeInlinedDirectly, "inliner/SwizzleCanBeInlinedDirectly.sksl")
238 SKSL_TEST(SkSLTernaryResultsCannotBeInlined, "inliner/TernaryResultsCannotBeInlined.sksl")
239 SKSL_TEST(SkSLTernaryTestCanBeInlined, "inliner/TernaryTestCanBeInlined.sksl")
240 SKSL_TEST(SkSLTrivialArgumentsInlineDirectly, "inliner/TrivialArgumentsInlineDirectly.sksl")
241 SKSL_TEST_ES3(SkSLWhileBodyMustBeInlinedIntoAScope,
242 "inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
243 SKSL_TEST_ES3(SkSLWhileTestCannotBeInlined, "inliner/WhileTestCannotBeInlined.sksl")
244
245 // TODO(skia:11052): SPIR-V does not yet honor `out` param semantics correctly
246 SKSL_TEST_CPU(SkSLInlinerHonorsGLSLOutParamSemantics,
247 "inliner/InlinerHonorsGLSLOutParamSemantics.sksl")
248
249 SKSL_TEST(SkSLIntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
250 SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl")
251 SKSL_TEST_ES3(SkSLIntrinsicDeterminant, "intrinsics/Determinant.sksl")
252 SKSL_TEST_ES3(SkSLIntrinsicDFdx, "intrinsics/DFdx.sksl")
253 SKSL_TEST_ES3(SkSLIntrinsicDFdy, "intrinsics/DFdy.sksl")
254 SKSL_TEST_ES3(SkSLIntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl")
255 SKSL_TEST_ES3(SkSLIntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl")
256 SKSL_TEST_ES3(SkSLIntrinsicFwidth, "intrinsics/Fwidth.sksl")
257 SKSL_TEST_ES3(SkSLIntrinsicIntBitsToFloat, "intrinsics/IntBitsToFloat.sksl")
258 SKSL_TEST_ES3(SkSLIntrinsicIsInf, "intrinsics/IsInf.sksl")
259 SKSL_TEST_ES3(SkSLIntrinsicClampInt, "intrinsics/ClampInt.sksl")
260 SKSL_TEST_ES3(SkSLIntrinsicClampUInt, "intrinsics/ClampUInt.sksl")
261 // Fails on Adreno 6xx + Vulkan
262 SKSL_TEST_CPU(SkSLIntrinsicClampFloat, "intrinsics/ClampFloat.sksl")
263 SKSL_TEST(SkSLIntrinsicMatrixCompMultES2, "intrinsics/MatrixCompMultES2.sksl")
264 SKSL_TEST_ES3(SkSLIntrinsicMatrixCompMultES3, "intrinsics/MatrixCompMultES3.sksl")
265 SKSL_TEST(SkSLIntrinsicMaxFloat, "intrinsics/MaxFloat.sksl")
266 SKSL_TEST(SkSLIntrinsicMinFloat, "intrinsics/MinFloat.sksl")
267 // Fails on Adreno + Vulkan (skia:11919)
268 SKSL_TEST_CPU(SkSLIntrinsicMixFloat, "intrinsics/MixFloat.sksl")
269 SKSL_TEST_ES3(SkSLIntrinsicModf, "intrinsics/Modf.sksl")
270 SKSL_TEST_ES3(SkSLIntrinsicOuterProduct, "intrinsics/OuterProduct.sksl")
271 // Fails on Mac OpenGL + Radeon 5300M (skia:12434)
272 //SKSL_TEST_ES3(SkSLIntrinsicPackUnorm2x16, "intrinsics/PackUnorm2x16.sksl")
273 SKSL_TEST_ES3(SkSLIntrinsicRound, "intrinsics/Round.sksl")
274 SKSL_TEST_ES3(SkSLIntrinsicRoundEven, "intrinsics/RoundEven.sksl")
275 SKSL_TEST(SkSLIntrinsicSignFloat, "intrinsics/SignFloat.sksl")
276 SKSL_TEST(SkSLIntrinsicStep, "intrinsics/Step.sksl")
277 SKSL_TEST_ES3(SkSLIntrinsicTrunc, "intrinsics/Trunc.sksl")
278 SKSL_TEST_ES3(SkSLIntrinsicTranspose, "intrinsics/Transpose.sksl")
279 SKSL_TEST_ES3(SkSLIntrinsicUintBitsToFloat, "intrinsics/UintBitsToFloat.sksl")
280
281 SKSL_TEST_ES3(SkSLArrayNarrowingConversions, "runtime/ArrayNarrowingConversions.rts")
282 SKSL_TEST(SkSLLoopFloat, "runtime/LoopFloat.rts")
283 SKSL_TEST(SkSLLoopInt, "runtime/LoopInt.rts")
284 SKSL_TEST(SkSLQualifierOrder, "runtime/QualifierOrder.rts")
285 SKSL_TEST(SkSLPrecisionQualifiers, "runtime/PrecisionQualifiers.rts")
286
287 SKSL_TEST_ES3(SkSLArrayComparison, "shared/ArrayComparison.sksl")
288 SKSL_TEST_ES3(SkSLArrayConstructors, "shared/ArrayConstructors.sksl")
289 SKSL_TEST_ES3(SkSLArrayCast, "shared/ArrayCast.sksl")
290 SKSL_TEST_ES3(SkSLArrayFollowedByScalar, "shared/ArrayFollowedByScalar.sksl")
291 SKSL_TEST(SkSLArrayTypes, "shared/ArrayTypes.sksl")
292 SKSL_TEST(SkSLAssignment, "shared/Assignment.sksl")
293 SKSL_TEST(SkSLCastsRoundTowardZero, "shared/CastsRoundTowardZero.sksl")
294 SKSL_TEST(SkSLCommaMixedTypes, "shared/CommaMixedTypes.sksl")
295 // This test causes the Adreno 330 driver to crash, and does not pass on Quadro P400 in wasm.
296 // The CPU test confirms that we can get it right, even if not all drivers do.
297 SKSL_TEST_CPU(SkSLCommaSideEffects, "shared/CommaSideEffects.sksl")
298 SKSL_TEST(SkSLConstantIf, "shared/ConstantIf.sksl")
299 SKSL_TEST_ES3(SkSLConstArray, "shared/ConstArray.sksl")
300 SKSL_TEST(SkSLConstVariableComparison, "shared/ConstVariableComparison.sksl")
301 SKSL_TEST_ES3(SkSLDeadLoopVariable, "shared/DeadLoopVariable.sksl")
302 SKSL_TEST(SkSLDeadIfStatement, "shared/DeadIfStatement.sksl")
303 SKSL_TEST(SkSLDeadReturn, "shared/DeadReturn.sksl")
304 // TODO(skia:12012): some Radeons crash when compiling this code; disable them
305 //SKSL_TEST_ES3(SkSLDeadReturnES3, "shared/DeadReturnES3.sksl")
306 SKSL_TEST(SkSLDeadStripFunctions, "shared/DeadStripFunctions.sksl")
307 SKSL_TEST(SkSLDependentInitializers, "shared/DependentInitializers.sksl")
308 SKSL_TEST_ES3(SkSLDoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
309 SKSL_TEST(SkSLEmptyBlocksES2, "shared/EmptyBlocksES2.sksl")
310 SKSL_TEST_ES3(SkSLEmptyBlocksES3, "shared/EmptyBlocksES3.sksl")
311 SKSL_TEST(SkSLForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
312 SKSL_TEST(SkSLFunctionArgTypeMatch, "shared/FunctionArgTypeMatch.sksl")
313 SKSL_TEST(SkSLFunctionReturnTypeMatch, "shared/FunctionReturnTypeMatch.sksl")
314 SKSL_TEST(SkSLFunctions, "shared/Functions.sksl")
315 SKSL_TEST(SkSLFunctionPrototype, "shared/FunctionPrototype.sksl")
316 SKSL_TEST(SkSLGeometricIntrinsics, "shared/GeometricIntrinsics.sksl")
317 SKSL_TEST(SkSLHelloWorld, "shared/HelloWorld.sksl")
318 SKSL_TEST(SkSLHex, "shared/Hex.sksl")
319 SKSL_TEST_ES3(SkSLHexUnsigned, "shared/HexUnsigned.sksl")
320 SKSL_TEST(SkSLMatrices, "shared/Matrices.sksl")
321 SKSL_TEST_ES3(SkSLMatricesNonsquare, "shared/MatricesNonsquare.sksl")
322 SKSL_TEST(SkSLMatrixConstructorsES2, "shared/MatrixConstructorsES2.sksl")
323 SKSL_TEST_ES3(SkSLMatrixConstructorsES3, "shared/MatrixConstructorsES3.sksl")
324 SKSL_TEST(SkSLMatrixEquality, "shared/MatrixEquality.sksl")
325 SKSL_TEST(SkSLMatrixScalarSplat, "shared/MatrixScalarSplat.sksl")
326 SKSL_TEST(SkSLMatrixToVectorCast, "shared/MatrixToVectorCast.sksl")
327 SKSL_TEST(SkSLMultipleAssignments, "shared/MultipleAssignments.sksl")
328 SKSL_TEST(SkSLNegation, "shared/Negation.sksl")
329 SKSL_TEST(SkSLNumberCasts, "shared/NumberCasts.sksl")
330 SKSL_TEST(SkSLOperatorsES2, "shared/OperatorsES2.sksl")
331 SKSL_TEST_ES3(SkSLOperatorsES3, "shared/OperatorsES3.sksl")
332 SKSL_TEST(SkSLOssfuzz36852, "shared/Ossfuzz36852.sksl")
333
334 // skbug.com/11919: Fails on Adreno + Vulkan
335 SKSL_TEST_CPU(SkSLOutParams, "shared/OutParams.sksl")
336 SKSL_TEST_CPU(SkSLOutParamsNoInline, "shared/OutParamsNoInline.sksl")
337 SKSL_TEST_CPU(SkSLOutParamsTricky, "shared/OutParamsTricky.sksl")
338
339 SKSL_TEST(SkSLResizeMatrix, "shared/ResizeMatrix.sksl")
340 SKSL_TEST_ES3(SkSLResizeMatrixNonsquare, "shared/ResizeMatrixNonsquare.sksl")
341 SKSL_TEST(SkSLReturnsValueOnEveryPathES2, "shared/ReturnsValueOnEveryPathES2.sksl")
342 SKSL_TEST_ES3(SkSLReturnsValueOnEveryPathES3, "shared/ReturnsValueOnEveryPathES3.sksl")
343 SKSL_TEST(SkSLScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
344 SKSL_TEST(SkSLScopedSymbol, "shared/ScopedSymbol.sksl")
345 SKSL_TEST_ES3(SkSLScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
346 SKSL_TEST(SkSLStackingVectorCasts, "shared/StackingVectorCasts.sksl")
347 SKSL_TEST(SkSLStaticIf, "shared/StaticIf.sksl")
348 SKSL_TEST_ES3(SkSLStaticSwitch, "shared/StaticSwitch.sksl")
349 SKSL_TEST(SkSLStructArrayFollowedByScalar, "shared/StructArrayFollowedByScalar.sksl")
350 SKSL_TEST(SkSLStructsInFunctions, "shared/StructsInFunctions.sksl")
351 SKSL_TEST(SkSLSwitch, "shared/Switch.sksl")
352 SKSL_TEST(SkSLSwitchDefaultOnly, "shared/SwitchDefaultOnly.sksl")
353 SKSL_TEST(SkSLSwitchWithFallthrough, "shared/SwitchWithFallthrough.sksl")
354 SKSL_TEST(SkSLSwitchWithLoops, "shared/SwitchWithLoops.sksl")
355 SKSL_TEST(SkSLSwizzleBoolConstants, "shared/SwizzleBoolConstants.sksl")
356 SKSL_TEST(SkSLSwizzleByConstantIndex, "shared/SwizzleByConstantIndex.sksl")
357 SKSL_TEST_ES3(SkSLSwizzleByIndex, "shared/SwizzleByIndex.sksl")
358 SKSL_TEST(SkSLSwizzleConstants, "shared/SwizzleConstants.sksl")
359 SKSL_TEST(SkSLSwizzleLTRB, "shared/SwizzleLTRB.sksl")
360 SKSL_TEST(SkSLSwizzleOpt, "shared/SwizzleOpt.sksl")
361 SKSL_TEST(SkSLSwizzleScalar, "shared/SwizzleScalar.sksl")
362 SKSL_TEST(SkSLSwizzleScalarBool, "shared/SwizzleScalarBool.sksl")
363 SKSL_TEST(SkSLSwizzleScalarInt, "shared/SwizzleScalarInt.sksl")
364 SKSL_TEST(SkSLTernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
365 SKSL_TEST(SkSLTernaryAsLValueFoldableTest, "shared/TernaryAsLValueFoldableTest.sksl")
366 SKSL_TEST(SkSLTernaryExpression, "shared/TernaryExpression.sksl")
367 SKSL_TEST(SkSLUnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
368 SKSL_TEST(SkSLUniformArray, "shared/UniformArray.sksl")
369 SKSL_TEST(SkSLUnusedVariables, "shared/UnusedVariables.sksl")
370 SKSL_TEST(SkSLVectorConstructors, "shared/VectorConstructors.sksl")
371 SKSL_TEST(SkSLVectorToMatrixCast, "shared/VectorToMatrixCast.sksl")
372 // skbug.com/11919: Fails on Nexus5/7, and Intel GPUs
373 SKSL_TEST_CPU(SkSLVectorScalarMath, "shared/VectorScalarMath.sksl")
374 SKSL_TEST_ES3(SkSLWhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
375
376 /*
377 TODO(skia:11209): enable these tests when Runtime Effects have support for ES3
378
379 SKSL_TEST(SkSLIntrinsicAbsInt, "intrinsics/AbsInt.sksl")
380 SKSL_TEST(SkSLIntrinsicMaxInt, "intrinsics/MaxInt.sksl")
381 SKSL_TEST(SkSLIntrinsicMinInt, "intrinsics/MinInt.sksl")
382 SKSL_TEST(SkSLIntrinsicMixBool, "intrinsics/MixBool.sksl")
383 SKSL_TEST(SkSLIntrinsicSignInt, "intrinsics/SignInt.sksl")
384 */
385