Re-added SkSL REHYDRATE flag
The REHYDRATE flag was removed at some point, but it was a useful means of temporarily disabling rehydration for debugging and the like. Change-Id: I28f7fbaed6003f384509f5848e8bbf4f06697bc9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491440 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
576de89810
commit
eb12454f57
@ -57,13 +57,13 @@
|
|||||||
#include "spirv-tools/libspirv.hpp"
|
#include "spirv-tools/libspirv.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SKSL_STANDALONE)
|
#ifdef SKSL_STANDALONE
|
||||||
|
#define REHYDRATE 0
|
||||||
// In standalone mode, we load the textual sksl source files. GN generates or copies these files
|
|
||||||
// to the skslc executable directory. The "data" in this mode is just the filename.
|
|
||||||
#define MODULE_DATA(name) MakeModulePath("sksl_" #name ".sksl")
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
#define REHYDRATE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if REHYDRATE
|
||||||
|
|
||||||
// At runtime, we load the dehydrated sksl data files. The data is a (pointer, size) pair.
|
// At runtime, we load the dehydrated sksl data files. The data is a (pointer, size) pair.
|
||||||
#include "src/sksl/generated/sksl_frag.dehydrated.sksl"
|
#include "src/sksl/generated/sksl_frag.dehydrated.sksl"
|
||||||
@ -75,6 +75,12 @@
|
|||||||
#define MODULE_DATA(name) MakeModuleData(SKSL_INCLUDE_sksl_##name,\
|
#define MODULE_DATA(name) MakeModuleData(SKSL_INCLUDE_sksl_##name,\
|
||||||
SKSL_INCLUDE_sksl_##name##_LENGTH)
|
SKSL_INCLUDE_sksl_##name##_LENGTH)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// In standalone mode, we load the textual sksl source files. GN generates or copies these files
|
||||||
|
// to the skslc executable directory. The "data" in this mode is just the filename.
|
||||||
|
#define MODULE_DATA(name) MakeModulePath("sksl_" #name ".sksl")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace SkSL {
|
namespace SkSL {
|
||||||
@ -324,7 +330,16 @@ LoadedModule Compiler::loadModule(ProgramKind kind,
|
|||||||
Program::Settings settings;
|
Program::Settings settings;
|
||||||
settings.fReplaceSettings = !dehydrate;
|
settings.fReplaceSettings = !dehydrate;
|
||||||
|
|
||||||
#if defined(SKSL_STANDALONE)
|
#if REHYDRATE
|
||||||
|
ProgramConfig config;
|
||||||
|
config.fIsBuiltinCode = true;
|
||||||
|
config.fKind = kind;
|
||||||
|
config.fSettings = settings;
|
||||||
|
AutoProgramConfig autoConfig(fContext, &config);
|
||||||
|
SkASSERT(data.fData && (data.fSize != 0));
|
||||||
|
Rehydrator rehydrator(fContext.get(), base, data.fData, data.fSize);
|
||||||
|
LoadedModule result = { kind, rehydrator.symbolTable(), rehydrator.elements() };
|
||||||
|
#else
|
||||||
SkASSERT(this->errorCount() == 0);
|
SkASSERT(this->errorCount() == 0);
|
||||||
SkASSERT(data.fPath);
|
SkASSERT(data.fPath);
|
||||||
std::ifstream in(data.fPath);
|
std::ifstream in(data.fPath);
|
||||||
@ -340,15 +355,6 @@ LoadedModule Compiler::loadModule(ProgramKind kind,
|
|||||||
printf("Unexpected errors: %s\n", this->fErrorText.c_str());
|
printf("Unexpected errors: %s\n", this->fErrorText.c_str());
|
||||||
SkDEBUGFAILF("%s %s\n", data.fPath, this->fErrorText.c_str());
|
SkDEBUGFAILF("%s %s\n", data.fPath, this->fErrorText.c_str());
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
ProgramConfig config;
|
|
||||||
config.fIsBuiltinCode = true;
|
|
||||||
config.fKind = kind;
|
|
||||||
config.fSettings = settings;
|
|
||||||
AutoProgramConfig autoConfig(fContext, &config);
|
|
||||||
SkASSERT(data.fData && (data.fSize != 0));
|
|
||||||
Rehydrator rehydrator(fContext.get(), base, data.fData, data.fSize);
|
|
||||||
LoadedModule result = { kind, rehydrator.symbolTable(), rehydrator.elements() };
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user