Revert "Added tests for sksl clone() on our test corpus"
This reverts commit 0c9b8bae42
.
Reason for revert: breaking bots, apparently due to use-after-free?
Could be a real clone bug...!
http://screen/9NenpjnYNoDU58G
Original change's description:
> Added tests for sksl clone() on our test corpus
>
> Change-Id: I9022a6aa53b039e5aec2ceeb0062d536e5e278c9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/496601
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: Ida8978a38ac24081895cd97a62718b6ec94f57c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497777
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
parent
ca2980bf0d
commit
63a4d65e16
@ -22,7 +22,6 @@
|
||||
#include "src/core/SkRuntimeEffectPriv.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrDirectContextPriv.h"
|
||||
#include "src/sksl/SkSLCompiler.h"
|
||||
#include "tests/Test.h"
|
||||
#include "tools/Resources.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
@ -46,27 +45,19 @@ static void set_uniform_array(SkRuntimeShaderBuilder* builder, const char* name,
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
|
||||
return SkString("");
|
||||
}
|
||||
return SkString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
|
||||
}
|
||||
|
||||
static void test_one_permutation(skiatest::Reporter* r,
|
||||
SkSurface* surface,
|
||||
const char* testFile,
|
||||
const char* permutationSuffix,
|
||||
const SkRuntimeEffect::Options& options) {
|
||||
SkString shaderString = load_source(r, testFile, permutationSuffix);
|
||||
if (shaderString.isEmpty()) {
|
||||
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::MakeForShader(shaderString, options);
|
||||
if (!result.effect) {
|
||||
ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
|
||||
@ -180,29 +171,6 @@ static void test_es3(skiatest::Reporter* r, GrDirectContext* ctx, const char* te
|
||||
test_permutations(r, surface.get(), testFile, /*worksInES2=*/false);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
for (const std::unique_ptr<SkSL::ProgramElement>& element : program->fOwnedElements) {
|
||||
SkSL::String original = element->description();
|
||||
SkSL::String cloned = element->clone()->description();
|
||||
REPORTER_ASSERT(r, original == cloned,
|
||||
"Mismatch after clone!\nOriginal: %s\nCloned: %s\n", original.c_str(),
|
||||
cloned.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
#define SKSL_TEST_CPU(name, path) \
|
||||
DEF_TEST(name ## _CPU, r) { \
|
||||
test_cpu(r, path, true); \
|
||||
@ -221,13 +189,8 @@ static void test_clone(skiatest::Reporter* r, const char* testFile) {
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name ## _GPU, r, ctxInfo) { \
|
||||
test_es3(r, ctxInfo.directContext(), path); \
|
||||
}
|
||||
#define SKSL_TEST_CLONE(name, path) \
|
||||
DEF_TEST(name ## _CLONE, r) { \
|
||||
test_clone(r, path); \
|
||||
}
|
||||
|
||||
#define SKSL_TEST(name, path) SKSL_TEST_CPU(name, path) SKSL_TEST_GPU(name, path) \
|
||||
SKSL_TEST_CLONE(name, path)
|
||||
#define SKSL_TEST(name, path) SKSL_TEST_CPU(name, path) SKSL_TEST_GPU(name, path)
|
||||
|
||||
SKSL_TEST(SkSLArraySizeFolding, "folding/ArraySizeFolding.sksl")
|
||||
SKSL_TEST(SkSLAssignmentOps, "folding/AssignmentOps.sksl")
|
||||
|
Loading…
Reference in New Issue
Block a user