add SkVM_fwd.h

Tweaking SkVM.h requires ~550 build steps because SkShaderBase.h
includes it.  By switching that to forward declarations of the types
using SkVM_fwd.h, it's down to ~15.  Big deal for laptop productivity.

Change-Id: Ide5cc776b8a0c6fa6473cf5f43acabdf566e8808
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262860
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Mike Klein 2020-01-07 10:22:33 -06:00 committed by Skia Commit-Bot
parent b1ff79aae8
commit 8e71744169
9 changed files with 46 additions and 12 deletions

View File

@ -400,6 +400,7 @@ skia_core_sources = [
"$_src/core/SkUtils.h", "$_src/core/SkUtils.h",
"$_src/core/SkVM.cpp", "$_src/core/SkVM.cpp",
"$_src/core/SkVM.h", "$_src/core/SkVM.h",
"$_src/core/SkVM_fwd.h",
"$_src/core/SkVMBlitter.cpp", "$_src/core/SkVMBlitter.cpp",
"$_src/core/SkValidationUtils.h", "$_src/core/SkValidationUtils.h",
"$_src/core/SkVertices.cpp", "$_src/core/SkVertices.cpp",

View File

@ -14,6 +14,7 @@
#include "src/core/SkColorFilter_Matrix.h" #include "src/core/SkColorFilter_Matrix.h"
#include "src/core/SkRasterPipeline.h" #include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h" #include "src/core/SkReadBuffer.h"
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h" #include "src/core/SkWriteBuffer.h"
static uint16_t ComputeFlags(const float matrix[20]) { static uint16_t ComputeFlags(const float matrix[20]) {

View File

@ -10,6 +10,7 @@
#include "include/core/SkTypes.h" #include "include/core/SkTypes.h"
#include "include/private/SkTHash.h" #include "include/private/SkTHash.h"
#include "src/core/SkVM_fwd.h"
#include <vector> // std::vector #include <vector> // std::vector
class SkWStream; class SkWStream;
@ -305,8 +306,6 @@ namespace skvm {
struct Color { skvm::F32 r,g,b,a; }; struct Color { skvm::F32 r,g,b,a; };
class Program;
class Builder { class Builder {
public: public:
struct Instruction { struct Instruction {

22
src/core/SkVM_fwd.h Normal file
View File

@ -0,0 +1,22 @@
/*
* Copyright 2020 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkVM_fwd_DEFINED
#define SkVM_fwd_DEFINED
namespace skvm {
class Assembler;
class Builder;
class Program;
struct Arg;
struct I32;
struct F32;
struct Color;
struct Uniforms;
}
#endif//SkVM_fwd_DEFINED

View File

@ -10,6 +10,7 @@
#include "src/core/SkArenaAlloc.h" #include "src/core/SkArenaAlloc.h"
#include "src/core/SkRasterPipeline.h" #include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h" #include "src/core/SkReadBuffer.h"
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h" #include "src/core/SkWriteBuffer.h"
#include "src/shaders/SkColorFilterShader.h" #include "src/shaders/SkColorFilterShader.h"

View File

@ -12,6 +12,7 @@
#include "src/core/SkRasterPipeline.h" #include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h" #include "src/core/SkReadBuffer.h"
#include "src/core/SkUtils.h" #include "src/core/SkUtils.h"
#include "src/core/SkVM.h"
#include "src/shaders/SkColorShader.h" #include "src/shaders/SkColorShader.h"
SkColorShader::SkColorShader(SkColor c) : fColor(c) {} SkColorShader::SkColorShader(SkColor c) : fColor(c) {}

View File

@ -12,6 +12,7 @@
#include "src/core/SkOpts.h" #include "src/core/SkOpts.h"
#include "src/core/SkRasterPipeline.h" #include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h" #include "src/core/SkReadBuffer.h"
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h" #include "src/core/SkWriteBuffer.h"
#include "src/image/SkImage_Base.h" #include "src/image/SkImage_Base.h"
#include "src/shaders/SkBitmapProcShader.h" #include "src/shaders/SkBitmapProcShader.h"

View File

@ -15,6 +15,7 @@
#include "src/core/SkRasterPipeline.h" #include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h" #include "src/core/SkReadBuffer.h"
#include "src/core/SkTLazy.h" #include "src/core/SkTLazy.h"
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h" #include "src/core/SkWriteBuffer.h"
#include "src/shaders/SkBitmapProcShader.h" #include "src/shaders/SkBitmapProcShader.h"
#include "src/shaders/SkColorShader.h" #include "src/shaders/SkColorShader.h"
@ -224,6 +225,15 @@ bool SkShaderBase::program(skvm::Builder* p,
return false; return false;
} }
bool SkShaderBase::onProgram(skvm::Builder*,
const SkMatrix& ctm, const SkMatrix* localM,
SkFilterQuality quality, SkColorSpace* dstCS,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc,
skvm::F32 x, skvm::F32 y,
skvm::F32* r, skvm::F32* g, skvm::F32* b, skvm::F32* a) const {
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) { sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) {

View File

@ -15,7 +15,7 @@
#include "src/core/SkEffectPriv.h" #include "src/core/SkEffectPriv.h"
#include "src/core/SkMask.h" #include "src/core/SkMask.h"
#include "src/core/SkTLazy.h" #include "src/core/SkTLazy.h"
#include "src/core/SkVM.h" #include "src/core/SkVM_fwd.h"
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
#include "src/gpu/GrFPArgs.h" #include "src/gpu/GrFPArgs.h"
@ -214,15 +214,6 @@ public:
skvm::F32 x, skvm::F32 y, skvm::F32 x, skvm::F32 y,
skvm::F32* r, skvm::F32* g, skvm::F32* b, skvm::F32* a) const; skvm::F32* r, skvm::F32* g, skvm::F32* b, skvm::F32* a) const;
virtual bool onProgram(skvm::Builder*,
const SkMatrix& ctm, const SkMatrix* localM,
SkFilterQuality quality, SkColorSpace* dstCS,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc,
skvm::F32 x, skvm::F32 y,
skvm::F32* r, skvm::F32* g, skvm::F32* b, skvm::F32* a) const {
return false;
}
protected: protected:
SkShaderBase(const SkMatrix* localMatrix = nullptr); SkShaderBase(const SkMatrix* localMatrix = nullptr);
@ -251,6 +242,13 @@ private:
// This is essentially const, but not officially so it can be modified in constructors. // This is essentially const, but not officially so it can be modified in constructors.
SkMatrix fLocalMatrix; SkMatrix fLocalMatrix;
virtual bool onProgram(skvm::Builder*,
const SkMatrix& ctm, const SkMatrix* localM,
SkFilterQuality quality, SkColorSpace* dstCS,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc,
skvm::F32 x, skvm::F32 y,
skvm::F32* r, skvm::F32* g, skvm::F32* b, skvm::F32* a) const;
typedef SkShader INHERITED; typedef SkShader INHERITED;
}; };