blob: 34a07f2424bced2b97514de4c198b64ea7149003 [file] [log] [blame]
John Stiles232dd2b2021-01-25 10:57:47 -05001/*
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"
Ethan Nicholasdaed2592021-03-04 14:30:25 -050020#include "include/private/SkSLDefines.h" // for kDefaultInlineThreshold
John Stiles232dd2b2021-01-25 10:57:47 -050021#include "include/utils/SkRandom.h"
Brian Osmane9ab3912021-07-02 10:17:45 -040022#include "src/core/SkRuntimeEffectPriv.h"
John Stiles65d7ab22021-04-28 15:14:09 -040023#include "src/gpu/GrCaps.h"
24#include "src/gpu/GrDirectContextPriv.h"
John Stiles232dd2b2021-01-25 10:57:47 -050025#include "tests/Test.h"
26#include "tools/Resources.h"
27#include "tools/ToolUtils.h"
28
29static const SkRect kRect = SkRect::MakeWH(1, 1);
30
John Stilesb41d5bb2021-01-26 16:28:12 -050031template <typename T>
32static void set_uniform(SkRuntimeShaderBuilder* builder, const char* name, const T& value) {
33 SkRuntimeShaderBuilder::BuilderUniform uniform = builder->uniform(name);
34 if (uniform.fVar) {
35 uniform = value;
36 }
37}
38
John Stilesd80f9662021-02-03 11:42:32 -050039static void test_one_permutation(skiatest::Reporter* r,
40 SkSurface* surface,
41 const char* testFile,
42 const char* permutationSuffix,
43 const SkRuntimeEffect::Options& options) {
John Stiles232dd2b2021-01-25 10:57:47 -050044 SkString resourcePath = SkStringPrintf("sksl/%s", testFile);
45 sk_sp<SkData> shaderData = GetResourceAsData(resourcePath.c_str());
46 if (!shaderData) {
John Stilesd80f9662021-02-03 11:42:32 -050047 ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
John Stiles232dd2b2021-01-25 10:57:47 -050048 return;
49 }
50
51 SkString shaderString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
Brian Osman169c8902021-04-21 14:27:08 -040052 SkRuntimeEffect::Result result = SkRuntimeEffect::MakeForShader(shaderString, options);
John Stilesd80f9662021-02-03 11:42:32 -050053 if (!result.effect) {
54 ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
John Stiles232dd2b2021-01-25 10:57:47 -050055 return;
56 }
57
John Stilesd80f9662021-02-03 11:42:32 -050058 SkRuntimeShaderBuilder builder(result.effect);
John Stilese1658b52021-01-29 11:44:13 -050059 set_uniform(&builder, "colorBlack", SkV4{0, 0, 0, 1});
60 set_uniform(&builder, "colorRed", SkV4{1, 0, 0, 1});
61 set_uniform(&builder, "colorGreen", SkV4{0, 1, 0, 1});
62 set_uniform(&builder, "colorBlue", SkV4{0, 0, 1, 1});
63 set_uniform(&builder, "colorWhite", SkV4{1, 1, 1, 1});
64 set_uniform(&builder, "testInputs", SkV4{-1.25, 0, 0.75, 2.25});
John Stiles01cdf012021-02-10 09:53:41 -050065 set_uniform(&builder, "testMatrix2x2", std::array<float,4>{1, 2,
66 3, 4});
67 set_uniform(&builder, "testMatrix3x3", std::array<float,9>{1, 2, 3,
68 4, 5, 6,
69 7, 8, 9});
John Stilese1658b52021-01-29 11:44:13 -050070 set_uniform(&builder, "unknownInput", 1.0f);
John Stilesa0e407d2021-02-10 12:21:51 -050071 set_uniform(&builder, "testMatrix2x2", std::array<float,4>{1, 2,
72 3, 4});
73 set_uniform(&builder, "testMatrix3x3", std::array<float,9>{1, 2, 3,
74 4, 5, 6,
75 7, 8, 9});
John Stilesb41d5bb2021-01-26 16:28:12 -050076
John Stiles232dd2b2021-01-25 10:57:47 -050077 sk_sp<SkShader> shader = builder.makeShader(/*localMatrix=*/nullptr, /*isOpaque=*/true);
78 if (!shader) {
John Stilesd80f9662021-02-03 11:42:32 -050079 ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
John Stiles232dd2b2021-01-25 10:57:47 -050080 return;
81 }
82
83 SkPaint paintShader;
84 paintShader.setShader(shader);
85 surface->getCanvas()->drawRect(kRect, paintShader);
86
87 SkBitmap bitmap;
88 REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
89 REPORTER_ASSERT(r, surface->readPixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(),
90 /*srcX=*/0, /*srcY=*/0));
91
92 SkColor color = bitmap.getColor(0, 0);
93 REPORTER_ASSERT(r, color == SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00),
94 "Expected: solid green. Actual: A=%02X R=%02X G=%02X B=%02X.",
95 SkColorGetA(color), SkColorGetR(color), SkColorGetG(color), SkColorGetB(color));
96}
97
John Stiles65d7ab22021-04-28 15:14:09 -040098static void test_permutations(skiatest::Reporter* r,
99 SkSurface* surface,
100 const char* testFile,
101 bool worksInES2) {
Brian Osmane9ab3912021-07-02 10:17:45 -0400102 SkRuntimeEffect::Options options =
103 worksInES2 ? SkRuntimeEffect::Options{} : SkRuntimeEffectPriv::ES3Options();
John Stiles9d26af92021-03-23 09:25:33 -0400104 options.forceNoInline = false;
John Stilesd80f9662021-02-03 11:42:32 -0500105 test_one_permutation(r, surface, testFile, "", options);
John Stiles9d26af92021-03-23 09:25:33 -0400106
107 options.forceNoInline = true;
108 test_one_permutation(r, surface, testFile, " (NoInline)", options);
John Stilesd80f9662021-02-03 11:42:32 -0500109}
110
John Stiles232dd2b2021-01-25 10:57:47 -0500111static void test_cpu(skiatest::Reporter* r, const char* testFile) {
112 const SkImageInfo info = SkImageInfo::MakeN32Premul(kRect.width(), kRect.height());
113 sk_sp<SkSurface> surface(SkSurface::MakeRaster(info));
114
John Stiles65d7ab22021-04-28 15:14:09 -0400115 test_permutations(r, surface.get(), testFile, /*worksInES2=*/true);
John Stiles232dd2b2021-01-25 10:57:47 -0500116}
117
118static void test_gpu(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
119 const SkImageInfo info = SkImageInfo::MakeN32Premul(kRect.width(), kRect.height());
120 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
121
John Stiles65d7ab22021-04-28 15:14:09 -0400122 test_permutations(r, surface.get(), testFile, /*worksInES2=*/true);
123}
124
125static void test_es3(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
John Stiles0733d482021-08-18 12:17:21 -0400126 if (!ctx->priv().caps()->shaderCaps()->supportsSkSLES3()) {
John Stiles65d7ab22021-04-28 15:14:09 -0400127 return;
128 }
129 // ES3-only tests never run on the CPU, because SkVM lacks support for many non-ES2 features.
130 const SkImageInfo info = SkImageInfo::MakeN32Premul(kRect.width(), kRect.height());
131 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
132
133 test_permutations(r, surface.get(), testFile, /*worksInES2=*/false);
John Stiles232dd2b2021-01-25 10:57:47 -0500134}
135
John Stilesb4418502021-02-04 10:57:08 -0500136#define SKSL_TEST_CPU(name, path) \
John Stiles232dd2b2021-01-25 10:57:47 -0500137 DEF_TEST(name ## _CPU, r) { \
138 test_cpu(r, path); \
John Stilesb4418502021-02-04 10:57:08 -0500139 }
140#define SKSL_TEST_GPU(name, path) \
John Stiles232dd2b2021-01-25 10:57:47 -0500141 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
142 test_gpu(r, ctxInfo.directContext(), path); \
143 }
John Stiles65d7ab22021-04-28 15:14:09 -0400144#define SKSL_TEST_ES3(name, path) \
145 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
146 test_es3(r, ctxInfo.directContext(), path); \
147 }
John Stilesb4418502021-02-04 10:57:08 -0500148#define SKSL_TEST(name, path) SKSL_TEST_CPU(name, path) SKSL_TEST_GPU(name, path)
John Stiles232dd2b2021-01-25 10:57:47 -0500149
John Stiles34c098d2021-02-09 10:38:59 -0500150SKSL_TEST(SkSLAssignmentOps, "folding/AssignmentOps.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500151SKSL_TEST(SkSLBoolFolding, "folding/BoolFolding.sksl")
John Stiles27193d42021-05-07 11:16:26 -0400152SKSL_TEST(SkSLCastFolding, "folding/CastFolding.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500153SKSL_TEST(SkSLIntFoldingES2, "folding/IntFoldingES2.sksl")
John Stiles65d7ab22021-04-28 15:14:09 -0400154SKSL_TEST_ES3(SkSLIntFoldingES3, "folding/IntFoldingES3.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500155SKSL_TEST(SkSLFloatFolding, "folding/FloatFolding.sksl")
Brian Osman169c8902021-04-21 14:27:08 -0400156// skbug.com/11919: Fails on Nexus5/7, and Intel GPUs
157SKSL_TEST_CPU(SkSLMatrixFoldingES2, "folding/MatrixFoldingES2.sksl")
Brian Osman8e756f32021-02-10 10:19:27 -0500158SKSL_TEST(SkSLSelfAssignment, "folding/SelfAssignment.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500159SKSL_TEST(SkSLShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.sksl")
John Stilesfb7d3782021-04-29 11:14:38 -0400160SKSL_TEST(SkSLSwizzleFolding, "folding/SwizzleFolding.sksl")
John Stiles03467a52021-03-04 15:19:48 +0000161SKSL_TEST(SkSLVectorScalarFolding, "folding/VectorScalarFolding.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500162SKSL_TEST(SkSLVectorVectorFolding, "folding/VectorVectorFolding.sksl")
John Stiles232dd2b2021-01-25 10:57:47 -0500163
John Stilesd2c5a802021-05-19 21:42:57 -0400164SKSL_TEST_ES3(SkSLDoWhileBodyMustBeInlinedIntoAScope,
165 "inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
166SKSL_TEST_ES3(SkSLDoWhileTestCannotBeInlined, "inliner/DoWhileTestCannotBeInlined.sksl")
John Stiles0c9d8882021-03-25 17:04:36 -0400167SKSL_TEST(SkSLForBodyMustBeInlinedIntoAScope, "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
John Stiles65d7ab22021-04-28 15:14:09 -0400168SKSL_TEST_ES3(SkSLForInitializerExpressionsCanBeInlined,
169 "inliner/ForInitializerExpressionsCanBeInlined.sksl")
John Stiles0c9d8882021-03-25 17:04:36 -0400170SKSL_TEST(SkSLForWithoutReturnInsideCanBeInlined, "inliner/ForWithoutReturnInsideCanBeInlined.sksl")
171SKSL_TEST(SkSLForWithReturnInsideCannotBeInlined, "inliner/ForWithReturnInsideCannotBeInlined.sksl")
172SKSL_TEST(SkSLIfBodyMustBeInlinedIntoAScope, "inliner/IfBodyMustBeInlinedIntoAScope.sksl")
173SKSL_TEST(SkSLIfElseBodyMustBeInlinedIntoAScope, "inliner/IfElseBodyMustBeInlinedIntoAScope.sksl")
174SKSL_TEST(SkSLIfElseChainWithReturnsCanBeInlined, "inliner/IfElseChainWithReturnsCanBeInlined.sksl")
175SKSL_TEST(SkSLIfTestCanBeInlined, "inliner/IfTestCanBeInlined.sksl")
176SKSL_TEST(SkSLIfWithReturnsCanBeInlined, "inliner/IfWithReturnsCanBeInlined.sksl")
177SKSL_TEST(SkSLInlineKeywordOverridesThreshold, "inliner/InlineKeywordOverridesThreshold.sksl")
178SKSL_TEST(SkSLInlinerAvoidsVariableNameOverlap, "inliner/InlinerAvoidsVariableNameOverlap.sksl")
179SKSL_TEST(SkSLInlinerElidesTempVarForReturnsInsideBlock,
180 "inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl")
181SKSL_TEST(SkSLInlinerUsesTempVarForMultipleReturns,
182 "inliner/InlinerUsesTempVarForMultipleReturns.sksl")
183SKSL_TEST(SkSLInlinerUsesTempVarForReturnsInsideBlockWithVar,
184 "inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl")
185SKSL_TEST(SkSLInlineThreshold, "inliner/InlineThreshold.sksl")
Brian Osman169c8902021-04-21 14:27:08 -0400186// skbug.com/11919: Fails on Adreno + Vulkan
187SKSL_TEST_CPU(SkSLInlineWithInoutArgument, "inliner/InlineWithInoutArgument.sksl")
John Stiles0c9d8882021-03-25 17:04:36 -0400188SKSL_TEST(SkSLInlineWithModifiedArgument, "inliner/InlineWithModifiedArgument.sksl")
189SKSL_TEST(SkSLInlineWithNestedBigCalls, "inliner/InlineWithNestedBigCalls.sksl")
190SKSL_TEST(SkSLInlineWithUnmodifiedArgument, "inliner/InlineWithUnmodifiedArgument.sksl")
191SKSL_TEST(SkSLInlineWithUnnecessaryBlocks, "inliner/InlineWithUnnecessaryBlocks.sksl")
192SKSL_TEST(SkSLNoInline, "inliner/NoInline.sksl")
193SKSL_TEST(SkSLShortCircuitEvaluationsCannotInlineRightHandSide,
194 "inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl")
John Stiles325c8082021-05-17 14:49:05 -0400195SKSL_TEST_ES3(SkSLStaticSwitchInline, "inliner/StaticSwitch.sksl")
John Stiles0c9d8882021-03-25 17:04:36 -0400196SKSL_TEST(SkSLStructsCanBeInlinedSafely, "inliner/StructsCanBeInlinedSafely.sksl")
197SKSL_TEST(SkSLSwizzleCanBeInlinedDirectly, "inliner/SwizzleCanBeInlinedDirectly.sksl")
198SKSL_TEST(SkSLTernaryResultsCannotBeInlined, "inliner/TernaryResultsCannotBeInlined.sksl")
199SKSL_TEST(SkSLTernaryTestCanBeInlined, "inliner/TernaryTestCanBeInlined.sksl")
200SKSL_TEST(SkSLTrivialArgumentsInlineDirectly, "inliner/TrivialArgumentsInlineDirectly.sksl")
John Stiles65d7ab22021-04-28 15:14:09 -0400201SKSL_TEST_ES3(SkSLWhileBodyMustBeInlinedIntoAScope,
202 "inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
203SKSL_TEST_ES3(SkSLWhileTestCannotBeInlined, "inliner/WhileTestCannotBeInlined.sksl")
John Stiles0c9d8882021-03-25 17:04:36 -0400204
John Stilesbff24ab2021-03-17 13:20:10 -0400205// TODO(skia:11052): SPIR-V does not yet honor `out` param semantics correctly
206SKSL_TEST_CPU(SkSLInlinerHonorsGLSLOutParamSemantics,
John Stiles0c9d8882021-03-25 17:04:36 -0400207 "inliner/InlinerHonorsGLSLOutParamSemantics.sksl")
John Stilesbff24ab2021-03-17 13:20:10 -0400208
John Stilesd4374782021-02-05 09:31:21 -0500209SKSL_TEST(SkSLIntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
210SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl")
John Stilesc61d1bf2021-08-19 10:16:35 -0400211SKSL_TEST_ES3(SkSLIntrinsicDeterminant, "intrinsics/Determinant.sksl")
John Stiles4e249482021-08-13 11:43:21 -0400212SKSL_TEST_ES3(SkSLIntrinsicDFdx, "intrinsics/DFdx.sksl")
213SKSL_TEST_ES3(SkSLIntrinsicDFdy, "intrinsics/DFdy.sksl")
John Stilesb39236b2021-08-20 10:10:02 -0400214SKSL_TEST_ES3(SkSLIntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl")
215SKSL_TEST_ES3(SkSLIntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl")
216SKSL_TEST_ES3(SkSLIntrinsicIntBitsToFloat, "intrinsics/IntBitsToFloat.sksl")
John Stilesdec5ff22021-08-25 13:54:34 -0400217SKSL_TEST_ES3(SkSLIntrinsicIsInf, "intrinsics/IsInf.sksl")
John Stiles27724cd2021-05-25 14:53:17 -0400218// TODO(johnstiles): test broken on Adreno 6xx + Vulkan
219//SKSL_TEST(SkSLIntrinsicClampFloat, "intrinsics/ClampFloat.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500220SKSL_TEST(SkSLIntrinsicMaxFloat, "intrinsics/MaxFloat.sksl")
221SKSL_TEST(SkSLIntrinsicMinFloat, "intrinsics/MinFloat.sksl")
Brian Osman169c8902021-04-21 14:27:08 -0400222// skbug.com/11919: Fails on Adreno + Vulkan
223SKSL_TEST_CPU(SkSLIntrinsicMixFloat, "intrinsics/MixFloat.sksl")
John Stiles36816622021-08-23 11:00:10 -0400224SKSL_TEST_ES3(SkSLIntrinsicRound, "intrinsics/Round.sksl")
225SKSL_TEST_ES3(SkSLIntrinsicRoundEven, "intrinsics/RoundEven.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500226SKSL_TEST(SkSLIntrinsicSignFloat, "intrinsics/SignFloat.sksl")
John Stiles017ffd72021-05-25 11:48:30 -0400227SKSL_TEST(SkSLIntrinsicStep, "intrinsics/Step.sksl")
John Stiles36816622021-08-23 11:00:10 -0400228SKSL_TEST_ES3(SkSLIntrinsicTrunc, "intrinsics/Trunc.sksl")
John Stiles39822cf2021-08-17 15:08:46 -0400229SKSL_TEST_ES3(SkSLIntrinsicTranspose, "intrinsics/Transpose.sksl")
John Stilesdec5ff22021-08-25 13:54:34 -0400230SKSL_TEST_ES3(SkSLIntrinsicUintBitsToFloat, "intrinsics/UintBitsToFloat.sksl")
John Stilese1658b52021-01-29 11:44:13 -0500231
John Stiles2195f942021-08-05 10:55:03 -0400232SKSL_TEST_ES3(SkSLArrayNarrowingConversions, "runtime/ArrayNarrowingConversions.rts")
233
John Stiles39346472021-04-29 14:39:35 -0400234SKSL_TEST_ES3(SkSLArrayComparison, "shared/ArrayComparison.sksl")
John Stilesc1f64112021-05-17 09:59:02 -0400235SKSL_TEST_ES3(SkSLArrayConstructors, "shared/ArrayConstructors.sksl")
John Stiles26487162021-08-10 16:03:44 -0400236SKSL_TEST_ES3(SkSLArrayCast, "shared/ArrayCast.sksl")
John Stiles2d3f5e82021-08-25 11:54:16 -0400237SKSL_TEST_ES3(SkSLArrayFollowedByScalar, "shared/ArrayFollowedByScalar.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500238SKSL_TEST(SkSLArrayTypes, "shared/ArrayTypes.sksl")
239SKSL_TEST(SkSLAssignment, "shared/Assignment.sksl")
240SKSL_TEST(SkSLCastsRoundTowardZero, "shared/CastsRoundTowardZero.sksl")
241SKSL_TEST(SkSLCommaMixedTypes, "shared/CommaMixedTypes.sksl")
John Stiles31508392021-03-17 16:59:07 -0400242// This test causes the Adreno 330 driver to crash, and does not pass on Quadro P400 in wasm.
243// The CPU test confirms that we can get it right, even if not all drivers do.
244SKSL_TEST_CPU(SkSLCommaSideEffects, "shared/CommaSideEffects.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500245SKSL_TEST(SkSLConstantIf, "shared/ConstantIf.sksl")
John Stiles82491c52021-05-14 07:55:45 -0400246SKSL_TEST_ES3(SkSLConstArray, "shared/ConstArray.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500247SKSL_TEST(SkSLConstVariableComparison, "shared/ConstVariableComparison.sksl")
248SKSL_TEST(SkSLDeadIfStatement, "shared/DeadIfStatement.sksl")
John Stilesf2b08cc2021-05-17 14:46:05 -0400249SKSL_TEST(SkSLDeadReturn, "shared/DeadReturn.sksl")
John Stilesb82e9312021-05-20 15:30:22 -0400250// TODO(skia:12012): some Radeons crash when compiling this code; disable them
251//SKSL_TEST_ES3(SkSLDeadReturnES3, "shared/DeadReturnES3.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500252SKSL_TEST(SkSLDeadStripFunctions, "shared/DeadStripFunctions.sksl")
253SKSL_TEST(SkSLDependentInitializers, "shared/DependentInitializers.sksl")
John Stilesd2c5a802021-05-19 21:42:57 -0400254SKSL_TEST_ES3(SkSLDoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500255SKSL_TEST(SkSLEmptyBlocksES2, "shared/EmptyBlocksES2.sksl")
256SKSL_TEST(SkSLForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
257SKSL_TEST(SkSLFunctionArgTypeMatch, "shared/FunctionArgTypeMatch.sksl")
258SKSL_TEST(SkSLFunctionReturnTypeMatch, "shared/FunctionReturnTypeMatch.sksl")
259SKSL_TEST(SkSLFunctions, "shared/Functions.sksl")
Brian Osman7da06572021-07-21 15:19:34 -0400260SKSL_TEST(SkSLFunctionPrototype, "shared/FunctionPrototype.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500261SKSL_TEST(SkSLGeometricIntrinsics, "shared/GeometricIntrinsics.sksl")
262SKSL_TEST(SkSLHelloWorld, "shared/HelloWorld.sksl")
263SKSL_TEST(SkSLHex, "shared/Hex.sksl")
264SKSL_TEST(SkSLMatrices, "shared/Matrices.sksl")
John Stilesab3e6392021-05-14 17:53:03 -0400265SKSL_TEST_ES3(SkSLMatricesNonsquare, "shared/MatricesNonsquare.sksl")
John Stilesa0e407d2021-02-10 12:21:51 -0500266SKSL_TEST(SkSLMatrixEquality, "shared/MatrixEquality.sksl")
John Stiles191b4e22021-05-14 20:03:01 -0400267SKSL_TEST(SkSLMatrixScalarSplat, "shared/MatrixScalarSplat.sksl")
John Stiles6de2e1d2021-07-09 12:41:55 -0400268SKSL_TEST(SkSLMatrixToVectorCast, "shared/MatrixToVectorCast.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500269SKSL_TEST(SkSLMultipleAssignments, "shared/MultipleAssignments.sksl")
John Stilesf89a8122021-08-30 15:47:00 -0400270SKSL_TEST(SkSLNegation, "shared/Negation.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500271SKSL_TEST(SkSLNumberCasts, "shared/NumberCasts.sksl")
272SKSL_TEST(SkSLOperatorsES2, "shared/OperatorsES2.sksl")
John Stilesc1f64112021-05-17 09:59:02 -0400273SKSL_TEST_ES3(SkSLOperatorsES3, "shared/OperatorsES3.sksl")
John Stiles9ae6ea02021-08-05 11:49:05 -0400274SKSL_TEST(SkSLOssfuzz36852, "shared/Ossfuzz36852.sksl")
Brian Osman169c8902021-04-21 14:27:08 -0400275
276// skbug.com/11919: Fails on Adreno + Vulkan
277SKSL_TEST_CPU(SkSLOutParams, "shared/OutParams.sksl")
278SKSL_TEST_CPU(SkSLOutParamsNoInline, "shared/OutParamsNoInline.sksl")
279SKSL_TEST_CPU(SkSLOutParamsTricky, "shared/OutParamsTricky.sksl")
280
John Stilesd4374782021-02-05 09:31:21 -0500281SKSL_TEST(SkSLResizeMatrix, "shared/ResizeMatrix.sksl")
John Stilesb3dcbb12021-03-04 16:00:20 -0500282SKSL_TEST(SkSLReturnsValueOnEveryPathES2, "shared/ReturnsValueOnEveryPathES2.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500283SKSL_TEST(SkSLScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
John Stiles325c8082021-05-17 14:49:05 -0400284SKSL_TEST_ES3(SkSLScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500285SKSL_TEST(SkSLStackingVectorCasts, "shared/StackingVectorCasts.sksl")
286SKSL_TEST(SkSLStaticIf, "shared/StaticIf.sksl")
John Stiles325c8082021-05-17 14:49:05 -0400287SKSL_TEST_ES3(SkSLStaticSwitch, "shared/StaticSwitch.sksl")
John Stiles31c87102021-08-25 12:01:21 -0400288SKSL_TEST(SkSLStructArrayFollowedByScalar, "shared/StructArrayFollowedByScalar.sksl")
John Stiles39346472021-04-29 14:39:35 -0400289SKSL_TEST(SkSLStructsInFunctions, "shared/StructsInFunctions.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500290SKSL_TEST(SkSLSwizzleBoolConstants, "shared/SwizzleBoolConstants.sksl")
John Stilesc2c1b0c2021-02-05 16:24:03 -0500291SKSL_TEST(SkSLSwizzleByConstantIndex, "shared/SwizzleByConstantIndex.sksl")
292SKSL_TEST(SkSLSwizzleConstants, "shared/SwizzleConstants.sksl")
293SKSL_TEST(SkSLSwizzleLTRB, "shared/SwizzleLTRB.sksl")
294SKSL_TEST(SkSLSwizzleOpt, "shared/SwizzleOpt.sksl")
295SKSL_TEST(SkSLSwizzleScalar, "shared/SwizzleScalar.sksl")
John Stiles010c0ec2021-07-12 15:05:54 -0400296SKSL_TEST(SkSLSwizzleScalarBool, "shared/SwizzleScalarBool.sksl")
John Stiles7f56b412021-07-12 14:59:19 -0400297SKSL_TEST(SkSLSwizzleScalarInt, "shared/SwizzleScalarInt.sksl")
John Stilesecd7c222021-02-08 14:20:28 -0500298SKSL_TEST(SkSLTernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
299SKSL_TEST(SkSLTernaryAsLValueFoldableTest, "shared/TernaryAsLValueFoldableTest.sksl")
John Stiles28054ad2021-03-05 15:22:48 -0500300SKSL_TEST(SkSLTernaryExpression, "shared/TernaryExpression.sksl")
John Stilesecd7c222021-02-08 14:20:28 -0500301SKSL_TEST(SkSLUnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
302SKSL_TEST(SkSLUnusedVariables, "shared/UnusedVariables.sksl")
303SKSL_TEST(SkSLVectorConstructors, "shared/VectorConstructors.sksl")
John Stiles5a825da2021-07-08 18:20:21 -0400304SKSL_TEST(SkSLVectorToMatrixCast, "shared/VectorToMatrixCast.sksl")
Brian Osman169c8902021-04-21 14:27:08 -0400305// skbug.com/11919: Fails on Nexus5/7, and Intel GPUs
306SKSL_TEST_CPU(SkSLVectorScalarMath, "shared/VectorScalarMath.sksl")
John Stilesc1f64112021-05-17 09:59:02 -0400307SKSL_TEST_ES3(SkSLWhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
John Stiles7b928972021-01-27 09:56:04 -0500308
John Stiles232dd2b2021-01-25 10:57:47 -0500309/*
John Stiles232dd2b2021-01-25 10:57:47 -0500310TODO(skia:11209): enable these tests when Runtime Effects have support for ES3
311
John Stilesd4374782021-02-05 09:31:21 -0500312SKSL_TEST(SkSLMatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
John Stiles7b928972021-01-27 09:56:04 -0500313
John Stilesd4374782021-02-05 09:31:21 -0500314SKSL_TEST(SkSLIntrinsicAbsInt, "intrinsics/AbsInt.sksl")
315SKSL_TEST(SkSLIntrinsicClampInt, "intrinsics/ClampInt.sksl")
316SKSL_TEST(SkSLIntrinsicMaxInt, "intrinsics/MaxInt.sksl")
317SKSL_TEST(SkSLIntrinsicMinInt, "intrinsics/MinInt.sksl")
318SKSL_TEST(SkSLIntrinsicMixBool, "intrinsics/MixBool.sksl")
319SKSL_TEST(SkSLIntrinsicSignInt, "intrinsics/SignInt.sksl")
John Stilese1658b52021-01-29 11:44:13 -0500320
John Stilesd4374782021-02-05 09:31:21 -0500321SKSL_TEST(SkSLDeadLoopVariable, "shared/DeadLoopVariable.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500322SKSL_TEST(SkSLEmptyBlocksES3, "shared/EmptyBlocksES3.sksl")
323SKSL_TEST(SkSLHexUnsigned, "shared/HexUnsigned.sksl")
John Stilesd4374782021-02-05 09:31:21 -0500324SKSL_TEST(SkSLResizeMatrixNonsquare, "shared/ResizeMatrixNonsquare.sksl")
John Stilesb3dcbb12021-03-04 16:00:20 -0500325SKSL_TEST(SkSLReturnsValueOnEveryPathES3, "shared/ReturnsValueOnEveryPathES3.sksl")
John Stilesc2c1b0c2021-02-05 16:24:03 -0500326SKSL_TEST(SkSLSwizzleByIndex, "shared/SwizzleByIndex.sksl")
John Stiles232dd2b2021-01-25 10:57:47 -0500327*/