[graphite] Remove custom glue code for local matrix and blend shaders
We now pass the child output variable names into the snippet code after
all the uniforms.
This leaves the following 3 custom glue code generators:
GenerateImageShaderGlueCode -- sampler
GenerateFixedFunctionBlenderGlueCode -- prior stage's output
GenerateShaderBasedBlenderGlueCode -- dst read & prior stage's output
Bug: skia:12701
Change-Id: I9185d8f292cc45d351218b95fa6d7d70d639e2f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536098
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/core/SkShaderCodeDictionary.cpp b/src/core/SkShaderCodeDictionary.cpp
index 80e6052..9bdf826 100644
--- a/src/core/SkShaderCodeDictionary.cpp
+++ b/src/core/SkShaderCodeDictionary.cpp
@@ -286,17 +286,19 @@
using DataPayloadField = SkPaintParamsKey::DataPayloadField;
// The default glue code just calls a helper function with the signature:
-// half4 fStaticFunctionName(/* all uniforms as parameters */);
+// half4 fStaticFunctionName(/* all uniforms as parameters */,
+// /* all child output variable names as parameters */);
// and stores the result in a variable named "resultName".
std::string GenerateDefaultGlueCode(const std::string& resultName,
int entryIndex,
const SkPaintParamsKey::BlockReader& reader,
const std::string& priorStageOutputName,
- const std::vector<std::string>& childNames,
+ const std::vector<std::string>& childOutputVarNames,
int indent) {
- SkASSERT(childNames.empty());
-
const SkShaderSnippet* entry = reader.entry();
+
+ SkASSERT((int)childOutputVarNames.size() == entry->numExpectedChildren());
+
if (entry->needsLocalCoords()) {
// Every snippet that requests local coordinates must have a localMatrix as its first
// uniform
@@ -320,7 +322,13 @@
} else {
result += entry->getMangledUniformName(i, entryIndex);
}
- if (i+1 < entry->fUniforms.size()) {
+ if (i+1 < entry->fUniforms.size() + childOutputVarNames.size()) {
+ result += ", ";
+ }
+ }
+ for (size_t i = 0; i < childOutputVarNames.size(); ++i) {
+ result += childOutputVarNames[i].c_str();
+ if (i+1 < childOutputVarNames.size()) {
result += ", ";
}
}
@@ -369,33 +377,6 @@
static constexpr char kLocalMatrixShaderName[] = "sk_local_matrix_shader";
-// This exists as custom glue code to handle passing the result of the child into the
-// static function. If children were, somehow, handled in the default glue code, we could remove
-// this.
-std::string GenerateLocalMatrixShaderGlueCode(const std::string& resultName,
- int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childOutputVarNames,
- int indent) {
- SkASSERT(childOutputVarNames.size() == kNumLocalMatrixShaderChildren);
-
- const SkShaderSnippet* entry = reader.entry();
-
- std::string localMatrixName = entry->getMangledUniformName(0, entryIndex);
-
- std::string result;
-
- add_indent(&result, indent);
- SkSL::String::appendf(&result,
- "%s = %s(%s, %s);\n",
- resultName.c_str(),
- entry->fStaticFunctionName,
- localMatrixName.c_str(),
- childOutputVarNames[0].c_str());
- return result;
-}
-
//--------------------------------------------------------------------------------------------------
static constexpr int kNumImageShaderUniforms = 6;
static constexpr SkUniform kImageShaderUniforms[kNumImageShaderUniforms] = {
@@ -475,33 +456,7 @@
static constexpr int kNumBlendShaderChildren = 2;
-static constexpr char kBlendHelperName[] = "sk_blend";
-
-// This exists as custom glue code to handle passing the result of the children into the
-// static function. If this were, somehow, handled in the default glue code, we could remove this.
-std::string GenerateBlendShaderGlueCode(const std::string& resultName,
- int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childNames,
- int indent) {
- SkASSERT(childNames.size() == kNumBlendShaderChildren);
- SkASSERT(reader.entry()->fUniforms.size() == 4); // actual blend uniform + 3 padding int
-
- std::string blendModeUniformName = reader.entry()->getMangledUniformName(0, entryIndex);
-
- std::string result;
-
- add_indent(&result, indent);
- SkSL::String::appendf(&result, "%s = %s(%s, %s, %s);\n",
- resultName.c_str(),
- reader.entry()->fStaticFunctionName,
- blendModeUniformName.c_str(),
- childNames[1].c_str(),
- childNames[0].c_str());
-
- return result;
-}
+static constexpr char kBlendShaderName[] = "sk_blend_shader";
//--------------------------------------------------------------------------------------------------
static constexpr char kErrorName[] = "sk_error";
@@ -540,6 +495,8 @@
{ "padding3", SkSLType::kInt },
};
+static constexpr char kBlendHelperName[] = "sk_blend";
+
// This method generates the glue code for the case where the SkBlendMode-based blending must occur
// in the shader (i.e., fixed function blending isn't possible).
// It exists as custom glue code so that we can deal with the dest reads. If that can be
@@ -682,7 +639,7 @@
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kLocalMatrixShaderName,
- GenerateLocalMatrixShaderGlueCode,
+ GenerateDefaultGlueCode,
kNumLocalMatrixShaderChildren,
{ }
};
@@ -701,8 +658,8 @@
{ kBlendShaderUniforms, kNumBlendShaderUniforms },
SnippetRequirementFlags::kNone,
{ }, // no samplers
- kBlendHelperName,
- GenerateBlendShaderGlueCode,
+ kBlendShaderName,
+ GenerateDefaultGlueCode,
kNumBlendShaderChildren,
{ }
};
diff --git a/src/core/SkShaderCodeDictionary.h b/src/core/SkShaderCodeDictionary.h
index 85cfa2b..0a1da13 100644
--- a/src/core/SkShaderCodeDictionary.h
+++ b/src/core/SkShaderCodeDictionary.h
@@ -71,6 +71,8 @@
return fSnippetRequirementFlags & SnippetRequirementFlags::kLocalCoords;
}
+ int numExpectedChildren() const { return fNumChildren; }
+
const char* fName = nullptr;
SkSpan<const SkUniform> fUniforms;
SnippetRequirementFlags fSnippetRequirementFlags;
diff --git a/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl b/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl
index 28b0b86..7d55c35 100644
--- a/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl
+++ b/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl
@@ -1,4 +1,4 @@
-static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {10,0,206,3,
+static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {10,0,0,4,
8,115,107,95,101,114,114,111,114,
5,104,97,108,102,52,
10,99,111,108,111,114,80,97,114,97,109,
@@ -32,10 +32,16 @@
12,114,97,100,105,117,115,49,80,97,114,97,109,
7,112,97,100,100,105,110,103,
23,115,107,95,108,105,110,101,97,114,95,103,114,97,100,95,52,95,115,104,97,100,101,114,
-4,109,111,100,101,
+9,98,108,101,110,100,77,111,100,101,
3,115,114,99,
3,100,115,116,
8,115,107,95,98,108,101,110,100,
+4,112,97,100,48,
+4,112,97,100,49,
+4,112,97,100,50,
+6,99,104,105,108,100,48,
+6,99,104,105,108,100,49,
+15,115,107,95,98,108,101,110,100,95,115,104,97,100,101,114,
4,104,97,108,102,
6,107,67,108,97,109,112,
7,107,82,101,112,101,97,116,
@@ -103,7 +109,7 @@
14,98,108,101,110,100,95,109,117,108,116,105,112,108,121,
10,98,108,101,110,100,95,104,115,108,99,
5,104,97,108,102,50,
-52,1,34,0,
+52,1,41,0,
28,1,0,
17,2,0,0,
51,255,255,11,0,
@@ -196,16 +202,38 @@
17,67,1,
51,255,255,110,0,3,
55,32,0,
-17,72,1,
+17,77,1,
51,255,255,11,0,3,
55,33,0,
-17,76,1,
+17,81,1,
51,255,255,11,0,3,
28,34,0,
-17,80,1,3,31,0,32,0,33,0,
-51,255,255,11,0,7,0,
+17,85,1,3,31,0,32,0,33,0,
+51,255,255,11,0,
+55,35,0,
+17,67,1,
+51,255,255,110,0,3,
+55,36,0,
+17,94,1,
+51,255,255,110,0,3,
+55,37,0,
+17,99,1,
+51,255,255,110,0,3,
+55,38,0,
+17,104,1,
+51,255,255,110,0,3,
+55,39,0,
+17,109,1,
+51,255,255,11,0,3,
+55,40,0,
+17,116,1,
+51,255,255,11,0,3,
+28,41,0,
+17,123,1,6,35,0,36,0,37,0,38,0,39,0,40,0,
+51,255,255,11,0,8,0,
11,0,
33,0,
+40,0,
18,0,
0,0,
29,0,
@@ -219,13 +247,13 @@
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,128,63,1,
+51,255,255,139,1,0,0,128,63,1,
29,3,0,
2,
52,1,0,0,0,0,1,
@@ -241,52 +269,52 @@
29,12,0,
2,
52,1,4,0,
-55,35,0,
+55,42,0,
38,
-16,4,94,1,
+16,4,144,1,
51,255,255,110,0,2,
-55,36,0,
+55,43,0,
38,
-16,4,101,1,
+16,4,151,1,
51,255,255,110,0,2,
-55,37,0,
+55,44,0,
38,
-16,4,109,1,
+16,4,159,1,
51,255,255,110,0,2,
-55,38,0,
+55,45,0,
38,
-16,4,123,1,
+16,4,173,1,
51,255,255,110,0,2,4,0,
0,0,
3,0,
2,0,
1,0,5,
-56,35,0,
+56,42,0,
51,255,255,110,0,0,
36,
51,255,255,110,0,0,0,0,0,
-56,36,0,
+56,43,0,
51,255,255,110,0,0,
36,
51,255,255,110,0,1,0,0,0,
-56,37,0,
+56,44,0,
51,255,255,110,0,0,
36,
51,255,255,110,0,2,0,0,0,
-56,38,0,
+56,45,0,
51,255,255,110,0,0,
36,
51,255,255,110,0,3,0,0,0,
32,0,
1,
57,7,0,0,16,
-57,35,0,0,
+57,42,0,0,
2,
52,1,0,0,0,0,1,
44,
1,
27,
-51,255,255,116,0,255,255,138,1,3,
+51,255,255,116,0,255,255,188,1,3,
57,8,0,0,
57,9,0,0,
57,10,0,0,3,
@@ -294,14 +322,14 @@
32,0,
1,
57,7,0,0,16,
-57,36,0,0,
+57,43,0,0,
2,
52,1,1,0,
-55,39,0,
-17,144,1,
+55,46,0,
+17,194,1,
51,255,255,116,0,2,1,0,
0,0,2,
-56,39,0,
+56,46,0,
51,255,255,116,0,0,
1,
57,10,0,0,1,
@@ -310,63 +338,63 @@
1,
1,
27,
-51,255,255,116,0,255,255,151,1,2,
+51,255,255,116,0,255,255,201,1,2,
1,
57,8,0,0,1,
57,9,0,0,
-57,39,0,0,0,
+57,46,0,0,0,
57,9,0,0,3,
57,11,0,0,1,
32,0,
1,
57,7,0,0,16,
-57,37,0,0,
+57,44,0,0,
2,
52,1,3,0,
-55,40,0,
-17,144,1,
+55,47,0,
+17,194,1,
51,255,255,116,0,2,
-55,41,0,
-17,155,1,
+55,48,0,
+17,205,1,
51,255,255,116,0,2,
-55,42,0,
-17,163,1,
+55,49,0,
+17,213,1,
51,255,255,116,0,2,3,0,
0,0,
1,0,
2,0,4,
-56,40,0,
+56,47,0,
51,255,255,116,0,0,
1,
57,10,0,0,1,
57,9,0,0,
-56,41,0,
+56,48,0,
51,255,255,116,0,0,
1,
25,
51,255,255,116,0,0,0,0,64,2,
-57,40,0,0,
-56,42,0,
+57,47,0,0,
+56,49,0,
51,255,255,116,0,0,
27,
-51,255,255,116,0,255,255,151,1,2,
+51,255,255,116,0,255,255,201,1,2,
1,
57,8,0,0,1,
57,9,0,0,
-57,41,0,0,
+57,48,0,0,
44,
1,
1,
27,
-51,255,255,116,0,255,255,167,1,3,
-57,42,0,0,
+51,255,255,116,0,255,255,217,1,3,
+57,49,0,0,
1,
-57,41,0,0,1,
-57,42,0,0,
+57,48,0,0,1,
+57,49,0,0,
27,
-51,255,255,116,0,255,255,171,1,2,
-57,40,0,0,
-57,42,0,0,0,
+51,255,255,116,0,255,255,221,1,2,
+57,47,0,0,
+57,49,0,0,0,
57,9,0,0,3,
57,11,0,0,1,
2,
@@ -374,7 +402,7 @@
44,
1,
27,
-51,255,255,116,0,255,255,138,1,3,
+51,255,255,116,0,255,255,188,1,3,
57,8,0,0,
57,9,0,0,
57,10,0,0,3,
@@ -382,20 +410,20 @@
29,19,0,
2,
52,1,2,0,
-55,43,0,
-17,176,1,
+55,50,0,
+17,226,1,
51,255,255,28,0,2,
-55,44,0,
-17,188,1,
+55,51,0,
+17,238,1,
51,255,255,209,0,2,2,0,
1,0,
0,0,3,
-56,43,0,
+56,50,0,
51,255,255,28,0,0,
1,
57,13,0,0,2,
-57,255,255,195,1,0,
-56,44,0,
+57,255,255,245,1,0,
+56,51,0,
51,255,255,209,0,0,
8,
51,255,255,209,0,2,
@@ -403,7 +431,7 @@
51,255,255,116,0,12,0,5,
57,15,0,0,
50,
-57,43,0,0,1,0,
+57,50,0,0,1,0,
50,
57,14,0,0,1,0,
50,
@@ -415,7 +443,7 @@
51,255,255,116,0,12,0,5,
57,16,0,0,
50,
-57,43,0,0,1,1,
+57,50,0,0,1,1,
50,
57,14,0,0,1,1,
50,
@@ -424,155 +452,155 @@
51,255,255,116,0,1,
57,18,0,0,
44,
-57,44,0,0,1,
+57,51,0,0,1,
29,30,0,
2,
52,1,5,0,
-55,45,0,
-17,208,1,
+55,52,0,
+17,2,2,
51,255,255,209,0,2,
-55,46,0,
-17,212,1,
+55,53,0,
+17,6,2,
51,255,255,209,0,2,
-55,47,0,
-17,218,1,
+55,54,0,
+17,12,2,
51,255,255,209,0,2,
-55,48,0,
-17,221,1,
+55,55,0,
+17,15,2,
51,255,255,116,0,2,
-55,49,0,
-17,223,1,
+55,56,0,
+17,17,2,
51,255,255,28,0,2,5,0,
1,0,
0,0,
2,0,
4,0,
3,0,9,
-56,45,0,
+56,52,0,
51,255,255,209,0,0,
50,
1,
57,22,0,0,2,
-57,255,255,195,1,0,2,0,1,
-56,46,0,
+57,255,255,245,1,0,2,0,1,
+56,53,0,
51,255,255,209,0,0,
1,
57,26,0,0,1,
57,25,0,0,
-56,47,0,
+56,54,0,
51,255,255,209,0,0,
1,
-57,45,0,0,1,
+57,52,0,0,1,
57,25,0,0,
-56,48,0,
+56,55,0,
51,255,255,116,0,0,
1,
27,
-51,255,255,116,0,255,255,230,1,2,
-57,47,0,0,
-57,46,0,0,3,
+51,255,255,116,0,255,255,24,2,2,
+57,54,0,0,
+57,53,0,0,3,
27,
-51,255,255,116,0,255,255,230,1,2,
-57,46,0,0,
-57,46,0,0,
-56,49,0,
+51,255,255,116,0,255,255,24,2,2,
+57,53,0,0,
+57,53,0,0,
+56,56,0,
51,255,255,28,0,0,
33,
57,23,0,0,
36,
-51,255,255,234,1,0,0,0,0,
+51,255,255,28,2,0,0,0,0,
22,
1,
-57,49,0,1,15,
+57,56,0,1,15,
27,
-51,255,255,28,0,255,255,167,1,3,
-57,49,0,0,
+51,255,255,28,0,255,255,217,1,3,
+57,56,0,0,
33,
57,23,0,0,
36,
-51,255,255,234,1,1,0,0,0,
+51,255,255,28,2,1,0,0,0,
27,
-51,255,255,116,0,255,255,138,1,3,
+51,255,255,116,0,255,255,188,1,3,
1,
1,
-57,48,0,0,1,
+57,55,0,0,1,
33,
57,24,0,0,
36,
-51,255,255,234,1,0,0,0,0,3,
+51,255,255,28,2,0,0,0,0,3,
1,
33,
57,24,0,0,
36,
-51,255,255,234,1,1,0,0,0,1,
+51,255,255,28,2,1,0,0,0,1,
33,
57,24,0,0,
36,
-51,255,255,234,1,0,0,0,0,
+51,255,255,28,2,0,0,0,0,
25,
51,255,255,116,0,0,0,0,0,
25,
51,255,255,116,0,0,0,128,63,
22,
1,
-57,49,0,1,15,
+57,56,0,1,15,
27,
-51,255,255,28,0,255,255,167,1,3,
-57,49,0,0,
+51,255,255,28,0,255,255,217,1,3,
+57,56,0,0,
33,
57,23,0,0,
36,
-51,255,255,234,1,2,0,0,0,
+51,255,255,28,2,2,0,0,0,
27,
-51,255,255,116,0,255,255,138,1,3,
+51,255,255,116,0,255,255,188,1,3,
1,
1,
-57,48,0,0,1,
+57,55,0,0,1,
33,
57,24,0,0,
36,
-51,255,255,234,1,1,0,0,0,3,
+51,255,255,28,2,1,0,0,0,3,
1,
33,
57,24,0,0,
36,
-51,255,255,234,1,2,0,0,0,1,
+51,255,255,28,2,2,0,0,0,1,
33,
57,24,0,0,
36,
-51,255,255,234,1,1,0,0,0,
+51,255,255,28,2,1,0,0,0,
25,
51,255,255,116,0,0,0,0,0,
25,
51,255,255,116,0,0,0,128,63,
22,
1,
-57,49,0,1,15,
+57,56,0,1,15,
27,
-51,255,255,28,0,255,255,167,1,3,
-57,49,0,0,
+51,255,255,28,0,255,255,217,1,3,
+57,56,0,0,
33,
57,23,0,0,
36,
-51,255,255,234,1,3,0,0,0,
+51,255,255,28,2,3,0,0,0,
27,
-51,255,255,116,0,255,255,138,1,3,
+51,255,255,116,0,255,255,188,1,3,
1,
1,
-57,48,0,0,1,
+57,55,0,0,1,
33,
57,24,0,0,
36,
-51,255,255,234,1,2,0,0,0,3,
+51,255,255,28,2,2,0,0,0,3,
1,
33,
57,24,0,0,
36,
-51,255,255,234,1,3,0,0,0,1,
+51,255,255,28,2,3,0,0,0,1,
33,
57,24,0,0,
36,
-51,255,255,234,1,2,0,0,0,
+51,255,255,28,2,2,0,0,0,
25,
51,255,255,116,0,0,0,0,0,
25,
@@ -580,41 +608,13 @@
44,
9,
51,255,255,11,0,1,
-57,49,0,0,1,
+57,56,0,0,1,
29,34,0,
2,
52,1,29,0,
-55,50,0,
-38,
-16,4,246,1,
-51,255,255,110,0,2,
-55,51,0,
-38,
-16,4,253,1,
-51,255,255,110,0,2,
-55,52,0,
-38,
-16,4,2,2,
-51,255,255,110,0,2,
-55,53,0,
-38,
-16,4,7,2,
-51,255,255,110,0,2,
-55,54,0,
-38,
-16,4,16,2,
-51,255,255,110,0,2,
-55,55,0,
-38,
-16,4,25,2,
-51,255,255,110,0,2,
-55,56,0,
-38,
-16,4,32,2,
-51,255,255,110,0,2,
55,57,0,
38,
-16,4,39,2,
+16,4,40,2,
51,255,255,110,0,2,
55,58,0,
38,
@@ -622,83 +622,111 @@
51,255,255,110,0,2,
55,59,0,
38,
-16,4,55,2,
+16,4,52,2,
51,255,255,110,0,2,
55,60,0,
38,
-16,4,64,2,
+16,4,57,2,
51,255,255,110,0,2,
55,61,0,
38,
-16,4,73,2,
+16,4,66,2,
51,255,255,110,0,2,
55,62,0,
38,
-16,4,78,2,
+16,4,75,2,
51,255,255,110,0,2,
55,63,0,
38,
-16,4,84,2,
+16,4,82,2,
51,255,255,110,0,2,
55,64,0,
38,
-16,4,94,2,
+16,4,89,2,
51,255,255,110,0,2,
55,65,0,
38,
-16,4,102,2,
+16,4,97,2,
51,255,255,110,0,2,
55,66,0,
38,
-16,4,111,2,
+16,4,105,2,
51,255,255,110,0,2,
55,67,0,
38,
-16,4,119,2,
+16,4,114,2,
51,255,255,110,0,2,
55,68,0,
38,
-16,4,128,2,
+16,4,123,2,
51,255,255,110,0,2,
55,69,0,
38,
-16,4,140,2,
+16,4,128,2,
51,255,255,110,0,2,
55,70,0,
38,
-16,4,151,2,
+16,4,134,2,
51,255,255,110,0,2,
55,71,0,
38,
-16,4,162,2,
+16,4,144,2,
51,255,255,110,0,2,
55,72,0,
38,
-16,4,173,2,
+16,4,152,2,
51,255,255,110,0,2,
55,73,0,
38,
-16,4,185,2,
+16,4,161,2,
51,255,255,110,0,2,
55,74,0,
38,
-16,4,196,2,
+16,4,169,2,
51,255,255,110,0,2,
55,75,0,
38,
-16,4,206,2,
+16,4,178,2,
51,255,255,110,0,2,
55,76,0,
38,
-16,4,211,2,
+16,4,190,2,
51,255,255,110,0,2,
55,77,0,
38,
-16,4,223,2,
+16,4,201,2,
51,255,255,110,0,2,
55,78,0,
38,
-16,4,230,2,
+16,4,212,2,
+51,255,255,110,0,2,
+55,79,0,
+38,
+16,4,223,2,
+51,255,255,110,0,2,
+55,80,0,
+38,
+16,4,235,2,
+51,255,255,110,0,2,
+55,81,0,
+38,
+16,4,246,2,
+51,255,255,110,0,2,
+55,82,0,
+38,
+16,4,0,3,
+51,255,255,110,0,2,
+55,83,0,
+38,
+16,4,5,3,
+51,255,255,110,0,2,
+55,84,0,
+38,
+16,4,17,3,
+51,255,255,110,0,2,
+55,85,0,
+38,
+16,4,24,3,
51,255,255,110,0,2,29,0,
0,0,
27,0,
@@ -729,131 +757,124 @@
7,0,
3,0,
11,0,30,
-56,50,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,0,0,0,0,
-56,51,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,1,0,0,0,
-56,52,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,2,0,0,0,
-56,53,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,3,0,0,0,
-56,54,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,4,0,0,0,
-56,55,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,5,0,0,0,
-56,56,0,
-51,255,255,110,0,0,
-36,
-51,255,255,110,0,6,0,0,0,
56,57,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,7,0,0,0,
+51,255,255,110,0,0,0,0,0,
56,58,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,8,0,0,0,
+51,255,255,110,0,1,0,0,0,
56,59,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,9,0,0,0,
+51,255,255,110,0,2,0,0,0,
56,60,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,10,0,0,0,
+51,255,255,110,0,3,0,0,0,
56,61,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,11,0,0,0,
+51,255,255,110,0,4,0,0,0,
56,62,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,12,0,0,0,
+51,255,255,110,0,5,0,0,0,
56,63,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,13,0,0,0,
+51,255,255,110,0,6,0,0,0,
56,64,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,14,0,0,0,
+51,255,255,110,0,7,0,0,0,
56,65,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,15,0,0,0,
+51,255,255,110,0,8,0,0,0,
56,66,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,16,0,0,0,
+51,255,255,110,0,9,0,0,0,
56,67,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,17,0,0,0,
+51,255,255,110,0,10,0,0,0,
56,68,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,18,0,0,0,
+51,255,255,110,0,11,0,0,0,
56,69,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,19,0,0,0,
+51,255,255,110,0,12,0,0,0,
56,70,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,20,0,0,0,
+51,255,255,110,0,13,0,0,0,
56,71,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,21,0,0,0,
+51,255,255,110,0,14,0,0,0,
56,72,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,22,0,0,0,
+51,255,255,110,0,15,0,0,0,
56,73,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,23,0,0,0,
+51,255,255,110,0,16,0,0,0,
56,74,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,24,0,0,0,
+51,255,255,110,0,17,0,0,0,
56,75,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,25,0,0,0,
+51,255,255,110,0,18,0,0,0,
56,76,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,26,0,0,0,
+51,255,255,110,0,19,0,0,0,
56,77,0,
51,255,255,110,0,0,
36,
-51,255,255,110,0,27,0,0,0,
+51,255,255,110,0,20,0,0,0,
56,78,0,
51,255,255,110,0,0,
36,
+51,255,255,110,0,21,0,0,0,
+56,79,0,
+51,255,255,110,0,0,
+36,
+51,255,255,110,0,22,0,0,0,
+56,80,0,
+51,255,255,110,0,0,
+36,
+51,255,255,110,0,23,0,0,0,
+56,81,0,
+51,255,255,110,0,0,
+36,
+51,255,255,110,0,24,0,0,0,
+56,82,0,
+51,255,255,110,0,0,
+36,
+51,255,255,110,0,25,0,0,0,
+56,83,0,
+51,255,255,110,0,0,
+36,
+51,255,255,110,0,26,0,0,0,
+56,84,0,
+51,255,255,110,0,0,
+36,
+51,255,255,110,0,27,0,0,0,
+56,85,0,
+51,255,255,110,0,0,
+36,
51,255,255,110,0,28,0,0,0,
49,0,
52,1,29,0,
-51,50,0,
-51,51,0,
-51,52,0,
-51,53,0,
-51,54,0,
-51,55,0,
-51,56,0,
51,57,0,
51,58,0,
51,59,0,
@@ -875,7 +896,14 @@
51,75,0,
51,76,0,
51,77,0,
-51,78,0,29,0,
+51,78,0,
+51,79,0,
+51,80,0,
+51,81,0,
+51,82,0,
+51,83,0,
+51,84,0,
+51,85,0,29,0,
0,0,
27,0,
19,0,
@@ -910,337 +938,346 @@
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,242,2,2,
+51,255,255,11,0,255,255,36,3,2,
57,32,0,0,
57,33,0,0,1,0,1,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,254,2,2,
+51,255,255,11,0,255,255,48,3,2,
57,32,0,0,
57,33,0,0,1,0,2,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,3,2,
+51,255,255,11,0,255,255,58,3,2,
57,32,0,0,
57,33,0,0,1,0,3,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,191,1,0,4,0,0,0,
+51,255,255,139,1,0,0,128,191,1,0,4,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,128,191,
+51,255,255,139,1,0,0,128,191,
25,
-51,255,255,89,1,0,0,0,0,1,0,5,0,0,0,
+51,255,255,139,1,0,0,0,0,1,0,5,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,0,0,1,0,6,0,0,0,
+51,255,255,139,1,0,0,0,0,1,0,6,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,63,1,0,7,0,0,0,
+51,255,255,139,1,0,0,128,63,1,0,7,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,191,
+51,255,255,139,1,0,0,128,191,
25,
-51,255,255,89,1,0,0,0,0,1,0,8,0,0,0,
+51,255,255,139,1,0,0,0,0,1,0,8,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,191,1,0,9,0,0,0,
+51,255,255,139,1,0,0,128,191,1,0,9,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,128,191,1,0,10,0,0,0,
+51,255,255,139,1,0,0,128,191,1,0,10,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,191,
+51,255,255,139,1,0,0,128,191,
25,
-51,255,255,89,1,0,0,128,63,1,0,11,0,0,0,
+51,255,255,139,1,0,0,128,63,1,0,11,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,191,
+51,255,255,139,1,0,0,128,191,
25,
-51,255,255,89,1,0,0,128,191,1,0,12,0,0,0,
+51,255,255,139,1,0,0,128,191,1,0,12,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,18,3,3,
+51,255,255,11,0,255,255,68,3,3,
57,32,0,0,
57,33,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,0,0,1,0,13,0,0,0,
+51,255,255,139,1,0,0,0,0,1,0,13,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,36,3,2,
+51,255,255,11,0,255,255,86,3,2,
57,32,0,0,
57,33,0,0,1,0,14,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,51,3,2,
+51,255,255,11,0,255,255,101,3,2,
57,32,0,0,
57,33,0,0,1,0,15,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,64,3,3,
+51,255,255,11,0,255,255,114,3,3,
57,32,0,0,
57,33,0,0,
25,
-51,255,255,89,1,0,0,0,0,1,0,16,0,0,0,
+51,255,255,139,1,0,0,0,0,1,0,16,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,78,3,3,
+51,255,255,11,0,255,255,128,3,3,
57,32,0,0,
57,33,0,0,
25,
-51,255,255,89,1,0,0,128,63,1,0,17,0,0,0,
+51,255,255,139,1,0,0,128,63,1,0,17,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,78,3,3,
+51,255,255,11,0,255,255,128,3,3,
57,32,0,0,
57,33,0,0,
25,
-51,255,255,89,1,0,0,128,191,1,0,18,0,0,0,
+51,255,255,139,1,0,0,128,191,1,0,18,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,91,3,2,
+51,255,255,11,0,255,255,141,3,2,
57,32,0,0,
57,33,0,0,1,0,19,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,109,3,2,
+51,255,255,11,0,255,255,159,3,2,
57,32,0,0,
57,33,0,0,1,0,20,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,64,3,3,
+51,255,255,11,0,255,255,114,3,3,
57,32,0,0,
57,33,0,0,
25,
-51,255,255,89,1,0,0,128,63,1,0,21,0,0,0,
-2,
-52,1,0,0,0,0,1,
-44,
-27,
-51,255,255,11,0,255,255,126,3,2,
-57,32,0,0,
-57,33,0,0,1,0,22,0,0,0,
-2,
-52,1,0,0,0,0,1,
-44,
-27,
-51,255,255,11,0,255,255,143,3,2,
-57,32,0,0,
-57,33,0,0,1,0,23,0,0,0,
-2,
-52,1,0,0,0,0,1,
-44,
-27,
-51,255,255,11,0,255,255,160,3,2,
-57,32,0,0,
-57,33,0,0,1,0,24,0,0,0,
+51,255,255,139,1,0,0,128,63,1,0,21,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
51,255,255,11,0,255,255,176,3,2,
57,32,0,0,
+57,33,0,0,1,0,22,0,0,0,
+2,
+52,1,0,0,0,0,1,
+44,
+27,
+51,255,255,11,0,255,255,193,3,2,
+57,32,0,0,
+57,33,0,0,1,0,23,0,0,0,
+2,
+52,1,0,0,0,0,1,
+44,
+27,
+51,255,255,11,0,255,255,210,3,2,
+57,32,0,0,
+57,33,0,0,1,0,24,0,0,0,
+2,
+52,1,0,0,0,0,1,
+44,
+27,
+51,255,255,11,0,255,255,226,3,2,
+57,32,0,0,
57,33,0,0,1,0,25,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,191,3,3,
+51,255,255,11,0,255,255,241,3,3,
57,32,0,0,
57,33,0,0,
8,
-51,255,255,202,3,2,
+51,255,255,252,3,2,
25,
-51,255,255,89,1,0,0,0,0,
+51,255,255,139,1,0,0,0,0,
25,
-51,255,255,89,1,0,0,128,63,1,0,26,0,0,0,
+51,255,255,139,1,0,0,128,63,1,0,26,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,191,3,3,
+51,255,255,11,0,255,255,241,3,3,
57,32,0,0,
57,33,0,0,
13,
-51,255,255,202,3,1,
+51,255,255,252,3,1,
25,
-51,255,255,89,1,0,0,128,63,1,0,27,0,0,0,
+51,255,255,139,1,0,0,128,63,1,0,27,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,191,3,3,
+51,255,255,11,0,255,255,241,3,3,
57,32,0,0,
57,33,0,0,
13,
-51,255,255,202,3,1,
+51,255,255,252,3,1,
25,
-51,255,255,89,1,0,0,0,0,1,0,28,0,0,0,
+51,255,255,139,1,0,0,0,0,1,0,28,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,191,3,3,
+51,255,255,11,0,255,255,241,3,3,
57,32,0,0,
57,33,0,0,
8,
-51,255,255,202,3,2,
+51,255,255,252,3,2,
25,
-51,255,255,89,1,0,0,128,63,
+51,255,255,139,1,0,0,128,63,
25,
-51,255,255,89,1,0,0,0,0,1,1,
+51,255,255,139,1,0,0,0,0,1,1,
44,
13,
51,255,255,11,0,1,
25,
-51,255,255,89,1,0,0,0,0,1,
+51,255,255,139,1,0,0,0,0,1,
+29,41,0,
+2,
+52,1,0,0,0,0,1,
+44,
+27,
+51,255,255,11,0,34,0,3,
+57,35,0,0,
+57,40,0,0,
+57,39,0,0,1,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_graphite_frag_LENGTH = sizeof(SKSL_INCLUDE_sksl_graphite_frag);
diff --git a/src/sksl/sksl_graphite_frag.sksl b/src/sksl/sksl_graphite_frag.sksl
index c4f9f9f..cff6568 100644
--- a/src/sksl/sksl_graphite_frag.sksl
+++ b/src/sksl/sksl_graphite_frag.sksl
@@ -73,7 +73,7 @@
return half4(result);
}
-half4 sk_blend(int mode, half4 src, half4 dst) {
+half4 sk_blend(int blendMode, half4 src, half4 dst) {
const int kClear = 0;
const int kSrc = 1;
const int kDst = 2;
@@ -104,7 +104,7 @@
const int kColor = 27;
const int kLuminosity = 28;
- switch (mode) {
+ switch (blendMode) {
case kClear: { return blend_clear(src, dst); }
case kSrc: { return blend_src(src, dst); }
case kDst: { return blend_dst(src, dst); }
@@ -137,3 +137,7 @@
default: return half4(0); // Avoids 'blend can exit without returning a value' error
}
}
+
+half4 sk_blend_shader(int blendMode, int pad0, int pad1, int pad2, half4 child0, half4 child1) {
+ return sk_blend(blendMode, child1, child0);
+}