2021-01-25 15:57:47 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
2021-03-04 19:30:25 +00:00
|
|
|
#include "include/private/SkSLDefines.h" // for kDefaultInlineThreshold
|
2022-02-03 19:51:02 +00:00
|
|
|
#include "include/sksl/DSLCore.h"
|
2021-01-25 15:57:47 +00:00
|
|
|
#include "include/utils/SkRandom.h"
|
2021-07-02 14:17:45 +00:00
|
|
|
#include "src/core/SkRuntimeEffectPriv.h"
|
2021-04-28 19:14:09 +00:00
|
|
|
#include "src/gpu/GrCaps.h"
|
|
|
|
#include "src/gpu/GrDirectContextPriv.h"
|
2022-02-01 15:23:17 +00:00
|
|
|
#include "src/sksl/SkSLCompiler.h"
|
|
|
|
#include "src/sksl/SkSLDehydrator.h"
|
|
|
|
#include "src/sksl/SkSLRehydrator.h"
|
2022-02-03 19:51:02 +00:00
|
|
|
#include "src/sksl/SkSLThreadContext.h"
|
2021-01-25 15:57:47 +00:00
|
|
|
#include "tests/Test.h"
|
|
|
|
#include "tools/Resources.h"
|
|
|
|
#include "tools/ToolUtils.h"
|
|
|
|
|
2021-09-15 21:42:42 +00:00
|
|
|
static constexpr int kWidth = 2;
|
|
|
|
static constexpr int kHeight = 2;
|
2021-01-25 15:57:47 +00:00
|
|
|
|
2021-01-26 21:28:12 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 21:02:16 +00:00
|
|
|
template <typename T>
|
|
|
|
static void set_uniform_array(SkRuntimeShaderBuilder* builder, const char* name, SkSpan<T> values) {
|
|
|
|
SkRuntimeShaderBuilder::BuilderUniform uniform = builder->uniform(name);
|
|
|
|
if (uniform.fVar) {
|
|
|
|
uniform.set(values.data(), values.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-01 15:23:17 +00:00
|
|
|
static SkString load_source(skiatest::Reporter* r,
|
|
|
|
const char* testFile,
|
|
|
|
const char* permutationSuffix) {
|
|
|
|
SkString resourcePath = SkStringPrintf("sksl/%s", testFile);
|
|
|
|
sk_sp<SkData> shaderData = GetResourceAsData(resourcePath.c_str());
|
|
|
|
if (!shaderData) {
|
2022-02-03 19:51:02 +00:00
|
|
|
ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
|
2022-02-01 15:23:17 +00:00
|
|
|
return SkString("");
|
|
|
|
}
|
|
|
|
return SkString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
|
|
|
|
}
|
|
|
|
|
2021-02-03 16:42:32 +00:00
|
|
|
static void test_one_permutation(skiatest::Reporter* r,
|
|
|
|
SkSurface* surface,
|
|
|
|
const char* testFile,
|
|
|
|
const char* permutationSuffix,
|
|
|
|
const SkRuntimeEffect::Options& options) {
|
2022-02-01 15:23:17 +00:00
|
|
|
SkString shaderString = load_source(r, testFile, permutationSuffix);
|
|
|
|
if (shaderString.isEmpty()) {
|
2021-01-25 15:57:47 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-04-21 18:27:08 +00:00
|
|
|
SkRuntimeEffect::Result result = SkRuntimeEffect::MakeForShader(shaderString, options);
|
2021-02-03 16:42:32 +00:00
|
|
|
if (!result.effect) {
|
|
|
|
ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
|
2021-01-25 15:57:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-04 21:02:16 +00:00
|
|
|
static constexpr float kArray[5] = {1, 2, 3, 4, 5};
|
|
|
|
|
2021-02-03 16:42:32 +00:00
|
|
|
SkRuntimeShaderBuilder builder(result.effect);
|
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});
|
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});
|
2021-01-29 16:44:13 +00:00
|
|
|
set_uniform(&builder, "unknownInput", 1.0f);
|
2021-02-10 17:21:51 +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});
|
2021-10-04 21:02:16 +00:00
|
|
|
set_uniform_array(&builder, "testArray", SkMakeSpan(kArray));
|
2021-01-26 21:28:12 +00:00
|
|
|
|
2022-02-03 16:24:13 +00:00
|
|
|
sk_sp<SkShader> shader = builder.makeShader(/*localMatrix=*/nullptr, /*isOpaque=*/false);
|
2021-01-25 15:57:47 +00:00
|
|
|
if (!shader) {
|
2021-02-03 16:42:32 +00:00
|
|
|
ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
|
2021-01-25 15:57:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkPaint paintShader;
|
|
|
|
paintShader.setShader(shader);
|
2021-09-15 21:42:42 +00:00
|
|
|
surface->getCanvas()->drawRect(SkRect::MakeWH(kWidth, kHeight), paintShader);
|
2021-01-25 15:57:47 +00:00
|
|
|
|
|
|
|
SkBitmap bitmap;
|
|
|
|
REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
|
|
|
|
REPORTER_ASSERT(r, surface->readPixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(),
|
|
|
|
/*srcX=*/0, /*srcY=*/0));
|
|
|
|
|
2021-09-15 21:42:42 +00:00
|
|
|
bool success = true;
|
|
|
|
SkColor color[kHeight][kWidth];
|
|
|
|
for (int y = 0; y < kHeight; ++y) {
|
|
|
|
for (int x = 0; x < kWidth; ++x) {
|
|
|
|
color[y][x] = bitmap.getColor(x, y);
|
|
|
|
if (color[y][x] != SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00)) {
|
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!success) {
|
|
|
|
static_assert(kWidth == 2);
|
|
|
|
static_assert(kHeight == 2);
|
|
|
|
ERRORF(r, "Expected: solid green. Actual:\n"
|
|
|
|
"RRGGBBAA RRGGBBAA\n"
|
|
|
|
"%02X%02X%02X%02X %02X%02X%02X%02X\n"
|
|
|
|
"%02X%02X%02X%02X %02X%02X%02X%02X",
|
|
|
|
SkColorGetR(color[0][0]), SkColorGetG(color[0][0]),
|
|
|
|
SkColorGetB(color[0][0]), SkColorGetA(color[0][0]),
|
|
|
|
|
|
|
|
SkColorGetR(color[0][1]), SkColorGetG(color[0][1]),
|
|
|
|
SkColorGetB(color[0][1]), SkColorGetA(color[0][1]),
|
|
|
|
|
|
|
|
SkColorGetR(color[1][0]), SkColorGetG(color[1][0]),
|
|
|
|
SkColorGetB(color[1][0]), SkColorGetA(color[1][0]),
|
|
|
|
|
|
|
|
SkColorGetR(color[1][1]), SkColorGetG(color[1][1]),
|
|
|
|
SkColorGetB(color[1][1]), SkColorGetA(color[1][1]));
|
|
|
|
}
|
2021-01-25 15:57:47 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 19:14:09 +00:00
|
|
|
static void test_permutations(skiatest::Reporter* r,
|
|
|
|
SkSurface* surface,
|
|
|
|
const char* testFile,
|
|
|
|
bool worksInES2) {
|
2021-07-02 14:17:45 +00:00
|
|
|
SkRuntimeEffect::Options options =
|
|
|
|
worksInES2 ? SkRuntimeEffect::Options{} : SkRuntimeEffectPriv::ES3Options();
|
2021-03-23 13:25:33 +00:00
|
|
|
options.forceNoInline = false;
|
2021-02-03 16:42:32 +00:00
|
|
|
test_one_permutation(r, surface, testFile, "", options);
|
2021-03-23 13:25:33 +00:00
|
|
|
|
|
|
|
options.forceNoInline = true;
|
|
|
|
test_one_permutation(r, surface, testFile, " (NoInline)", options);
|
2021-02-03 16:42:32 +00:00
|
|
|
}
|
|
|
|
|
2021-11-29 22:12:06 +00:00
|
|
|
static void test_cpu(skiatest::Reporter* r, const char* testFile, bool worksInES2) {
|
2021-09-15 21:42:42 +00:00
|
|
|
const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
|
2021-01-25 15:57:47 +00:00
|
|
|
sk_sp<SkSurface> surface(SkSurface::MakeRaster(info));
|
|
|
|
|
2021-11-29 22:12:06 +00:00
|
|
|
test_permutations(r, surface.get(), testFile, worksInES2);
|
2021-01-25 15:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_gpu(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
|
2021-09-15 21:42:42 +00:00
|
|
|
const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
|
2021-01-25 15:57:47 +00:00
|
|
|
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
|
|
|
|
|
2021-04-28 19:14:09 +00:00
|
|
|
test_permutations(r, surface.get(), testFile, /*worksInES2=*/true);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_es3(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
|
2021-08-18 16:17:21 +00:00
|
|
|
if (!ctx->priv().caps()->shaderCaps()->supportsSkSLES3()) {
|
2021-04-28 19:14:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ES3-only tests never run on the CPU, because SkVM lacks support for many non-ES2 features.
|
2021-09-15 21:42:42 +00:00
|
|
|
const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
|
2021-04-28 19:14:09 +00:00
|
|
|
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
|
|
|
|
|
|
|
|
test_permutations(r, surface.get(), testFile, /*worksInES2=*/false);
|
2021-01-25 15:57:47 +00:00
|
|
|
}
|
|
|
|
|
2022-02-03 19:51:02 +00:00
|
|
|
static void test_clone(skiatest::Reporter* r, const char* testFile) {
|
|
|
|
SkString shaderString = load_source(r, testFile, "");
|
|
|
|
if (shaderString.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::unique_ptr<SkSL::ShaderCaps> caps = SkSL::ShaderCapsFactory::Standalone();
|
|
|
|
SkSL::Program::Settings settings;
|
|
|
|
settings.fAllowVarDeclarationCloneForTesting = true;
|
|
|
|
SkSL::Compiler compiler(caps.get());
|
|
|
|
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
|
|
|
|
SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
|
|
|
|
if (!program) {
|
|
|
|
ERRORF(r, "%s", compiler.errorText().c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Starting DSL allows us to get access to the ThreadContext::Settings
|
|
|
|
SkSL::dsl::Start(&compiler, SkSL::ProgramKind::kFragment, settings);
|
|
|
|
for (const std::unique_ptr<SkSL::ProgramElement>& element : program->fOwnedElements) {
|
|
|
|
std::string original = element->description();
|
|
|
|
std::string cloned = element->clone()->description();
|
|
|
|
REPORTER_ASSERT(r, original == cloned,
|
|
|
|
"Mismatch after clone!\nOriginal: %s\nCloned: %s\n", original.c_str(),
|
|
|
|
cloned.c_str());
|
|
|
|
}
|
|
|
|
SkSL::dsl::End();
|
|
|
|
}
|
|
|
|
|
2022-02-01 15:23:17 +00:00
|
|
|
static void test_rehydrate(skiatest::Reporter* r, const char* testFile) {
|
|
|
|
SkString shaderString = load_source(r, testFile, "");
|
|
|
|
if (shaderString.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::unique_ptr<SkSL::ShaderCaps> caps = SkSL::ShaderCapsFactory::Default();
|
|
|
|
SkSL::Compiler compiler(caps.get());
|
|
|
|
SkSL::Program::Settings settings;
|
|
|
|
// Inlining causes problems because it can create expressions like bool(1) that can't be
|
|
|
|
// directly instantiated. After a dehydrate/recycle pass, that expression simply becomes "true"
|
|
|
|
// due to optimization - which is fine, but would cause us to fail an equality comparison. We
|
|
|
|
// disable inlining to avoid this issue.
|
|
|
|
settings.fInlineThreshold = 0;
|
|
|
|
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
|
|
|
|
SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
|
|
|
|
if (!program) {
|
|
|
|
ERRORF(r, "%s", compiler.errorText().c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SkSL::Dehydrator dehydrator;
|
2022-02-03 21:03:17 +00:00
|
|
|
dehydrator.write(*program);
|
2022-02-01 15:23:17 +00:00
|
|
|
SkSL::StringStream stream;
|
|
|
|
dehydrator.finish(stream);
|
|
|
|
|
|
|
|
SkSL::Rehydrator rehydrator(compiler, (const uint8_t*) stream.str().data(),
|
|
|
|
stream.str().length());
|
2022-02-03 21:03:17 +00:00
|
|
|
std::unique_ptr<SkSL::Program> rehydrated = rehydrator.program(&program->fSharedElements);
|
2022-02-01 15:23:17 +00:00
|
|
|
REPORTER_ASSERT(r, rehydrated->description() == program->description(),
|
|
|
|
"Mismatch between original and dehydrated/rehydrated:\n-- Original:\n%s\n"
|
|
|
|
"-- Rehydrated:\n%s", program->description().c_str(),
|
|
|
|
rehydrated->description().c_str());
|
|
|
|
}
|
|
|
|
|
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) \
|
2021-01-25 15:57:47 +00:00
|
|
|
DEF_TEST(name ## _CPU, r) { \
|
2021-11-29 22:12:06 +00:00
|
|
|
test_cpu(r, path, true); \
|
|
|
|
}
|
|
|
|
// The CPU backend lacks support for MANY ES3 features. However, if you know a test uses a subset
|
|
|
|
// of ES3 that is supported, you can force it to run there:
|
|
|
|
#define SKSL_TEST_CPU_ES3(name, path) \
|
|
|
|
DEF_TEST(name ## _CPU, r) { \
|
|
|
|
test_cpu(r, path, false); \
|
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) \
|
2021-01-25 15:57:47 +00:00
|
|
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
|
|
|
|
test_gpu(r, ctxInfo.directContext(), path); \
|
|
|
|
}
|
2021-04-28 19:14:09 +00:00
|
|
|
#define SKSL_TEST_ES3(name, path) \
|
|
|
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
|
|
|
|
test_es3(r, ctxInfo.directContext(), path); \
|
|
|
|
}
|
2022-02-01 15:23:17 +00:00
|
|
|
#define SKSL_TEST_REHYDRATE(name, path) \
|
|
|
|
DEF_TEST(name ## _REHYDRATE, r) { \
|
|
|
|
test_rehydrate(r, path); \
|
|
|
|
}
|
2021-11-17 20:48:18 +00:00
|
|
|
|
2022-02-03 19:51:02 +00:00
|
|
|
#define SKSL_TEST_CLONE(name, path) \
|
|
|
|
DEF_TEST(name ## _CLONE, r) { \
|
|
|
|
test_clone(r, path); \
|
|
|
|
}
|
|
|
|
|
2022-02-01 15:23:17 +00:00
|
|
|
#define SKSL_TEST(name, path) SKSL_TEST_CPU(name, path) SKSL_TEST_GPU(name, path) \
|
2022-02-03 19:51:02 +00:00
|
|
|
SKSL_TEST_CLONE(name, path) SKSL_TEST_REHYDRATE(name, path)
|
2021-01-25 15:57:47 +00:00
|
|
|
|
2021-10-12 20:53:24 +00:00
|
|
|
SKSL_TEST(SkSLArraySizeFolding, "folding/ArraySizeFolding.sksl")
|
2021-02-09 15:38:59 +00:00
|
|
|
SKSL_TEST(SkSLAssignmentOps, "folding/AssignmentOps.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLBoolFolding, "folding/BoolFolding.sksl")
|
2021-05-07 15:16:26 +00:00
|
|
|
SKSL_TEST(SkSLCastFolding, "folding/CastFolding.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLIntFoldingES2, "folding/IntFoldingES2.sksl")
|
2021-04-28 19:14:09 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntFoldingES3, "folding/IntFoldingES3.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLFloatFolding, "folding/FloatFolding.sksl")
|
2022-01-27 14:33:58 +00:00
|
|
|
SKSL_TEST(SkSLMatrixFoldingES2, "folding/MatrixFoldingES2.sksl")
|
2021-11-02 19:43:25 +00:00
|
|
|
SKSL_TEST_ES3(SkSLMatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
|
2021-02-10 15:19:27 +00:00
|
|
|
SKSL_TEST(SkSLSelfAssignment, "folding/SelfAssignment.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.sksl")
|
2022-01-12 21:36:02 +00:00
|
|
|
SKSL_TEST(SkSLSwitchCaseFolding, "folding/SwitchCaseFolding.sksl")
|
2021-04-29 15:14:38 +00:00
|
|
|
SKSL_TEST(SkSLSwizzleFolding, "folding/SwizzleFolding.sksl")
|
2021-03-04 15:19:48 +00:00
|
|
|
SKSL_TEST(SkSLVectorScalarFolding, "folding/VectorScalarFolding.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLVectorVectorFolding, "folding/VectorVectorFolding.sksl")
|
|
|
|
|
2021-05-20 01:42:57 +00:00
|
|
|
SKSL_TEST_ES3(SkSLDoWhileBodyMustBeInlinedIntoAScope,
|
|
|
|
"inliner/DoWhileBodyMustBeInlinedIntoAScope.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLDoWhileTestCannotBeInlined, "inliner/DoWhileTestCannotBeInlined.sksl")
|
2021-03-25 21:04:36 +00:00
|
|
|
SKSL_TEST(SkSLForBodyMustBeInlinedIntoAScope, "inliner/ForBodyMustBeInlinedIntoAScope.sksl")
|
2021-04-28 19:14:09 +00:00
|
|
|
SKSL_TEST_ES3(SkSLForInitializerExpressionsCanBeInlined,
|
|
|
|
"inliner/ForInitializerExpressionsCanBeInlined.sksl")
|
2021-03-25 21:04:36 +00:00
|
|
|
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(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")
|
2021-12-02 19:02:49 +00:00
|
|
|
SKSL_TEST_ES3(SkSLStaticSwitchInline, "inliner/StaticSwitch.sksl")
|
2021-03-25 21:04:36 +00:00
|
|
|
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")
|
2021-04-28 19:14:09 +00:00
|
|
|
SKSL_TEST_ES3(SkSLWhileBodyMustBeInlinedIntoAScope,
|
|
|
|
"inliner/WhileBodyMustBeInlinedIntoAScope.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLWhileTestCannotBeInlined, "inliner/WhileTestCannotBeInlined.sksl")
|
2021-03-17 17:20:10 +00:00
|
|
|
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
|
2022-02-03 21:36:12 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicAbsInt, "intrinsics/AbsInt.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl")
|
2021-08-19 14:16:35 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicDeterminant, "intrinsics/Determinant.sksl")
|
2021-08-13 15:43:21 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicDFdx, "intrinsics/DFdx.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicDFdy, "intrinsics/DFdy.sksl")
|
2021-08-20 14:10:02 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl")
|
2021-09-16 00:24:24 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicFwidth, "intrinsics/Fwidth.sksl")
|
2021-08-20 14:10:02 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicIntBitsToFloat, "intrinsics/IntBitsToFloat.sksl")
|
2021-08-25 17:54:34 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicIsInf, "intrinsics/IsInf.sksl")
|
2021-11-10 22:20:21 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicClampInt, "intrinsics/ClampInt.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicClampUInt, "intrinsics/ClampUInt.sksl")
|
2022-02-03 21:36:12 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicClampFloat, "intrinsics/ClampFloat.sksl")
|
2021-09-14 17:09:36 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicMatrixCompMultES2, "intrinsics/MatrixCompMultES2.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicMatrixCompMultES3, "intrinsics/MatrixCompMultES3.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicMaxFloat, "intrinsics/MaxFloat.sksl")
|
2022-02-03 21:36:12 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicMaxInt, "intrinsics/MaxInt.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicMinFloat, "intrinsics/MinFloat.sksl")
|
2022-02-03 21:36:12 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicMinInt, "intrinsics/MinInt.sksl")
|
|
|
|
SKSL_TEST(SkSLIntrinsicMixFloat, "intrinsics/MixFloat.sksl")
|
2021-09-08 17:14:14 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicModf, "intrinsics/Modf.sksl")
|
2021-09-10 13:53:19 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicOuterProduct, "intrinsics/OuterProduct.sksl")
|
2021-09-09 13:59:14 +00:00
|
|
|
// Fails on Mac OpenGL + Radeon 5300M (skia:12434)
|
|
|
|
//SKSL_TEST_ES3(SkSLIntrinsicPackUnorm2x16, "intrinsics/PackUnorm2x16.sksl")
|
2021-08-23 15:00:10 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicRound, "intrinsics/Round.sksl")
|
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicRoundEven, "intrinsics/RoundEven.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicSignFloat, "intrinsics/SignFloat.sksl")
|
2022-02-02 23:05:38 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicSignInt, "intrinsics/SignInt.sksl")
|
2021-05-25 15:48:30 +00:00
|
|
|
SKSL_TEST(SkSLIntrinsicStep, "intrinsics/Step.sksl")
|
2021-08-23 15:00:10 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicTrunc, "intrinsics/Trunc.sksl")
|
2021-08-17 19:08:46 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicTranspose, "intrinsics/Transpose.sksl")
|
2021-08-25 17:54:34 +00:00
|
|
|
SKSL_TEST_ES3(SkSLIntrinsicUintBitsToFloat, "intrinsics/UintBitsToFloat.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
|
2021-08-05 14:55:03 +00:00
|
|
|
SKSL_TEST_ES3(SkSLArrayNarrowingConversions, "runtime/ArrayNarrowingConversions.rts")
|
2021-11-12 13:45:31 +00:00
|
|
|
SKSL_TEST(SkSLLoopFloat, "runtime/LoopFloat.rts")
|
|
|
|
SKSL_TEST(SkSLLoopInt, "runtime/LoopInt.rts")
|
2021-10-01 18:21:09 +00:00
|
|
|
SKSL_TEST(SkSLQualifierOrder, "runtime/QualifierOrder.rts")
|
2021-10-01 17:59:20 +00:00
|
|
|
SKSL_TEST(SkSLPrecisionQualifiers, "runtime/PrecisionQualifiers.rts")
|
2021-11-17 20:48:18 +00:00
|
|
|
SKSL_TEST_CPU_ES3(SkSLRecursiveComparison_Arrays, "runtime/RecursiveComparison_Arrays.rts")
|
2022-02-02 16:59:34 +00:00
|
|
|
SKSL_TEST_CPU_ES3(SkSLRecursiveComparison_Structs, "runtime/RecursiveComparison_Structs.rts")
|
2021-11-17 20:48:18 +00:00
|
|
|
SKSL_TEST_CPU_ES3(SkSLRecursiveComparison_Types, "runtime/RecursiveComparison_Types.rts")
|
2022-02-02 16:59:34 +00:00
|
|
|
SKSL_TEST_CPU_ES3(SkSLRecursiveComparison_Vectors, "runtime/RecursiveComparison_Vectors.rts")
|
2021-08-05 14:55:03 +00:00
|
|
|
|
Reland "Implement operator== and != for Metal structs and arrays."
This is a reland of 830c69ca66d339067cdc06775f59443a06fc15a2
Original change's description:
> Implement operator== and != for Metal structs and arrays.
>
> GLSL/SkSL assumes that == and != on struct/array types should work.
> We need to emit equality and inequality operators whenever we find code
> that compares a struct or array.
>
> Structs and arrays can be arbitrarily nested, and either type can
> contain a matrix. All of these things need custom equality operators in
> Metal. Therefore, we need to recursively generate comparison operators
> when any of these types are encountered.
>
> For arrays we get lucky, and we can cover all possible array types and
> sizes with a single templated operator== method. Structs and matrices
> have no such luck, and are generated separately on a per-type basis.
>
> For each of these types, operator== is implemented as an equality check
> on each field, and operator!= is implemented in terms of operator==.
> Equality and inequality are always emitted together. (Previously, matrix
> equality and inequality were emitted and implemented independently, but
> this is no longer the case.)
>
> Change-Id: I69ee01c0a390d7db6bcb2253ed6336ab20cc4d1d
> Bug: skia:11908, skia:11924
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402016
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:11908, skia:11924, skia:11929
Change-Id: I6336b6125e9774c1ca73e3d497e3466f11f6f25f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402559
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-29 18:39:35 +00:00
|
|
|
SKSL_TEST_ES3(SkSLArrayComparison, "shared/ArrayComparison.sksl")
|
2021-05-17 13:59:02 +00:00
|
|
|
SKSL_TEST_ES3(SkSLArrayConstructors, "shared/ArrayConstructors.sksl")
|
Add support for array-cast syntax in SkSL.
Compiling a program with "allow narrowing conversions" actually fixes up
narrowing casts in the program by inserting casts wherever they would be
needed for type-correctness. For instance, compiling the statement
`half h = myFloat;`
inserts an appropriate narrowing cast:
`half h = half(myFloat);`.
The Pipeline stage code generator relies on this behavior, as when it
re-emits a runtime effect into a complete SkSL program, the narrowing-
conversions flag will no longer be set, but that is okay, because the
emitted code now contains typecasts anywhere they would be necessary.
Logically, this implies that anything which supports narrowing
conversions must be castable between high and low precision. In GLSL and
SPIR-V, such a cast is trivial, because the types are the same and the
precision qualifiers are treated as individual hints on each variable.
In Metal, we dodge the issue by only emitting full-precision types. But
we also need to emit raw SkSL from an SkSL program (that is what the
Pipeline stage generator does).
SkSL already supported every typical cast, but GLSL lacked any syntax
for casting an array to a different type. This meant SkSL had no array
casting syntax as well. SkSL now has array-cast syntax, but it is only
allowed for casting low/high-precision arrays to the same base type.
(You can't cast an int array to float, or a signed array to unsigned.)
Change-Id: Ia20933541c3bd4a946c1ea38209f93008acdb9cb
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437687
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-10 20:03:44 +00:00
|
|
|
SKSL_TEST_ES3(SkSLArrayCast, "shared/ArrayCast.sksl")
|
2021-08-25 15:54:16 +00:00
|
|
|
SKSL_TEST_ES3(SkSLArrayFollowedByScalar, "shared/ArrayFollowedByScalar.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLArrayTypes, "shared/ArrayTypes.sksl")
|
|
|
|
SKSL_TEST(SkSLAssignment, "shared/Assignment.sksl")
|
|
|
|
SKSL_TEST(SkSLCastsRoundTowardZero, "shared/CastsRoundTowardZero.sksl")
|
|
|
|
SKSL_TEST(SkSLCommaMixedTypes, "shared/CommaMixedTypes.sksl")
|
2022-01-31 20:57:01 +00:00
|
|
|
SKSL_TEST(SkSLCommaSideEffects, "shared/CommaSideEffects.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLConstantIf, "shared/ConstantIf.sksl")
|
2021-05-14 11:55:45 +00:00
|
|
|
SKSL_TEST_ES3(SkSLConstArray, "shared/ConstArray.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLConstVariableComparison, "shared/ConstVariableComparison.sksl")
|
2021-11-02 19:43:25 +00:00
|
|
|
SKSL_TEST_ES3(SkSLDeadLoopVariable, "shared/DeadLoopVariable.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLDeadIfStatement, "shared/DeadIfStatement.sksl")
|
2021-05-17 18:46:05 +00:00
|
|
|
SKSL_TEST(SkSLDeadReturn, "shared/DeadReturn.sksl")
|
2021-05-20 19:30:22 +00:00
|
|
|
// TODO(skia:12012): some Radeons crash when compiling this code; disable them
|
|
|
|
//SKSL_TEST_ES3(SkSLDeadReturnES3, "shared/DeadReturnES3.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLDeadStripFunctions, "shared/DeadStripFunctions.sksl")
|
|
|
|
SKSL_TEST(SkSLDependentInitializers, "shared/DependentInitializers.sksl")
|
2021-05-20 01:42:57 +00:00
|
|
|
SKSL_TEST_ES3(SkSLDoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLEmptyBlocksES2, "shared/EmptyBlocksES2.sksl")
|
2021-11-02 19:43:25 +00:00
|
|
|
SKSL_TEST_ES3(SkSLEmptyBlocksES3, "shared/EmptyBlocksES3.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
|
2021-12-28 19:36:34 +00:00
|
|
|
SKSL_TEST(SkSLFunctionAnonymousParameters, "shared/FunctionAnonymousParameters.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLFunctionArgTypeMatch, "shared/FunctionArgTypeMatch.sksl")
|
|
|
|
SKSL_TEST(SkSLFunctionReturnTypeMatch, "shared/FunctionReturnTypeMatch.sksl")
|
|
|
|
SKSL_TEST(SkSLFunctions, "shared/Functions.sksl")
|
2021-07-21 19:19:34 +00:00
|
|
|
SKSL_TEST(SkSLFunctionPrototype, "shared/FunctionPrototype.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLGeometricIntrinsics, "shared/GeometricIntrinsics.sksl")
|
|
|
|
SKSL_TEST(SkSLHelloWorld, "shared/HelloWorld.sksl")
|
|
|
|
SKSL_TEST(SkSLHex, "shared/Hex.sksl")
|
2021-11-02 19:43:25 +00:00
|
|
|
SKSL_TEST_ES3(SkSLHexUnsigned, "shared/HexUnsigned.sksl")
|
2022-01-25 20:54:24 +00:00
|
|
|
SKSL_TEST(SkSLInoutParameters, "shared/InoutParameters.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLMatrices, "shared/Matrices.sksl")
|
2021-05-14 21:53:03 +00:00
|
|
|
SKSL_TEST_ES3(SkSLMatricesNonsquare, "shared/MatricesNonsquare.sksl")
|
2021-11-29 22:12:06 +00:00
|
|
|
// TODO(skia:12443) These tests actually don't work on MANY devices. The GLSL conformance suite
|
|
|
|
// does a terrible job of enforcing this rule. We still test them on CPU.
|
|
|
|
SKSL_TEST_CPU(SkSLMatrixConstructorsES2, "shared/MatrixConstructorsES2.sksl")
|
|
|
|
SKSL_TEST_CPU_ES3(SkSLMatrixConstructorsES3, "shared/MatrixConstructorsES3.sksl")
|
2021-02-10 17:21:51 +00:00
|
|
|
SKSL_TEST(SkSLMatrixEquality, "shared/MatrixEquality.sksl")
|
2022-01-13 18:53:00 +00:00
|
|
|
SKSL_TEST(SkSLMatrixScalarMath, "shared/MatrixScalarMath.sksl")
|
2021-07-09 16:41:55 +00:00
|
|
|
SKSL_TEST(SkSLMatrixToVectorCast, "shared/MatrixToVectorCast.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLMultipleAssignments, "shared/MultipleAssignments.sksl")
|
2021-08-30 19:47:00 +00:00
|
|
|
SKSL_TEST(SkSLNegation, "shared/Negation.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLNumberCasts, "shared/NumberCasts.sksl")
|
|
|
|
SKSL_TEST(SkSLOperatorsES2, "shared/OperatorsES2.sksl")
|
2021-05-17 13:59:02 +00:00
|
|
|
SKSL_TEST_ES3(SkSLOperatorsES3, "shared/OperatorsES3.sksl")
|
2021-08-05 15:49:05 +00:00
|
|
|
SKSL_TEST(SkSLOssfuzz36852, "shared/Ossfuzz36852.sksl")
|
2022-01-31 16:14:07 +00:00
|
|
|
SKSL_TEST(SkSLOutParams, "shared/OutParams.sksl")
|
2022-01-31 19:35:08 +00:00
|
|
|
SKSL_TEST(SkSLOutParamsAreDistinct, "shared/OutParamsAreDistinct.sksl")
|
2022-01-31 16:14:07 +00:00
|
|
|
SKSL_TEST(SkSLOutParamsTricky, "shared/OutParamsTricky.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLResizeMatrix, "shared/ResizeMatrix.sksl")
|
2021-11-03 13:16:58 +00:00
|
|
|
SKSL_TEST_ES3(SkSLResizeMatrixNonsquare, "shared/ResizeMatrixNonsquare.sksl")
|
2021-03-04 21:00:20 +00:00
|
|
|
SKSL_TEST(SkSLReturnsValueOnEveryPathES2, "shared/ReturnsValueOnEveryPathES2.sksl")
|
2021-11-03 13:16:58 +00:00
|
|
|
SKSL_TEST_ES3(SkSLReturnsValueOnEveryPathES3, "shared/ReturnsValueOnEveryPathES3.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLScalarConversionConstructorsES2, "shared/ScalarConversionConstructorsES2.sksl")
|
2021-10-12 20:53:52 +00:00
|
|
|
SKSL_TEST(SkSLScopedSymbol, "shared/ScopedSymbol.sksl")
|
2021-05-17 18:49:05 +00:00
|
|
|
SKSL_TEST_ES3(SkSLScalarConversionConstructorsES3, "shared/ScalarConversionConstructorsES3.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLStackingVectorCasts, "shared/StackingVectorCasts.sksl")
|
|
|
|
SKSL_TEST(SkSLStaticIf, "shared/StaticIf.sksl")
|
2021-12-02 19:02:49 +00:00
|
|
|
SKSL_TEST_ES3(SkSLStaticSwitch, "shared/StaticSwitch.sksl")
|
2021-08-25 16:01:21 +00:00
|
|
|
SKSL_TEST(SkSLStructArrayFollowedByScalar, "shared/StructArrayFollowedByScalar.sksl")
|
Reland "Implement operator== and != for Metal structs and arrays."
This is a reland of 830c69ca66d339067cdc06775f59443a06fc15a2
Original change's description:
> Implement operator== and != for Metal structs and arrays.
>
> GLSL/SkSL assumes that == and != on struct/array types should work.
> We need to emit equality and inequality operators whenever we find code
> that compares a struct or array.
>
> Structs and arrays can be arbitrarily nested, and either type can
> contain a matrix. All of these things need custom equality operators in
> Metal. Therefore, we need to recursively generate comparison operators
> when any of these types are encountered.
>
> For arrays we get lucky, and we can cover all possible array types and
> sizes with a single templated operator== method. Structs and matrices
> have no such luck, and are generated separately on a per-type basis.
>
> For each of these types, operator== is implemented as an equality check
> on each field, and operator!= is implemented in terms of operator==.
> Equality and inequality are always emitted together. (Previously, matrix
> equality and inequality were emitted and implemented independently, but
> this is no longer the case.)
>
> Change-Id: I69ee01c0a390d7db6bcb2253ed6336ab20cc4d1d
> Bug: skia:11908, skia:11924
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402016
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:11908, skia:11924, skia:11929
Change-Id: I6336b6125e9774c1ca73e3d497e3466f11f6f25f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402559
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-29 18:39:35 +00:00
|
|
|
SKSL_TEST(SkSLStructsInFunctions, "shared/StructsInFunctions.sksl")
|
2021-09-25 14:33:00 +00:00
|
|
|
SKSL_TEST(SkSLSwitch, "shared/Switch.sksl")
|
|
|
|
SKSL_TEST(SkSLSwitchDefaultOnly, "shared/SwitchDefaultOnly.sksl")
|
|
|
|
SKSL_TEST(SkSLSwitchWithFallthrough, "shared/SwitchWithFallthrough.sksl")
|
|
|
|
SKSL_TEST(SkSLSwitchWithLoops, "shared/SwitchWithLoops.sksl")
|
2021-02-05 14:31:21 +00:00
|
|
|
SKSL_TEST(SkSLSwizzleBoolConstants, "shared/SwizzleBoolConstants.sksl")
|
2021-02-05 21:24:03 +00:00
|
|
|
SKSL_TEST(SkSLSwizzleByConstantIndex, "shared/SwizzleByConstantIndex.sksl")
|
2021-11-03 13:16:58 +00:00
|
|
|
SKSL_TEST_ES3(SkSLSwizzleByIndex, "shared/SwizzleByIndex.sksl")
|
2021-02-05 21:24:03 +00:00
|
|
|
SKSL_TEST(SkSLSwizzleConstants, "shared/SwizzleConstants.sksl")
|
|
|
|
SKSL_TEST(SkSLSwizzleLTRB, "shared/SwizzleLTRB.sksl")
|
|
|
|
SKSL_TEST(SkSLSwizzleOpt, "shared/SwizzleOpt.sksl")
|
|
|
|
SKSL_TEST(SkSLSwizzleScalar, "shared/SwizzleScalar.sksl")
|
2021-07-12 19:05:54 +00:00
|
|
|
SKSL_TEST(SkSLSwizzleScalarBool, "shared/SwizzleScalarBool.sksl")
|
2021-07-12 18:59:19 +00:00
|
|
|
SKSL_TEST(SkSLSwizzleScalarInt, "shared/SwizzleScalarInt.sksl")
|
2021-02-08 19:20:28 +00:00
|
|
|
SKSL_TEST(SkSLTernaryAsLValueEntirelyFoldable, "shared/TernaryAsLValueEntirelyFoldable.sksl")
|
|
|
|
SKSL_TEST(SkSLTernaryAsLValueFoldableTest, "shared/TernaryAsLValueFoldableTest.sksl")
|
2021-03-05 20:22:48 +00:00
|
|
|
SKSL_TEST(SkSLTernaryExpression, "shared/TernaryExpression.sksl")
|
2021-02-08 19:20:28 +00:00
|
|
|
SKSL_TEST(SkSLUnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
|
2021-10-04 21:02:16 +00:00
|
|
|
SKSL_TEST(SkSLUniformArray, "shared/UniformArray.sksl")
|
2021-02-08 19:20:28 +00:00
|
|
|
SKSL_TEST(SkSLUnusedVariables, "shared/UnusedVariables.sksl")
|
|
|
|
SKSL_TEST(SkSLVectorConstructors, "shared/VectorConstructors.sksl")
|
2021-07-08 22:20:21 +00:00
|
|
|
SKSL_TEST(SkSLVectorToMatrixCast, "shared/VectorToMatrixCast.sksl")
|
2022-01-27 18:37:24 +00:00
|
|
|
SKSL_TEST(SkSLVectorScalarMath, "shared/VectorScalarMath.sksl")
|
2021-05-17 13:59:02 +00:00
|
|
|
SKSL_TEST_ES3(SkSLWhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
|