[bazel] Fix Bazel build by guarding addToKey
PS1 is the automatic regenerated changes. PS2-3 adds an #ifdef guard to the addToKey method on shaders. The SkShaderCodeDictionary class helps generate SkSL and is only necessary when we are building with SkSL (gpu builds and cpu builds with SkVM). Suggested Review order: - Use Gerrit to diff PS 1 and the last PS - src/core/BUILD.bazel adds some sources to the "only necessary if sksl is enabled" bucket - All the .cpp and .h files to see the #ifdef is added correctly. Change-Id: I4d4ce61a4957ef1e0840204acff08ce7e616f9cb Bug: skia:12541 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512157 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
0b2a5b9a03
commit
b902658a1a
@ -100,6 +100,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":ContextPriv_hdr",
|
||||
":GlobalCache_hdr",
|
||||
":Gpu_hdr",
|
||||
],
|
||||
)
|
||||
@ -366,6 +367,7 @@ generated_cc_atom(
|
||||
"//experimental/graphite/include:Recorder_hdr",
|
||||
"//experimental/graphite/src/geom:BoundsManager_hdr",
|
||||
"//src/core:SkMathPriv_hdr",
|
||||
"//src/core:SkPaintParamsKey_hdr",
|
||||
"//src/core:SkTBlockList_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/gpu:BufferWriter_hdr",
|
||||
@ -482,7 +484,10 @@ generated_cc_atom(
|
||||
name = "Image_Graphite_hdr",
|
||||
hdrs = ["Image_Graphite.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = ["//src/image:SkImage_Base_hdr"],
|
||||
deps = [
|
||||
":TextureProxyView_hdr",
|
||||
"//src/image:SkImage_Base_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
@ -944,3 +949,15 @@ generated_cc_atom(
|
||||
"//src/core:SkConvertPixels_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "TextureProxyView_hdr",
|
||||
hdrs = ["TextureProxyView.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":TextureProxy_hdr",
|
||||
"//experimental/graphite/include:GraphiteTypes_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -1927,8 +1927,8 @@ generated_cc_atom(
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//src/core:SkCanvasPriv_hdr",
|
||||
"//src/gpu:GrRecordingContextPriv_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:SurfaceFillContext_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -5755,6 +5755,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkMaskFilter_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/core:SkPathEffect_hdr",
|
||||
"//include/core:SkPath_hdr",
|
||||
@ -5763,6 +5764,7 @@ generated_cc_atom(
|
||||
"//include/core:SkScalar_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//include/effects:SkDashPathEffect_hdr",
|
||||
"//include/effects:SkImageFilters_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -9381,6 +9383,7 @@ generated_cc_atom(
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
"//include/gpu:GrTypes_hdr",
|
||||
"//include/private:GrTypesPriv_hdr",
|
||||
"//include/private:SkHalf_hdr",
|
||||
"//include/private:SkTArray_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
"//include/private:SkTPin_hdr",
|
||||
@ -9616,3 +9619,26 @@ generated_cc_atom(
|
||||
"//src/gpu/v1:SurfaceDrawContext_v1_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "palette_src",
|
||||
srcs = ["palette.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkColor_hdr",
|
||||
"//include/core:SkFontMetrics_hdr",
|
||||
"//include/core:SkFontMgr_hdr",
|
||||
"//include/core:SkFont_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/core:SkScalar_hdr",
|
||||
"//include/core:SkSize_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
"//include/core:SkTypeface_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//tools:Resources_hdr",
|
||||
"//tools:ToolUtils_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -274,6 +274,7 @@ generated_cc_atom(
|
||||
hdrs = ["SkFontArguments.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkColor_hdr",
|
||||
":SkScalar_hdr",
|
||||
":SkTypes_hdr",
|
||||
],
|
||||
|
@ -367,10 +367,7 @@ generated_cc_atom(
|
||||
name = "SkSLString_hdr",
|
||||
hdrs = ["SkSLString.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkSLDefines_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
],
|
||||
deps = [":SkSLDefines_hdr"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
|
@ -5,6 +5,7 @@ generated_cc_atom(
|
||||
hdrs = ["GrSlug.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkRect_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
],
|
||||
|
@ -94,7 +94,6 @@ cc_library(
|
||||
":SkImageFilter_src",
|
||||
":SkImageGenerator_src",
|
||||
":SkImageInfo_src",
|
||||
":SkKeyHelpers_src",
|
||||
":SkLatticeIter_src",
|
||||
":SkLineClipper_src",
|
||||
":SkLocalMatrixImageFilter_src",
|
||||
@ -210,10 +209,14 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
# These are sources that are only needed if SkSL is enabled (GPU backend or SkVM).
|
||||
cc_library(
|
||||
name = "sksl_srcs",
|
||||
deps = [
|
||||
":SkKeyHelpers_src",
|
||||
":SkPaintParamsKey_src",
|
||||
":SkRuntimeEffect_src",
|
||||
":SkShaderCodeDictionary_src",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3126,8 +3129,6 @@ generated_cc_atom(
|
||||
":SkBlenderBase_hdr",
|
||||
":SkColorFilterBase_hdr",
|
||||
":SkColorSpacePriv_hdr",
|
||||
":SkKeyHelpers_hdr",
|
||||
":SkPaintParamsKey_hdr",
|
||||
":SkPaintPriv_hdr",
|
||||
":SkXfermodePriv_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
@ -5656,7 +5657,9 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkBuiltInCodeSnippetID_hdr",
|
||||
"//include/core:SkSpan_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//include/private:SkTArray_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "src/core/SkBlendModeBlender.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
@ -15,6 +14,10 @@
|
||||
#include "src/gpu/effects/GrBlendFragmentProcessor.h"
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
sk_sp<SkBlender> SkBlender::Mode(SkBlendMode mode) {
|
||||
#define RETURN_SINGLETON_BLENDER(m) \
|
||||
case m: { \
|
||||
@ -60,6 +63,7 @@ sk_sp<SkBlender> SkBlender::Mode(SkBlendMode mode) {
|
||||
#undef RETURN_SINGLETON_BLENDER
|
||||
}
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkBlenderBase::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -70,6 +74,7 @@ void SkBlenderBase::addToKey(SkShaderCodeDictionary* dict,
|
||||
BlendModeBlock::AddToKey(dict, builder, uniformBlock, SkBlendMode::kSrcOver);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<SkFlattenable> SkBlendModeBlender::CreateProc(SkReadBuffer& buffer) {
|
||||
SkBlendMode mode = buffer.read32LE(SkBlendMode::kLastMode);
|
||||
|
@ -57,10 +57,12 @@ public:
|
||||
|
||||
virtual SkRuntimeEffect* asRuntimeEffect() const { return nullptr; }
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
// TODO: make pure virtual
|
||||
virtual void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const;
|
||||
#endif
|
||||
|
||||
static SkFlattenable::Type GetFlattenableType() { return kSkBlender_Type; }
|
||||
Type getFlattenableType() const override { return GetFlattenableType(); }
|
||||
|
@ -85,7 +85,6 @@ cc_library(
|
||||
":GrSurfaceInfo_src",
|
||||
":GrSurfaceProxy_src",
|
||||
":GrSurface_src",
|
||||
":GrSwizzle_src",
|
||||
":GrTestUtils_src",
|
||||
":GrTextureProxy_src",
|
||||
":GrTextureRenderTargetProxy_src",
|
||||
@ -107,6 +106,7 @@ cc_library(
|
||||
":SkGr_src",
|
||||
":SurfaceContext_src",
|
||||
":SurfaceFillContext_src",
|
||||
":Swizzle_src",
|
||||
"//src/gpu/effects:GrBezierEffect_src",
|
||||
"//src/gpu/effects:GrBicubicEffect_src",
|
||||
"//src/gpu/effects:GrBitmapTextGeoProc_src",
|
||||
@ -701,7 +701,7 @@ generated_cc_atom(
|
||||
":GrSamplerState_hdr",
|
||||
":GrShaderCaps_hdr",
|
||||
":GrSurfaceProxy_hdr",
|
||||
":GrSwizzle_hdr",
|
||||
":Swizzle_hdr",
|
||||
"//include/core:SkImageInfo_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
@ -957,7 +957,7 @@ generated_cc_atom(
|
||||
":GrDataUtils_hdr",
|
||||
":GrImageInfo_hdr",
|
||||
":GrPixmap_hdr",
|
||||
":GrSwizzle_hdr",
|
||||
":Swizzle_hdr",
|
||||
"//include/private:SkTPin_hdr",
|
||||
"//include/third_party/skcms:skcms_hdr",
|
||||
"//src/core:SkColorSpaceXformSteps_hdr",
|
||||
@ -1311,7 +1311,10 @@ generated_cc_atom(
|
||||
name = "GrEagerVertexAllocator_hdr",
|
||||
hdrs = ["GrEagerVertexAllocator.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [":GrThreadSafeCache_hdr"],
|
||||
deps = [
|
||||
":BufferWriter_hdr",
|
||||
":GrThreadSafeCache_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
@ -1416,7 +1419,7 @@ generated_cc_atom(
|
||||
":GrProcessor_hdr",
|
||||
":GrShaderCaps_hdr",
|
||||
":GrShaderVar_hdr",
|
||||
":GrSwizzle_hdr",
|
||||
":Swizzle_hdr",
|
||||
"//src/gpu/glsl:GrGLSLProgramDataManager_hdr",
|
||||
"//src/gpu/glsl:GrGLSLUniformHandler_hdr",
|
||||
"//src/gpu/glsl:GrGLSLVarying_hdr",
|
||||
@ -1524,8 +1527,8 @@ generated_cc_atom(
|
||||
":GrCaps_hdr",
|
||||
":GrOpsRenderPass_hdr",
|
||||
":GrPixmap_hdr",
|
||||
":GrSwizzle_hdr",
|
||||
":GrXferProcessor_hdr",
|
||||
":Swizzle_hdr",
|
||||
"//include/core:SkPath_hdr",
|
||||
"//include/core:SkSpan_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
@ -2246,7 +2249,7 @@ generated_cc_atom(
|
||||
":GrNativeRect_hdr",
|
||||
":GrSubRunAllocator_hdr",
|
||||
":GrSurfaceProxy_hdr",
|
||||
":GrSwizzle_hdr",
|
||||
":Swizzle_hdr",
|
||||
"//include/private:GrTypesPriv_hdr",
|
||||
"//src/core:SkArenaAlloc_hdr",
|
||||
],
|
||||
@ -2750,8 +2753,8 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":GrRenderTargetProxy_hdr",
|
||||
":GrSurfaceProxy_hdr",
|
||||
":GrSwizzle_hdr",
|
||||
":GrTextureProxy_hdr",
|
||||
":Swizzle_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/gpu:GrTypes_hdr",
|
||||
],
|
||||
@ -2825,27 +2828,6 @@ generated_cc_atom(
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "GrSwizzle_hdr",
|
||||
hdrs = ["GrSwizzle.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":GrColor_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "GrSwizzle_src",
|
||||
srcs = ["GrSwizzle.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":GrSwizzle_hdr",
|
||||
"//src/core:SkRasterPipeline_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "GrTTopoSort_hdr",
|
||||
hdrs = ["GrTTopoSort.h"],
|
||||
@ -3492,3 +3474,23 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = ["//include/core:SkTypes_hdr"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "Swizzle_hdr",
|
||||
hdrs = ["Swizzle.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkString_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "Swizzle_src",
|
||||
srcs = ["Swizzle.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":Swizzle_hdr",
|
||||
"//src/core:SkRasterPipeline_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -111,7 +111,7 @@ generated_cc_atom(
|
||||
"//include/private:SkTArray_hdr",
|
||||
"//include/private:SkTHash_hdr",
|
||||
"//src/gpu:GrCaps_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -495,7 +495,7 @@ generated_cc_atom(
|
||||
":GrGLDefines_hdr",
|
||||
"//include/core:SkScalar_hdr",
|
||||
"//include/private:GrGLTypesPriv_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -36,8 +36,8 @@ generated_cc_atom(
|
||||
"//src/gpu:GrPersistentCacheUtils_hdr",
|
||||
"//src/gpu:GrProgramDesc_hdr",
|
||||
"//src/gpu:GrShaderCaps_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:GrXferProcessor_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
"//src/gpu/gl:GrGLGpu_hdr",
|
||||
"//src/gpu/gl:GrGLProgram_hdr",
|
||||
"//src/gpu/glsl:GrGLSLProgramDataManager_hdr",
|
||||
|
@ -145,7 +145,7 @@ generated_cc_atom(
|
||||
"//include/sksl:DSL_hdr",
|
||||
"//src/gpu:GrShaderCaps_hdr",
|
||||
"//src/gpu:GrShaderVar_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
"//src/sksl:SkSLThreadContext_hdr",
|
||||
"//src/sksl/ir:SkSLVarDeclarations_hdr",
|
||||
],
|
||||
@ -158,7 +158,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":GrGLSLProgramDataManager_hdr",
|
||||
"//src/gpu:GrShaderVar_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -106,6 +106,8 @@ generated_cc_atom(
|
||||
deps = [
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/private/chromium:GrSlug_hdr",
|
||||
"//src/core:SkReadBuffer_hdr",
|
||||
"//src/core:SkWriteBuffer_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -167,10 +169,12 @@ generated_cc_atom(
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
"//include/private:SkTemplates_hdr",
|
||||
"//include/private/chromium:GrSlug_hdr",
|
||||
"//include/private/chromium:SkChromeRemoteGlyphCache_hdr",
|
||||
"//src/core:SkFontPriv_hdr",
|
||||
"//src/core:SkMaskFilterBase_hdr",
|
||||
"//src/core:SkMatrixProvider_hdr",
|
||||
"//src/core:SkPaintPriv_hdr",
|
||||
"//src/core:SkReadBuffer_hdr",
|
||||
"//src/core:SkStrikeCache_hdr",
|
||||
"//src/core:SkStrikeSpec_hdr",
|
||||
"//src/gpu:GrBlurUtils_hdr",
|
||||
@ -235,6 +239,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":GrAtlasManager_hdr",
|
||||
":GrGlyphVector_hdr",
|
||||
"//include/private/chromium:SkChromeRemoteGlyphCache_hdr",
|
||||
"//src/core:SkReadBuffer_hdr",
|
||||
"//src/core:SkStrikeCache_hdr",
|
||||
"//src/core:SkStrikeSpec_hdr",
|
||||
|
@ -110,6 +110,7 @@ generated_cc_atom(
|
||||
"//src/core:SkStroke_hdr",
|
||||
"//src/core:SkTLazy_hdr",
|
||||
"//src/core:SkVerticesPriv_hdr",
|
||||
"//src/core:SkWriteBuffer_hdr",
|
||||
"//src/gpu:GrBlurUtils_hdr",
|
||||
"//src/gpu:GrDirectContextPriv_hdr",
|
||||
"//src/gpu:GrGpu_hdr",
|
||||
@ -350,8 +351,8 @@ generated_cc_atom(
|
||||
"//include/core:SkSize_hdr",
|
||||
"//include/private:GrTypesPriv_hdr",
|
||||
"//src/gpu:GrImageInfo_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:SurfaceFillContext_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
"//src/gpu/ops:OpsTask_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -11,12 +11,15 @@
|
||||
#include "src/core/SkArenaAlloc.h"
|
||||
#include "src/core/SkColorSpacePriv.h"
|
||||
#include "src/core/SkColorSpaceXformSteps.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkUtils.h"
|
||||
#include "src/core/SkVM.h"
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
SkColorShader::SkColorShader(SkColor c) : fColor(c) {}
|
||||
|
||||
bool SkColorShader::isOpaque() const {
|
||||
@ -137,6 +140,7 @@ std::unique_ptr<GrFragmentProcessor> SkColor4Shader::asFragmentProcessor(
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkColorShader::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -149,3 +153,4 @@ void SkColor4Shader::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
SolidColorShaderBlock::AddToKey(dict, builder, uniformBlock, fColor);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/shaders/SkShaderBase.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
/** \class SkColorShader
|
||||
A Shader that represents a single color. In general, this effect can be
|
||||
accomplished by just using the color field on the paint, but if an
|
||||
@ -31,9 +33,12 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColorShader)
|
||||
@ -64,9 +69,11 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColor4Shader)
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "src/core/SkArenaAlloc.h"
|
||||
#include "src/core/SkBlendModePriv.h"
|
||||
#include "src/core/SkBlenderBase.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkRuntimeEffectPriv.h"
|
||||
@ -20,6 +19,10 @@
|
||||
#include "src/shaders/SkColorShader.h"
|
||||
#include "src/shaders/SkComposeShader.h"
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
struct LocalMatrixStageRec final : public SkStageRec {
|
||||
@ -189,6 +192,7 @@ std::unique_ptr<GrFragmentProcessor> SkShader_Blend::asFragmentProcessor(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkShader_Blend::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -197,3 +201,4 @@ void SkShader_Blend::addToKey(SkShaderCodeDictionary* dict,
|
||||
|
||||
BlendShaderBlock::AddToKey(dict, builder, uniformBlock, { fDst.get(), fSrc.get(), fMode });
|
||||
}
|
||||
#endif
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "src/core/SkBlenderBase.h"
|
||||
#include "src/shaders/SkShaderBase.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
class SkShader_Blend final : public SkShaderBase {
|
||||
public:
|
||||
SkShader_Blend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src)
|
||||
@ -28,9 +30,11 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
SkShader_Blend(SkReadBuffer&);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "src/core/SkArenaAlloc.h"
|
||||
#include "src/core/SkColorSpacePriv.h"
|
||||
#include "src/core/SkColorSpaceXformSteps.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkMatrixPriv.h"
|
||||
#include "src/core/SkMatrixProvider.h"
|
||||
#include "src/core/SkMipmapAccessor.h"
|
||||
@ -27,6 +26,10 @@
|
||||
#include "src/shaders/SkEmptyShader.h"
|
||||
#include "src/shaders/SkTransformShader.h"
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
SkM44 SkImageShader::CubicResamplerMatrix(float B, float C) {
|
||||
#if 0
|
||||
constexpr SkM44 kMitchell = SkM44( 1.f/18.f, -9.f/18.f, 15.f/18.f, -7.f/18.f,
|
||||
@ -373,11 +376,13 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkImageShader::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
ImageShaderBlock::AddToKey(dict, builder, uniformBlock, { fTileModeX, fTileModeY });
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "src/core/SkImagePriv.h"
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "src/shaders/SkBitmapProcShader.h"
|
||||
#include "src/shaders/SkShaderBase.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
class SkImageShader : public SkShaderBase {
|
||||
public:
|
||||
static sk_sp<SkShader> Make(sk_sp<SkImage>,
|
||||
@ -43,11 +45,11 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
|
||||
#endif
|
||||
static SkM44 CubicResamplerMatrix(float B, float C);
|
||||
|
||||
private:
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "src/core/SkArenaAlloc.h"
|
||||
#include "src/core/SkColorSpacePriv.h"
|
||||
#include "src/core/SkColorSpaceXformSteps.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkMatrixProvider.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
@ -31,6 +30,10 @@
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
SkShaderBase::SkShaderBase(const SkMatrix* localMatrix)
|
||||
: fLocalMatrix(localMatrix ? *localMatrix : SkMatrix::I()) {
|
||||
// Pre-cache so future calls to fLocalMatrix.getType() are threadsafe.
|
||||
@ -149,12 +152,14 @@ SkUpdatableShader* SkShaderBase::onUpdatableShader(SkArenaAlloc* alloc) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
// TODO: add implementations for derived classes
|
||||
void SkShaderBase::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
SolidColorShaderBlock::AddToKey(dict, builder, uniformBlock, SkColors::kRed);
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<SkShader> SkShaders::Empty() { return sk_make_sp<SkEmptyShader>(); }
|
||||
sk_sp<SkShader> SkShaders::Color(SkColor color) { return sk_make_sp<SkColorShader>(color); }
|
||||
|
@ -214,6 +214,7 @@ public:
|
||||
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const;
|
||||
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
/**
|
||||
Add implementation details, for the specified backend, of this SkShader to the
|
||||
provided key.
|
||||
@ -225,6 +226,7 @@ public:
|
||||
virtual void addToKey(SkShaderCodeDictionary* dictionary,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
SkShaderBase(const SkMatrix* localMatrix = nullptr);
|
||||
|
@ -7,11 +7,15 @@
|
||||
|
||||
#include "src/shaders/gradients/SkLinearGradient.h"
|
||||
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
#include "src/shaders/gradients/Sk4fLinearGradient.h"
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
static SkMatrix pts_to_unit_matrix(const SkPoint pts[2]) {
|
||||
SkVector vec = pts[1] - pts[0];
|
||||
SkScalar mag = vec.length();
|
||||
@ -104,6 +108,7 @@ std::unique_ptr<GrFragmentProcessor> SkLinearGradient::asFragmentProcessor(
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkLinearGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -117,3 +122,4 @@ void SkLinearGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
|
||||
GradientShaderBlocks::AddToKey(dict, builder, uniformBlock, data);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/shaders/gradients/SkGradientShaderPriv.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
class SkLinearGradient : public SkGradientShaderBase {
|
||||
public:
|
||||
SkLinearGradient(const SkPoint pts[2], const Descriptor&);
|
||||
@ -18,9 +20,11 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
SkLinearGradient(SkReadBuffer& buffer);
|
||||
|
@ -7,11 +7,14 @@
|
||||
|
||||
#include "src/shaders/gradients/SkRadialGradient.h"
|
||||
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
SkMatrix rad_to_unit_matrix(const SkPoint& center, SkScalar radius) {
|
||||
@ -83,6 +86,7 @@ std::unique_ptr<GrFragmentProcessor> SkRadialGradient::asFragmentProcessor(
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkRadialGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -96,3 +100,4 @@ void SkRadialGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
|
||||
GradientShaderBlocks::AddToKey(dict, builder, uniformBlock, data);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/shaders/gradients/SkGradientShaderPriv.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
class SkRadialGradient final : public SkGradientShaderBase {
|
||||
public:
|
||||
SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
|
||||
@ -18,10 +20,11 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
|
||||
#endif
|
||||
protected:
|
||||
SkRadialGradient(SkReadBuffer& buffer);
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
|
@ -8,11 +8,14 @@
|
||||
#include "src/shaders/gradients/SkSweepGradient.h"
|
||||
|
||||
#include "include/private/SkFloatingPoint.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
SkSweepGradient::SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1,
|
||||
const Descriptor& desc)
|
||||
: SkGradientShaderBase(desc, SkMatrix::Translate(-center.x(), -center.y()))
|
||||
@ -107,6 +110,7 @@ std::unique_ptr<GrFragmentProcessor> SkSweepGradient::asFragmentProcessor(
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkSweepGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -120,3 +124,4 @@ void SkSweepGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
|
||||
GradientShaderBlocks::AddToKey(dict, builder, uniformBlock, data);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/shaders/gradients/SkGradientShaderPriv.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
class SkSweepGradient final : public SkGradientShaderBase {
|
||||
public:
|
||||
SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor&);
|
||||
@ -19,9 +21,11 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
#endif
|
||||
|
||||
SkScalar getTBias() const { return fTBias; }
|
||||
|
||||
|
@ -8,13 +8,16 @@
|
||||
#include "src/shaders/gradients/SkTwoPointConicalGradient.h"
|
||||
|
||||
#include "include/private/SkFloatingPoint.h"
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#include "src/core/SkRasterPipeline.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
#include "src/core/SkKeyHelpers.h"
|
||||
#endif
|
||||
|
||||
// Please see https://skia.org/dev/design/conical for how our shader works.
|
||||
|
||||
bool SkTwoPointConicalGradient::FocalData::set(SkScalar r0, SkScalar r1, SkMatrix* matrix) {
|
||||
@ -277,6 +280,7 @@ std::unique_ptr<GrFragmentProcessor> SkTwoPointConicalGradient::asFragmentProces
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void SkTwoPointConicalGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
SkPaintParamsKeyBuilder* builder,
|
||||
SkUniformBlock* uniformBlock) const {
|
||||
@ -290,3 +294,4 @@ void SkTwoPointConicalGradient::addToKey(SkShaderCodeDictionary* dict,
|
||||
|
||||
GradientShaderBlocks::AddToKey(dict, builder, uniformBlock, data);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/shaders/gradients/SkGradientShaderPriv.h"
|
||||
|
||||
class SkShaderCodeDictionary;
|
||||
|
||||
class SkTwoPointConicalGradient final : public SkGradientShaderBase {
|
||||
public:
|
||||
// See https://skia.org/dev/design/conical for what focal data means and how our shader works.
|
||||
@ -51,10 +53,11 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
#ifdef SK_ENABLE_SKSL
|
||||
void addToKey(SkShaderCodeDictionary*,
|
||||
SkPaintParamsKeyBuilder*,
|
||||
SkUniformBlock*) const override;
|
||||
|
||||
#endif
|
||||
bool isOpaque() const override;
|
||||
|
||||
SkScalar getCenterX1() const { return SkPoint::Distance(fCenter1, fCenter2); }
|
||||
|
@ -769,10 +769,7 @@ generated_cc_atom(
|
||||
name = "SkSLString_src",
|
||||
srcs = ["SkSLString.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkSLUtil_hdr",
|
||||
"//include/private:SkSLString_hdr",
|
||||
],
|
||||
deps = ["//include/private:SkSLString_hdr"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
|
@ -2875,6 +2875,7 @@ generated_cc_atom(
|
||||
"//src/core:SkSpecialSurface_hdr",
|
||||
"//src/gpu:GrCaps_hdr",
|
||||
"//src/gpu:GrRecordingContextPriv_hdr",
|
||||
"//src/image:SkImage_Base_hdr",
|
||||
"//tools:Resources_hdr",
|
||||
"//tools:ToolUtils_hdr",
|
||||
],
|
||||
@ -5572,7 +5573,7 @@ generated_cc_atom(
|
||||
"//include/private:SkHalf_hdr",
|
||||
"//include/private:SkTo_hdr",
|
||||
"//src/core:SkRasterPipeline_hdr",
|
||||
"//src/gpu:GrSwizzle_hdr",
|
||||
"//src/gpu:Swizzle_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -5592,6 +5593,7 @@ generated_cc_atom(
|
||||
"//include/private/chromium:SkChromeRemoteGlyphCache_hdr",
|
||||
"//src/core:SkDraw_hdr",
|
||||
"//src/core:SkFontPriv_hdr",
|
||||
"//src/core:SkReadBuffer_hdr",
|
||||
"//src/core:SkScalerCache_hdr",
|
||||
"//src/core:SkStrikeCache_hdr",
|
||||
"//src/core:SkStrikeSpec_hdr",
|
||||
@ -7031,3 +7033,16 @@ generated_cc_atom(
|
||||
"//src/gpu/text:GrGlyphVector_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "SaveLayerOriginTest_src",
|
||||
srcs = ["SaveLayerOriginTest.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":TestUtils_hdr",
|
||||
":Test_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -18,21 +18,6 @@ generated_cc_atom(
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "ComboTest_src",
|
||||
srcs = ["ComboTest.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//include/effects:SkGradientShader_hdr",
|
||||
"//src/core:SkPaintParamsKey_hdr",
|
||||
"//src/core:SkPaintPriv_hdr",
|
||||
"//src/core:SkShaderCodeDictionary_hdr",
|
||||
"//tests:Test_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "CommandBufferTest_src",
|
||||
srcs = ["CommandBufferTest.cpp"],
|
||||
@ -165,3 +150,15 @@ generated_cc_atom(
|
||||
"//tests:Test_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "KeyTest_src",
|
||||
srcs = ["KeyTest.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//experimental/graphite/src:ContextPriv_hdr",
|
||||
"//src/core:SkPaintParamsKey_hdr",
|
||||
"//src/core:SkShaderCodeDictionary_hdr",
|
||||
"//tests:Test_hdr",
|
||||
],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user