skia2/tests/SkSLTest.cpp

271 lines
16 KiB
C++
Raw Normal View History

/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkData.h"
#include "include/core/SkFont.h"
#include "include/core/SkPaint.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkGradientShader.h"
#include "include/effects/SkImageFilters.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/SkSLDefines.h" // for kDefaultInlineThreshold
#include "include/utils/SkRandom.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
static const SkRect kRect = SkRect::MakeWH(1, 1);
template <typename T>
static void set_uniform(SkRuntimeShaderBuilder* builder, const char* name, const T& value) {
SkRuntimeShaderBuilder::BuilderUniform uniform = builder->uniform(name);
if (uniform.fVar) {
uniform = value;
}
}
static void test_one_permutation(skiatest::Reporter* r,
SkSurface* surface,
const char* testFile,
const char* permutationSuffix,
const SkRuntimeEffect::Options& options) {
SkString resourcePath = SkStringPrintf("sksl/%s", testFile);
sk_sp<SkData> shaderData = GetResourceAsData(resourcePath.c_str());
if (!shaderData) {
ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
return;
}
SkString shaderString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
SkRuntimeEffect::Result result = SkRuntimeEffect::Make(shaderString, options);
if (!result.effect) {
ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
return;
}
SkRuntimeShaderBuilder builder(result.effect);
Reland "Add some SkSL intrinsics to our dm tests." This reverts commit b576168c8ca86daa494f2d64f2967e83bd65efa9. Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures Original change's description: > Revert "Add some SkSL intrinsics to our dm tests." > > This reverts commit 0492a744a52db0eaf360d2d3fce3ec5ca75dc5f0. > > Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test. > > Original change's description: > > Add some SkSL intrinsics to our dm tests. > > > > This CL adds dm coverage for: > > - abs(half) > > - sign(half) > > - floor > > - ceil > > > > And creates test output for abs(int) and sign(int); these aren't covered > > by dm because they don't exist in ES2 and so are unsupported by Runtime > > Effects. > > > > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419 > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:44:13 +00:00
set_uniform(&builder, "colorBlack", SkV4{0, 0, 0, 1});
set_uniform(&builder, "colorRed", SkV4{1, 0, 0, 1});
set_uniform(&builder, "colorGreen", SkV4{0, 1, 0, 1});
set_uniform(&builder, "colorBlue", SkV4{0, 0, 1, 1});
set_uniform(&builder, "colorWhite", SkV4{1, 1, 1, 1});
set_uniform(&builder, "testInputs", SkV4{-1.25, 0, 0.75, 2.25});
Reland "Add support for matrix == and != in Metal shaders." This reverts commit 4908a24d4b24ad34a3dce693d931654b872bff08. Reason for revert: test fails on Adreno 5xx/6xx, will land tests separately and disable on Adreno Original change's description: > Revert "Add support for matrix == and != in Metal shaders." > > This reverts commit c50185718830a6220b28be885cebd3959a0f0698. > > Reason for revert: breaking many bots > > Original change's description: > > Add support for matrix == and != in Metal shaders. > > > > We need to polyfill an operator== and != when these are first > > encountered in the code. > > > > Change-Id: I539c838ee1871bcb0c4b66abb8a4a0f91146cd4f > > Bug: skia:11306 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368496 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: Id583109a0d167c2c58a57644b14cd5f49d670737 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11306 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368801 > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Greg Daniel <egdaniel@google.com> TBR=egdaniel@google.com,brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:11306 Change-Id: If7c628b8c7a2ce40d6c88599a7660ff91c4ac67a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368804 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-10 14:53:41 +00:00
set_uniform(&builder, "testMatrix2x2", std::array<float,4>{1, 2,
3, 4});
set_uniform(&builder, "testMatrix3x3", std::array<float,9>{1, 2, 3,
4, 5, 6,
7, 8, 9});
Reland "Add some SkSL intrinsics to our dm tests." This reverts commit b576168c8ca86daa494f2d64f2967e83bd65efa9. Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures Original change's description: > Revert "Add some SkSL intrinsics to our dm tests." > > This reverts commit 0492a744a52db0eaf360d2d3fce3ec5ca75dc5f0. > > Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test. > > Original change's description: > > Add some SkSL intrinsics to our dm tests. > > > > This CL adds dm coverage for: > > - abs(half) > > - sign(half) > > - floor > > - ceil > > > > And creates test output for abs(int) and sign(int); these aren't covered > > by dm because they don't exist in ES2 and so are unsupported by Runtime > > Effects. > > > > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419 > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:44:13 +00:00
set_uniform(&builder, "unknownInput", 1.0f);
set_uniform(&builder, "testMatrix2x2", std::array<float,4>{1, 2,
3, 4});
set_uniform(&builder, "testMatrix3x3", std::array<float,9>{1, 2, 3,
4, 5, 6,
7, 8, 9});
sk_sp<SkShader> shader = builder.makeShader(/*localMatrix=*/nullptr, /*isOpaque=*/true);
if (!shader) {
ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
return;
}
SkPaint paintShader;
paintShader.setShader(shader);
surface->getCanvas()->drawRect(kRect, paintShader);
SkBitmap bitmap;
REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
REPORTER_ASSERT(r, surface->readPixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(),
/*srcX=*/0, /*srcY=*/0));
SkColor color = bitmap.getColor(0, 0);
REPORTER_ASSERT(r, color == SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00),
"Expected: solid green. Actual: A=%02X R=%02X G=%02X B=%02X.",
SkColorGetA(color), SkColorGetR(color), SkColorGetG(color), SkColorGetB(color));
}
static void test_permutations(skiatest::Reporter* r, SkSurface* surface, const char* testFile) {
SkRuntimeEffect::Options options;
options.forceNoInline = false;
test_one_permutation(r, surface, testFile, "", options);
options.forceNoInline = true;
test_one_permutation(r, surface, testFile, " (NoInline)", options);
}
static void test_cpu(skiatest::Reporter* r, const char* testFile) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(kRect.width(), kRect.height());
sk_sp<SkSurface> surface(SkSurface::MakeRaster(info));
test_permutations(r, surface.get(), testFile);
}
static void test_gpu(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(kRect.width(), kRect.height());
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
test_permutations(r, surface.get(), testFile);
}
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
#define SKSL_TEST_CPU(name, path) \
DEF_TEST(name ## _CPU, r) { \
test_cpu(r, path); \
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
}
#define SKSL_TEST_GPU(name, path) \
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
test_gpu(r, ctxInfo.directContext(), path); \
}
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
#define SKSL_TEST(name, path) SKSL_TEST_CPU(name, path) SKSL_TEST_GPU(name, path)
SKSL_TEST(SkSLAssignmentOps, "folding/AssignmentOps.sksl")
SKSL_TEST(SkSLBoolFolding, "folding/BoolFolding.sksl")
SKSL_TEST(SkSLIntFoldingES2, "folding/IntFoldingES2.sksl")
SKSL_TEST(SkSLFloatFolding, "folding/FloatFolding.sksl")
SKSL_TEST(SkSLMatrixFoldingES2, "folding/MatrixFoldingES2.sksl")
SKSL_TEST(SkSLSelfAssignment, "folding/SelfAssignment.sksl")
SKSL_TEST(SkSLShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.sksl")
SKSL_TEST(SkSLVectorScalarFolding, "folding/VectorScalarFolding.sksl")
SKSL_TEST(SkSLVectorVectorFolding, "folding/VectorVectorFolding.sksl")
SKSL_TEST(SkSLForBodyMustBeInlinedIntoAScope, "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
SKSL_TEST(SkSLForWithoutReturnInsideCanBeInlined, "inliner/ForWithoutReturnInsideCanBeInlined.sksl")
SKSL_TEST(SkSLForWithReturnInsideCannotBeInlined, "inliner/ForWithReturnInsideCannotBeInlined.sksl")
SKSL_TEST(SkSLIfBodyMustBeInlinedIntoAScope, "inliner/IfBodyMustBeInlinedIntoAScope.sksl")
SKSL_TEST(SkSLIfElseBodyMustBeInlinedIntoAScope, "inliner/IfElseBodyMustBeInlinedIntoAScope.sksl")
SKSL_TEST(SkSLIfElseChainWithReturnsCanBeInlined, "inliner/IfElseChainWithReturnsCanBeInlined.sksl")
SKSL_TEST(SkSLIfTestCanBeInlined, "inliner/IfTestCanBeInlined.sksl")
SKSL_TEST(SkSLIfWithReturnsCanBeInlined, "inliner/IfWithReturnsCanBeInlined.sksl")
SKSL_TEST(SkSLInlineKeywordOverridesThreshold, "inliner/InlineKeywordOverridesThreshold.sksl")
SKSL_TEST(SkSLInlinerAvoidsVariableNameOverlap, "inliner/InlinerAvoidsVariableNameOverlap.sksl")
SKSL_TEST(SkSLInlinerElidesTempVarForReturnsInsideBlock,
"inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl")
SKSL_TEST(SkSLInlinerUsesTempVarForMultipleReturns,
"inliner/InlinerUsesTempVarForMultipleReturns.sksl")
SKSL_TEST(SkSLInlinerUsesTempVarForReturnsInsideBlockWithVar,
"inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl")
SKSL_TEST(SkSLInlineThreshold, "inliner/InlineThreshold.sksl")
SKSL_TEST(SkSLInlineWithInoutArgument, "inliner/InlineWithInoutArgument.sksl")
SKSL_TEST(SkSLInlineWithModifiedArgument, "inliner/InlineWithModifiedArgument.sksl")
SKSL_TEST(SkSLInlineWithNestedBigCalls, "inliner/InlineWithNestedBigCalls.sksl")
SKSL_TEST(SkSLInlineWithUnmodifiedArgument, "inliner/InlineWithUnmodifiedArgument.sksl")
SKSL_TEST(SkSLInlineWithUnnecessaryBlocks, "inliner/InlineWithUnnecessaryBlocks.sksl")
SKSL_TEST(SkSLNoInline, "inliner/NoInline.sksl")
SKSL_TEST(SkSLShortCircuitEvaluationsCannotInlineRightHandSide,
"inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl")
SKSL_TEST(SkSLStructsCanBeInlinedSafely, "inliner/StructsCanBeInlinedSafely.sksl")
SKSL_TEST(SkSLSwizzleCanBeInlinedDirectly, "inliner/SwizzleCanBeInlinedDirectly.sksl")
SKSL_TEST(SkSLTernaryResultsCannotBeInlined, "inliner/TernaryResultsCannotBeInlined.sksl")
SKSL_TEST(SkSLTernaryTestCanBeInlined, "inliner/TernaryTestCanBeInlined.sksl")
SKSL_TEST(SkSLTrivialArgumentsInlineDirectly, "inliner/TrivialArgumentsInlineDirectly.sksl")
// TODO(skia:11052): SPIR-V does not yet honor `out` param semantics correctly
SKSL_TEST_CPU(SkSLInlinerHonorsGLSLOutParamSemantics,
"inliner/InlinerHonorsGLSLOutParamSemantics.sksl")
SKSL_TEST(SkSLIntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl")
SKSL_TEST(SkSLIntrinsicClampFloat, "intrinsics/ClampFloat.sksl")
SKSL_TEST(SkSLIntrinsicMaxFloat, "intrinsics/MaxFloat.sksl")
SKSL_TEST(SkSLIntrinsicMinFloat, "intrinsics/MinFloat.sksl")
SKSL_TEST(SkSLIntrinsicMixFloat, "intrinsics/MixFloat.sksl")
SKSL_TEST(SkSLIntrinsicSignFloat, "intrinsics/SignFloat.sksl")
SKSL_TEST(SkSLArrayTypes, "shared/ArrayTypes.sksl")
SKSL_TEST(SkSLAssignment, "shared/Assignment.sksl")
SKSL_TEST(SkSLCastsRoundTowardZero, "shared/CastsRoundTowardZero.sksl")
SKSL_TEST(SkSLCommaMixedTypes, "shared/CommaMixedTypes.sksl")
// This test causes the Adreno 330 driver to crash, and does not pass on Quadro P400 in wasm.
// The CPU test confirms that we can get it right, even if not all drivers do.
SKSL_TEST_CPU(SkSLCommaSideEffects, "shared/CommaSideEffects.sksl")
SKSL_TEST(SkSLConstantIf, "shared/ConstantIf.sksl")
SKSL_TEST(SkSLConstVariableComparison, "shared/ConstVariableComparison.sksl")
SKSL_TEST(SkSLDeadIfStatement, "shared/DeadIfStatement.sksl")
SKSL_TEST(SkSLDeadStripFunctions, "shared/DeadStripFunctions.sksl")
SKSL_TEST(SkSLDependentInitializers, "shared/DependentInitializers.sksl")
SKSL_TEST(SkSLEmptyBlocksES2, "shared/EmptyBlocksES2.sksl")
SKSL_TEST(SkSLForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
SKSL_TEST(SkSLFunctionArgTypeMatch, "shared/FunctionArgTypeMatch.sksl")
SKSL_TEST(SkSLFunctionReturnTypeMatch, "shared/FunctionReturnTypeMatch.sksl")
SKSL_TEST(SkSLFunctions, "shared/Functions.sksl")
SKSL_TEST(SkSLGeometricIntrinsics, "shared/GeometricIntrinsics.sksl")
SKSL_TEST(SkSLHelloWorld, "shared/HelloWorld.sksl")
SKSL_TEST(SkSLHex, "shared/Hex.sksl")
SKSL_TEST(SkSLMatrices, "shared/Matrices.sksl")
SKSL_TEST(SkSLMatrixEquality, "shared/MatrixEquality.sksl")
SKSL_TEST(SkSLMultipleAssignments, "shared/MultipleAssignments.sksl")
SKSL_TEST(SkSLNegatedVectorLiteral, "shared/NegatedVectorLiteral.sksl")
SKSL_TEST(SkSLNumberCasts, "shared/NumberCasts.sksl")
SKSL_TEST(SkSLOperatorsES2, "shared/OperatorsES2.sksl")
SKSL_TEST(SkSLOutParams, "shared/OutParams.sksl")
SKSL_TEST(SkSLOutParamsNoInline, "shared/OutParamsNoInline.sksl")
SKSL_TEST(SkSLOutParamsTricky, "shared/OutParamsTricky.sksl")
SKSL_TEST(SkSLResizeMatrix, "shared/ResizeMatrix.sksl")
SKSL_TEST(SkSLReturnsValueOnEveryPathES2, "shared/ReturnsValueOnEveryPathES2.sksl")
SKSL_TEST(SkSLScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
SKSL_TEST(SkSLStackingVectorCasts, "shared/StackingVectorCasts.sksl")
SKSL_TEST(SkSLStaticIf, "shared/StaticIf.sksl")
SKSL_TEST(SkSLStructsInFunctions, "shared/StructsInFunctions.sksl")
SKSL_TEST(SkSLSwizzleBoolConstants, "shared/SwizzleBoolConstants.sksl")
SKSL_TEST(SkSLSwizzleByConstantIndex, "shared/SwizzleByConstantIndex.sksl")
SKSL_TEST(SkSLSwizzleConstants, "shared/SwizzleConstants.sksl")
SKSL_TEST(SkSLSwizzleLTRB, "shared/SwizzleLTRB.sksl")
SKSL_TEST(SkSLSwizzleOpt, "shared/SwizzleOpt.sksl")
SKSL_TEST(SkSLSwizzleScalar, "shared/SwizzleScalar.sksl")
SKSL_TEST(SkSLTernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
SKSL_TEST(SkSLTernaryAsLValueFoldableTest, "shared/TernaryAsLValueFoldableTest.sksl")
SKSL_TEST(SkSLTernaryExpression, "shared/TernaryExpression.sksl")
SKSL_TEST(SkSLUnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
SKSL_TEST(SkSLUnusedVariables, "shared/UnusedVariables.sksl")
SKSL_TEST(SkSLVectorConstructors, "shared/VectorConstructors.sksl")
SKSL_TEST(SkSLVectorScalarMath, "shared/VectorScalarMath.sksl")
Reland "Add SkSL for-loop control flow test to dm." This reverts commit 578f1acbe8a47178efb21df49561c365226f9d95. Reason for revert: updated test to pass on Mac Intel 5100/6000 Original change's description: > Revert "Add SkSL for-loop control flow test to dm." > > This reverts commit a0c266283a8ef230ad0436dbf885d2b616e7302b. > > Reason for revert: failing on Mac Intel > > Original change's description: > > Add SkSL for-loop control flow test to dm. > > > > While loops and do-while loops remain untested in dm, as they are not > > supported in ES2 (and therefore not available in Runtime Effects). > > > > Change-Id: I2f1bfccccd571cc4ced096bc18ebbb9ecc9f9b4a > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359556 > > Commit-Queue: John Stiles <johnstiles@google.com> > > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I45335d16a695644eaeb8a535298c0efcc616c1ce > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359840 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I2dc6e870393708a12286658001b723f25a6aec4a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359856 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-27 14:56:04 +00:00
Reland "Add some SkSL intrinsics to our dm tests." This reverts commit b576168c8ca86daa494f2d64f2967e83bd65efa9. Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures Original change's description: > Revert "Add some SkSL intrinsics to our dm tests." > > This reverts commit 0492a744a52db0eaf360d2d3fce3ec5ca75dc5f0. > > Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test. > > Original change's description: > > Add some SkSL intrinsics to our dm tests. > > > > This CL adds dm coverage for: > > - abs(half) > > - sign(half) > > - floor > > - ceil > > > > And creates test output for abs(int) and sign(int); these aren't covered > > by dm because they don't exist in ES2 and so are unsupported by Runtime > > Effects. > > > > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419 > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:44:13 +00:00
/*
// Incompatible with Runtime Effects because calling a function before its definition is disallowed.
// (This was done to prevent recursion, as required by ES2.)
SKSL_TEST(SkSLFunctionPrototype, "shared/FunctionPrototype.sksl")
Reland "Add some SkSL intrinsics to our dm tests." This reverts commit b576168c8ca86daa494f2d64f2967e83bd65efa9. Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures Original change's description: > Revert "Add some SkSL intrinsics to our dm tests." > > This reverts commit 0492a744a52db0eaf360d2d3fce3ec5ca75dc5f0. > > Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test. > > Original change's description: > > Add some SkSL intrinsics to our dm tests. > > > > This CL adds dm coverage for: > > - abs(half) > > - sign(half) > > - floor > > - ceil > > > > And creates test output for abs(int) and sign(int); these aren't covered > > by dm because they don't exist in ES2 and so are unsupported by Runtime > > Effects. > > > > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419 > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:44:13 +00:00
*/
/*
TODO(skia:11209): enable these tests when Runtime Effects have support for ES3
SKSL_TEST(SkSLIntFoldingES3, "folding/IntFoldingES3.sksl")
SKSL_TEST(SkSLMatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
SKSL_TEST(SkSLDoWhileBodyMustBeInlinedIntoAScope, "inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
SKSL_TEST(SkSLDoWhileTestCannotBeInlined, "inliner/DoWhileTestCannotBeInlined.sksl")
SKSL_TEST(SkSLEnumsCanBeInlinedSafely, "inliner/EnumsCanBeInlinedSafely.sksl")
SKSL_TEST(SkSLForInitializerExpressionsCanBeInlined,
"inliner/ForInitializerExpressionsCanBeInlined.sksl")
SKSL_TEST(SkSLStaticSwitch, "inliner/StaticSwitch.sksl")
SKSL_TEST(SkSLWhileBodyMustBeInlinedIntoAScope, "inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
SKSL_TEST(SkSLWhileTestCannotBeInlined, "inliner/WhileTestCannotBeInlined.sksl")
SKSL_TEST(SkSLIntrinsicAbsInt, "intrinsics/AbsInt.sksl")
SKSL_TEST(SkSLIntrinsicClampInt, "intrinsics/ClampInt.sksl")
SKSL_TEST(SkSLIntrinsicMaxInt, "intrinsics/MaxInt.sksl")
SKSL_TEST(SkSLIntrinsicMinInt, "intrinsics/MinInt.sksl")
SKSL_TEST(SkSLIntrinsicMixBool, "intrinsics/MixBool.sksl")
SKSL_TEST(SkSLIntrinsicSignInt, "intrinsics/SignInt.sksl")
SKSL_TEST(SkSLArrayConstructors, "shared/ArrayConstructors.sksl")
SKSL_TEST(SkSLDeadLoopVariable, "shared/DeadLoopVariable.sksl")
SKSL_TEST(SkSLDoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
SKSL_TEST(SkSLEmptyBlocksES3, "shared/EmptyBlocksES3.sksl")
SKSL_TEST(SkSLHexUnsigned, "shared/HexUnsigned.sksl")
SKSL_TEST(SkSLMatricesNonsquare, "shared/MatricesNonsquare.sksl")
SKSL_TEST(SkSLOperatorsES3, "shared/OperatorsES3.sksl")
SKSL_TEST(SkSLResizeMatrixNonsquare, "shared/ResizeMatrixNonsquare.sksl")
SKSL_TEST(SkSLReturnsValueOnEveryPathES3, "shared/ReturnsValueOnEveryPathES3.sksl")
SKSL_TEST(SkSLScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
SKSL_TEST(SkSLSwizzleByIndex, "shared/SwizzleByIndex.sksl")
SKSL_TEST(SkSLWhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
*/