[graphite] Update remaining childless Blocks to be AddBlock-style
This includes:
DitherShaderBlock
DstReadSampleBlock
GradientShaderBlocks
MatrixColorFilterBlock
PerlinNoiseShaderBlock
TableColorFilterBlock
Bug: b/251493570
Change-Id: I79f5317fef1fa0b31c6dbec1336dd99767efa0af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/763378
Reviewed-by: Nicolette Prevost <nicolettep@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/graphite/FactoryFunctions.cpp b/src/gpu/graphite/FactoryFunctions.cpp
index cae8b8b..49d5770 100644
--- a/src/gpu/graphite/FactoryFunctions.cpp
+++ b/src/gpu/graphite/FactoryFunctions.cpp
@@ -323,9 +323,8 @@
// TODO: we may need SkLocalMatrixShader-wrapped versions too
Compose(keyContext, builder, /* gatherer= */ nullptr,
/* addInnerToKey= */ [&]() -> void {
- GradientShaderBlocks::BeginBlock(keyContext, builder, /* gatherer= */ nullptr,
- gradData);
- builder->endBlock();
+ GradientShaderBlocks::AddBlock(keyContext, builder, /* gatherer= */ nullptr,
+ gradData);
},
/* addOuterToKey= */ [&]() -> void {
ColorSpaceTransformBlock::AddBlock(keyContext,
@@ -374,7 +373,7 @@
LocalMatrixShaderBlock::BeginBlock(keyContext, builder,
/* gatherer= */ nullptr, /* lmShaderData= */ nullptr);
- fWrapped->priv().addToKey(keyContext, desiredCombination, builder);
+ fWrapped->priv().addToKey(keyContext, desiredCombination, builder);
builder->endBlock();
}
@@ -486,10 +485,8 @@
PaintParamsKeyBuilder* builder) const override {
SkASSERT(desiredCombination == 0);
- MatrixColorFilterBlock::BeginBlock(keyContext, builder,
- /* gatherer= */ nullptr,
- /* matrixCFData= */ nullptr);
- builder->endBlock();
+ MatrixColorFilterBlock::AddBlock(keyContext, builder, /* gatherer= */ nullptr,
+ /* matrixCFData= */ nullptr);
}
};
diff --git a/src/gpu/graphite/KeyHelpers.cpp b/src/gpu/graphite/KeyHelpers.cpp
index b07064b..06d177f 100644
--- a/src/gpu/graphite/KeyHelpers.cpp
+++ b/src/gpu/graphite/KeyHelpers.cpp
@@ -174,16 +174,16 @@
} // anonymous namespace
-void DstReadSampleBlock::BeginBlock(const KeyContext& keyContext,
- PaintParamsKeyBuilder* builder,
- PipelineDataGatherer* gatherer,
- sk_sp<TextureProxy> dstTexture,
- SkIPoint dstOffset) {
+void DstReadSampleBlock::AddBlock(const KeyContext& keyContext,
+ PaintParamsKeyBuilder* builder,
+ PipelineDataGatherer* gatherer,
+ sk_sp<TextureProxy> dstTexture,
+ SkIPoint dstOffset) {
if (gatherer) {
add_dst_read_sample_uniform_data(
keyContext.dict(), gatherer, std::move(dstTexture), dstOffset);
}
- builder->beginBlock(BuiltInCodeSnippetID::kDstReadSample);
+ builder->addBlock(BuiltInCodeSnippetID::kDstReadSample);
}
//--------------------------------------------------------------------------------------------------
@@ -351,10 +351,10 @@
}
}
-void GradientShaderBlocks::BeginBlock(const KeyContext& keyContext,
- PaintParamsKeyBuilder *builder,
- PipelineDataGatherer* gatherer,
- const GradientData& gradData) {
+void GradientShaderBlocks::AddBlock(const KeyContext& keyContext,
+ PaintParamsKeyBuilder *builder,
+ PipelineDataGatherer* gatherer,
+ const GradientData& gradData) {
auto dict = keyContext.dict();
if (gradData.fNumStops > GradientData::kNumInternalStorageStops && gatherer) {
@@ -409,7 +409,7 @@
break;
}
- builder->beginBlock(codeSnippetID);
+ builder->addBlock(codeSnippetID);
}
//--------------------------------------------------------------------------------------------------
@@ -685,10 +685,10 @@
} // anonymous namespace
-void DitherShaderBlock::BeginBlock(const KeyContext& keyContext,
- PaintParamsKeyBuilder* builder,
- PipelineDataGatherer* gatherer,
- const DitherData& data) {
+void DitherShaderBlock::AddBlock(const KeyContext& keyContext,
+ PaintParamsKeyBuilder* builder,
+ PipelineDataGatherer* gatherer,
+ const DitherData& data) {
if (gatherer) {
add_dither_uniform_data(keyContext.dict(), data, gatherer);
@@ -699,7 +699,7 @@
gatherer->add(kNearest, kRepeatTiling, data.fLUTProxy);
}
- builder->beginBlock(BuiltInCodeSnippetID::kDitherShader);
+ builder->addBlock(BuiltInCodeSnippetID::kDitherShader);
}
//--------------------------------------------------------------------------------------------------
@@ -726,10 +726,10 @@
} // anonymous namespace
-void PerlinNoiseShaderBlock::BeginBlock(const KeyContext& keyContext,
- PaintParamsKeyBuilder* builder,
- PipelineDataGatherer* gatherer,
- const PerlinNoiseData* noiseData) {
+void PerlinNoiseShaderBlock::AddBlock(const KeyContext& keyContext,
+ PaintParamsKeyBuilder* builder,
+ PipelineDataGatherer* gatherer,
+ const PerlinNoiseData* noiseData) {
SkASSERT(!gatherer == !noiseData);
auto dict = keyContext.dict();
@@ -737,7 +737,7 @@
add_perlin_noise_uniform_data(dict, *noiseData, gatherer);
}
- builder->beginBlock(BuiltInCodeSnippetID::kPerlinNoiseShader);
+ builder->addBlock(BuiltInCodeSnippetID::kPerlinNoiseShader);
}
//--------------------------------------------------------------------------------------------------
@@ -804,10 +804,10 @@
} // anonymous namespace
-void MatrixColorFilterBlock::BeginBlock(const KeyContext& keyContext,
- PaintParamsKeyBuilder* builder,
- PipelineDataGatherer* gatherer,
- const MatrixColorFilterData* matrixCFData) {
+void MatrixColorFilterBlock::AddBlock(const KeyContext& keyContext,
+ PaintParamsKeyBuilder* builder,
+ PipelineDataGatherer* gatherer,
+ const MatrixColorFilterData* matrixCFData) {
SkASSERT(!gatherer == !matrixCFData);
auto dict = keyContext.dict();
@@ -816,7 +816,7 @@
add_matrix_colorfilter_uniform_data(dict, *matrixCFData, gatherer);
}
- builder->beginBlock(BuiltInCodeSnippetID::kMatrixColorFilter);
+ builder->addBlock(BuiltInCodeSnippetID::kMatrixColorFilter);
}
//--------------------------------------------------------------------------------------------------
@@ -834,10 +834,10 @@
} // anonymous namespace
-void TableColorFilterBlock::BeginBlock(const KeyContext& keyContext,
- PaintParamsKeyBuilder* builder,
- PipelineDataGatherer* gatherer,
- const TableColorFilterData& data) {
+void TableColorFilterBlock::AddBlock(const KeyContext& keyContext,
+ PaintParamsKeyBuilder* builder,
+ PipelineDataGatherer* gatherer,
+ const TableColorFilterData& data) {
auto dict = keyContext.dict();
if (gatherer) {
@@ -846,7 +846,7 @@
add_table_colorfilter_uniform_data(dict, data, gatherer);
}
- builder->beginBlock(BuiltInCodeSnippetID::kTableColorFilter);
+ builder->addBlock(BuiltInCodeSnippetID::kTableColorFilter);
}
//--------------------------------------------------------------------------------------------------
@@ -1116,8 +1116,7 @@
bool inHSLA = filter->domain() == SkMatrixColorFilter::Domain::kHSLA;
MatrixColorFilterBlock::MatrixColorFilterData matrixCFData(filter->matrix(), inHSLA);
- MatrixColorFilterBlock::BeginBlock(keyContext, builder, gatherer, &matrixCFData);
- builder->endBlock();
+ MatrixColorFilterBlock::AddBlock(keyContext, builder, gatherer, &matrixCFData);
}
static void add_to_key(const KeyContext& keyContext,
@@ -1157,8 +1156,7 @@
TableColorFilterBlock::TableColorFilterData data(std::move(proxy));
- TableColorFilterBlock::BeginBlock(keyContext, builder, gatherer, data);
- builder->endBlock();
+ TableColorFilterBlock::AddBlock(keyContext, builder, gatherer, data);
}
static void add_to_key(const KeyContext& keyContext,
@@ -1503,7 +1501,7 @@
LocalMatrixShaderBlock::BeginBlock(newContext, builder, gatherer, &lmShaderData);
- AddToKey(newContext, builder, gatherer, wrappedShader);
+ AddToKey(newContext, builder, gatherer, wrappedShader);
builder->endBlock();
} else {
@@ -1574,8 +1572,7 @@
KeyContextWithLocalMatrix newContext(keyContext, shader2Local);
LocalMatrixShaderBlock::BeginBlock(newContext, builder, gatherer, &lmShaderData);
- PerlinNoiseShaderBlock::BeginBlock(newContext, builder, gatherer, &data);
- builder->endBlock();
+ PerlinNoiseShaderBlock::AddBlock(newContext, builder, gatherer, &data);
builder->endBlock();
}
@@ -1780,12 +1777,11 @@
intermediateCS, intermediateAlphaType, dstColorSpace, dstColorInfo.alphaType());
// The gradient block and colorSpace conversion block need to be combined
- // (via the compose block) so that the localMatrix block can treat them as
+ // (via the Compose block) so that the localMatrix block can treat them as
// one child.
Compose(keyContext, builder, gatherer,
/* addInnerToKey= */ [&]() -> void {
- GradientShaderBlocks::BeginBlock(keyContext, builder, gatherer, gradData);
- builder->endBlock();
+ GradientShaderBlocks::AddBlock(keyContext, builder, gatherer, gradData);
},
/* addOuterToKey= */ [&]() -> void {
ColorSpaceTransformBlock::AddBlock(keyContext, builder, gatherer, data);
diff --git a/src/gpu/graphite/KeyHelpers.h b/src/gpu/graphite/KeyHelpers.h
index fcebc18..8b3e4c2 100644
--- a/src/gpu/graphite/KeyHelpers.h
+++ b/src/gpu/graphite/KeyHelpers.h
@@ -54,11 +54,11 @@
*/
struct DstReadSampleBlock {
- static void BeginBlock(const KeyContext&,
- PaintParamsKeyBuilder*,
- PipelineDataGatherer*,
- sk_sp<TextureProxy> dst,
- SkIPoint dstOffset);
+ static void AddBlock(const KeyContext&,
+ PaintParamsKeyBuilder*,
+ PipelineDataGatherer*,
+ sk_sp<TextureProxy> dst,
+ SkIPoint dstOffset);
};
struct SolidColorShaderBlock {
@@ -128,10 +128,10 @@
SkGradientShader::Interpolation fInterpolation;
};
- static void BeginBlock(const KeyContext&,
- PaintParamsKeyBuilder*,
- PipelineDataGatherer*,
- const GradientData&);
+ static void AddBlock(const KeyContext&,
+ PaintParamsKeyBuilder*,
+ PipelineDataGatherer*,
+ const GradientData&);
};
struct LocalMatrixShaderBlock {
@@ -229,11 +229,10 @@
sk_sp<TextureProxy> fLUTProxy;
};
- // The gatherer and data should be null or non-null together
- static void BeginBlock(const KeyContext&,
- PaintParamsKeyBuilder*,
- PipelineDataGatherer*,
- const DitherData&);
+ static void AddBlock(const KeyContext&,
+ PaintParamsKeyBuilder*,
+ PipelineDataGatherer*,
+ const DitherData&);
};
struct PerlinNoiseShaderBlock {
@@ -265,10 +264,10 @@
};
// The gatherer and data should be null or non-null together
- static void BeginBlock(const KeyContext&,
- PaintParamsKeyBuilder*,
- PipelineDataGatherer*,
- const PerlinNoiseData*);
+ static void AddBlock(const KeyContext&,
+ PaintParamsKeyBuilder*,
+ PipelineDataGatherer*,
+ const PerlinNoiseData*);
};
struct BlendShaderBlock {
@@ -313,10 +312,10 @@
};
// The gatherer and matrixCFData should be null or non-null together
- static void BeginBlock(const KeyContext&,
- PaintParamsKeyBuilder*,
- PipelineDataGatherer*,
- const MatrixColorFilterData*);
+ static void AddBlock(const KeyContext&,
+ PaintParamsKeyBuilder*,
+ PipelineDataGatherer*,
+ const MatrixColorFilterData*);
};
struct TableColorFilterBlock {
@@ -326,10 +325,10 @@
sk_sp<TextureProxy> fTextureProxy;
};
- static void BeginBlock(const KeyContext&,
- PaintParamsKeyBuilder*,
- PipelineDataGatherer*,
- const TableColorFilterData&);
+ static void AddBlock(const KeyContext&,
+ PaintParamsKeyBuilder*,
+ PipelineDataGatherer*,
+ const TableColorFilterData&);
};
struct ColorSpaceTransformBlock {
diff --git a/src/gpu/graphite/PaintParams.cpp b/src/gpu/graphite/PaintParams.cpp
index c02a171..385c71a 100644
--- a/src/gpu/graphite/PaintParams.cpp
+++ b/src/gpu/graphite/PaintParams.cpp
@@ -171,10 +171,8 @@
case DstReadRequirement::kTextureCopy:
[[fallthrough]];
case DstReadRequirement::kTextureSample:
- DstReadSampleBlock::BeginBlock(keyContext, builder, gatherer,
- keyContext.dstTexture(),
- keyContext.dstOffset());
- builder->endBlock();
+ DstReadSampleBlock::AddBlock(keyContext, builder, gatherer, keyContext.dstTexture(),
+ keyContext.dstOffset());
break;
case DstReadRequirement::kFramebufferFetch:
builder->addBlock(BuiltInCodeSnippetID::kDstReadFetch);
@@ -201,8 +199,7 @@
DitherShaderBlock::DitherData data(skgpu::DitherRangeForConfig(ct), std::move(proxy));
- DitherShaderBlock::BeginBlock(keyContext, builder, gatherer, data);
- builder->endBlock();
+ DitherShaderBlock::AddBlock(keyContext, builder, gatherer, data);
}
void PaintParams::addPaintColorToKey(const KeyContext& keyContext,