Revert "Shuffle SkSL sources around so compiler and bytecode can be used w/o GPU"

This reverts commit 90507286cc.

Reason for revert: Seems to be breaking some builds

Original change's description:
> Shuffle SkSL sources around so compiler and bytecode can be used w/o GPU
> 
> Change-Id: I7236a30040ab532086e68d6e9de2898dd7acaa32
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221098
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,kjlubick@google.com,brianosman@google.com,ethannicholas@google.com,reed@google.com

Change-Id: Ie230315a72ebcfae32bc9ce7bafec1f87106cff2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221536
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2019-06-18 11:35:12 +00:00 committed by Skia Commit-Bot
parent 578c8ee076
commit 37a59ef1af
8 changed files with 24 additions and 58 deletions

View File

@ -501,7 +501,6 @@ if (skia_compile_processors) {
"src/sksl/SkSLMain.cpp",
]
sources += skia_sksl_sources
sources += skia_sksl_gpu_sources
include_dirs = [ "." ]
deps = [
":run_sksllex",
@ -579,8 +578,7 @@ optional("gpu") {
public_configs = []
public_deps = []
sources =
skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
if (!skia_enable_ccpr) {
sources -= skia_ccpr_sources
sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
@ -637,6 +635,11 @@ optional("gpu") {
}
}
if (skia_enable_spirv_validation) {
deps += [ "//third_party/spirv-tools" ]
public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
}
cflags_objcc = []
if (skia_use_metal) {
public_defines += [ "SK_METAL" ]
@ -913,7 +916,6 @@ component("skia") {
}
sources += skia_effects_sources
sources += skia_effects_imagefilter_sources
sources += skia_sksl_sources
sources += [
"src/android/SkAndroidFrameworkUtils.cpp",
"src/android/SkAnimatedImage.cpp",
@ -1044,11 +1046,6 @@ component("skia") {
if (is_fuchsia) {
sources += [ "src/ports/SkDebug_stdio.cpp" ]
}
if (skia_enable_spirv_validation) {
deps += [ "//third_party/spirv-tools" ]
defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
}
}
# DebugCanvas used in experimental/wasm-skp-debugger
@ -1145,16 +1142,6 @@ group("modules") {
]
}
executable("cpu_modules") {
sources = [
"tools/cpu_modules.cpp",
]
deps = [
":skia",
"modules/particles",
]
}
# Targets guarded by skia_enable_tools may use //third_party freely.
if (skia_enable_tools) {
skia_public_includes = [

View File

@ -12,10 +12,18 @@ skia_sksl_sources = [
"$_src/sksl/SkSLByteCodeGenerator.cpp",
"$_src/sksl/SkSLCFGGenerator.cpp",
"$_src/sksl/SkSLCompiler.cpp",
"$_src/sksl/SkSLCPPCodeGenerator.cpp",
"$_src/sksl/SkSLCPPUniformCTypes.cpp",
"$_src/sksl/SkSLGLSLCodeGenerator.cpp",
"$_src/sksl/SkSLHCodeGenerator.cpp",
"$_src/sksl/SkSLIRGenerator.cpp",
"$_src/sksl/SkSLJIT.cpp",
"$_src/sksl/SkSLLexer.cpp",
"$_src/sksl/SkSLMetalCodeGenerator.cpp",
"$_src/sksl/SkSLOutputStream.cpp",
"$_src/sksl/SkSLParser.cpp",
"$_src/sksl/SkSLPipelineStageCodeGenerator.cpp",
"$_src/sksl/SkSLSPIRVCodeGenerator.cpp",
"$_src/sksl/SkSLString.cpp",
"$_src/sksl/SkSLUtil.cpp",
"$_src/sksl/ir/SkSLSymbolTable.cpp",
@ -24,16 +32,7 @@ skia_sksl_sources = [
"$_src/sksl/ir/SkSLVariableReference.cpp",
]
skia_sksl_gpu_sources = [
"$_src/sksl/SkSLCPPCodeGenerator.cpp",
"$_src/sksl/SkSLCPPUniformCTypes.cpp",
"$_src/sksl/SkSLGLSLCodeGenerator.cpp",
"$_src/sksl/SkSLHCodeGenerator.cpp",
"$_src/sksl/SkSLMetalCodeGenerator.cpp",
"$_src/sksl/SkSLOutputStream.cpp",
"$_src/sksl/SkSLPipelineStageCodeGenerator.cpp",
"$_src/sksl/SkSLSPIRVCodeGenerator.cpp",
]
skia_sksl_gpu_sources = []
skia_gpu_processor_sources = [
"$_src/gpu/effects/GrAARectEffect.fp",

View File

@ -10,7 +10,6 @@
#include "modules/particles/include/SkReflected.h"
#include "include/core/SkString.h"
#include "include/private/SkTArray.h"
#include "src/utils/SkJSON.h"
#include "src/utils/SkJSONWriter.h"

View File

@ -15,9 +15,12 @@
#include "modules/particles/include/SkCurve.h"
#include "modules/particles/include/SkParticleData.h"
#include "src/core/SkMakeUnique.h"
#if SK_SUPPORT_GPU
#include "src/sksl/SkSLByteCode.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLExternalValue.h"
#endif
void SkParticleAffector::apply(const SkParticleUpdateParams& params,
SkParticleState ps[], int count) {
@ -436,6 +439,7 @@ private:
SkColorCurve fCurve;
};
#if SK_SUPPORT_GPU
static const char* kDefaultCode =
"// float rand; Every read returns a random float [0 .. 1)\n"
"layout(ctype=float) in uniform float dt;\n"
@ -523,6 +527,7 @@ private:
fRandomValue = std::move(rand);
}
};
#endif
void SkParticleAffector::RegisterAffectorTypes() {
REGISTER_REFLECTED(SkParticleAffector);
@ -536,7 +541,9 @@ void SkParticleAffector::RegisterAffectorTypes() {
REGISTER_REFLECTED(SkSizeAffector);
REGISTER_REFLECTED(SkFrameAffector);
REGISTER_REFLECTED(SkColorAffector);
#if SK_SUPPORT_GPU
REGISTER_REFLECTED(SkInterpreterAffector);
#endif
}
sk_sp<SkParticleAffector> SkParticleAffector::MakeLinearVelocity(const SkCurve& angle,

View File

@ -1379,8 +1379,6 @@ std::unique_ptr<Program> Compiler::specialize(
return result;
}
#if defined(SKSL_STANDALONE) || SK_SUPPORT_GPU
bool Compiler::toSPIRV(Program& program, OutputStream& out) {
if (!this->optimize(program)) {
return false;
@ -1499,8 +1497,6 @@ bool Compiler::toPipelineStage(const Program& program, String* out,
return result;
}
#endif
std::unique_ptr<ByteCode> Compiler::toByteCode(Program& program) {
if (!this->optimize(program)) {
return nullptr;

View File

@ -15,7 +15,7 @@
namespace SkSL {
#if defined(SKSL_STANDALONE) || !SK_SUPPORT_GPU
#ifdef SKSL_STANDALONE
StandaloneShaderCaps standaloneCaps;
#endif

View File

@ -80,7 +80,7 @@ struct Program {
int fValue;
};
#if defined(SKSL_STANDALONE) || !SK_SUPPORT_GPU
#ifdef SKSL_STANDALONE
const StandaloneShaderCaps* fCaps = &standaloneCaps;
#else
const GrShaderCaps* fCaps = nullptr;

View File

@ -1,22 +0,0 @@
/*
* Copyright 2019 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "modules/particles/include/SkParticleAffector.h"
#include "modules/particles/include/SkParticleDrawable.h"
#include "modules/particles/include/SkParticleEffect.h"
#include "modules/particles/include/SkParticleSerialization.h"
#include "modules/particles/include/SkReflected.h"
// Doesn't do anything important; just exists to show we can use modules/particles without the GPU
// backend being available.
int main(int argc, char** argv) {
// Register types for serialization
REGISTER_REFLECTED(SkReflected);
SkParticleAffector::RegisterAffectorTypes();
SkParticleDrawable::RegisterDrawableTypes();
return 0;
}