Fixed SkSL dFdy rehydrate test

dFdy wasn't working due to the DSL never having been started.

Bug: skia:12985
Change-Id: Ic58018e3dec3e9df15c2e784f8732ee99e793353
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/513938
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2022-03-01 10:11:23 -05:00 committed by SkCQ
parent d6d3cabb49
commit 7b662215f9
2 changed files with 12 additions and 5 deletions

View File

@ -13,6 +13,7 @@
#include "include/private/SkSLModifiers.h" #include "include/private/SkSLModifiers.h"
#include "include/private/SkSLProgramElement.h" #include "include/private/SkSLProgramElement.h"
#include "include/private/SkSLStatement.h" #include "include/private/SkSLStatement.h"
#include "include/sksl/DSLCore.h"
#include "src/sksl/SkSLAnalysis.h" #include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLCompiler.h" #include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLThreadContext.h" #include "src/sksl/SkSLThreadContext.h"
@ -282,6 +283,7 @@ std::unique_ptr<Program> Rehydrator::program() {
ModifiersPool* oldModifiersPool = context.fModifiersPool; ModifiersPool* oldModifiersPool = context.fModifiersPool;
context.fConfig = config.get(); context.fConfig = config.get();
fSymbolTable = fCompiler.moduleForProgramKind(config->fKind).fSymbols; fSymbolTable = fCompiler.moduleForProgramKind(config->fKind).fSymbols;
dsl::Start(&fCompiler, config->fKind, config->fSettings);
auto modifiers = std::make_unique<ModifiersPool>(); auto modifiers = std::make_unique<ModifiersPool>();
context.fModifiersPool = modifiers.get(); context.fModifiersPool = modifiers.get();
this->symbolTable(); this->symbolTable();
@ -290,9 +292,15 @@ std::unique_ptr<Program> Rehydrator::program() {
context.fModifiersPool = oldModifiersPool; context.fModifiersPool = oldModifiersPool;
Program::Inputs inputs; Program::Inputs inputs;
inputs.fUseFlipRTUniform = this->readU8(); inputs.fUseFlipRTUniform = this->readU8();
return std::make_unique<Program>(nullptr, std::move(config), fCompiler.fContext, std::unique_ptr<Pool> pool = std::move(ThreadContext::MemoryPool());
std::move(elements), /*sharedElements=*/std::vector<const ProgramElement*>(), pool->detachFromThread();
std::move(modifiers), fSymbolTable, /*pool=*/nullptr, inputs); std::unique_ptr<Program> result = std::make_unique<Program>(nullptr, std::move(config),
fCompiler.fContext, std::move(elements),
/*sharedElements=*/std::vector<const ProgramElement*>(), std::move(modifiers),
fSymbolTable, std::move(pool), inputs);
fSymbolTable = fSymbolTable->fParent;
dsl::End();
return result;
} }
std::vector<std::unique_ptr<ProgramElement>> Rehydrator::elements() { std::vector<std::unique_ptr<ProgramElement>> Rehydrator::elements() {

View File

@ -357,8 +357,7 @@ SKSL_TEST_GPU_ES3(SkSLIntrinsicAbsInt, "intrinsics/AbsInt.sksl")
SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl") SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl")
SKSL_TEST_GPU_ES3(SkSLIntrinsicDeterminant, "intrinsics/Determinant.sksl") SKSL_TEST_GPU_ES3(SkSLIntrinsicDeterminant, "intrinsics/Determinant.sksl")
SKSL_TEST_GPU_ES3(SkSLIntrinsicDFdx, "intrinsics/DFdx.sksl") SKSL_TEST_GPU_ES3(SkSLIntrinsicDFdx, "intrinsics/DFdx.sksl")
// TODO(skia:12985): This test currently fails its REHYDRATE variant. SKSL_TEST_GPU_ES3(SkSLIntrinsicDFdy, "intrinsics/DFdy.sksl")
// SKSL_TEST_GPU_ES3(SkSLIntrinsicDFdy, "intrinsics/DFdy.sksl")
SKSL_TEST_GPU_ES3(SkSLIntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl") SKSL_TEST_GPU_ES3(SkSLIntrinsicFloatBitsToInt, "intrinsics/FloatBitsToInt.sksl")
SKSL_TEST_GPU_ES3(SkSLIntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl") SKSL_TEST_GPU_ES3(SkSLIntrinsicFloatBitsToUint, "intrinsics/FloatBitsToUint.sksl")
SKSL_TEST_GPU_ES3(SkSLIntrinsicFwidth, "intrinsics/Fwidth.sksl") SKSL_TEST_GPU_ES3(SkSLIntrinsicFwidth, "intrinsics/Fwidth.sksl")