Remove sample-with-matrix from SkSL

This is completely unused - GrMatrixEffect is the only thing that deals
with matrix transforms on child sampling. Removing this makes everything
simpler to reason about.

Change-Id: I555a3fd937c064f2480b149a6d4d8e36f7ee69bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402176
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Osman 2021-04-28 10:04:50 -04:00 committed by Skia Commit-Bot
parent a94e0261ef
commit bf3e9e9591
43 changed files with 55 additions and 1016 deletions

View File

@ -31,13 +31,6 @@ sksl_dsl_fp_tests = [
sksl_fp_tests = [
"/sksl/fp/GrChildProcessorAndGlobal.fp",
"/sksl/fp/GrChildProcessorSampleCoords.fp",
"/sksl/fp/GrChildProcessorSampleMatrixAndCoords.fp",
"/sksl/fp/GrChildProcessorSampleMatrixConstant.fp",
"/sksl/fp/GrChildProcessorSampleMatrixConstantAndCoords.fp",
"/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.fp",
"/sksl/fp/GrChildProcessorSampleMatrixSingleInUniform.fp",
"/sksl/fp/GrChildProcessorSampleMatrixSingleUniform.fp",
"/sksl/fp/GrChildProcessorSampleMatrixSingleUniformExpr.fp",
"/sksl/fp/GrChildProcessorSampleWithColor.fp",
"/sksl/fp/GrChildProcessorWithInputExpression.fp",
"/sksl/fp/GrChildProcessors.fp",
@ -579,10 +572,7 @@ sksl_rte_tests = [
"/sksl/runtime/GlobalVariables.rte",
"/sksl/runtime/LoopInt.rte",
"/sksl/runtime/LoopFloat.rte",
"/sksl/runtime/SampleWithConstantMatrix.rte",
"/sksl/runtime/SampleWithExplicitCoord.rte",
"/sksl/runtime/SampleWithUniformMatrix.rte",
"/sksl/runtime/SampleWithVariableMatrix.rte",
"/sksl/runtime/VectorIndexing.rte",
]

View File

@ -364,7 +364,6 @@ DSLExpression Sample(DSLExpression fp, PositionInfo pos = PositionInfo());
/**
* Implements the following functions:
* half4 sample(fragmentProcessor fp, float3x3 transform);
* half4 sample(fragmentProcessor fp, float2 coords);
* half4 sample(fragmentProcessor fp, half4 input);
*/
@ -372,7 +371,6 @@ DSLExpression Sample(DSLExpression target, DSLExpression x, PositionInfo pos = P
/**
* Implements the following functions:
* half4 sample(fragmentProcessor fp, float3x3 transform, half4 input);
* half4 sample(fragmentProcessor fp, float2 coords, half4 input);
*/
DSLExpression Sample(DSLExpression childProcessor, DSLExpression x, DSLExpression y,

View File

@ -1,14 +1,11 @@
in fragmentProcessor fp1, fp2, fp3;
in fragmentProcessor fp1, fp2;
half4 main() {
const float2 coords = float2(0.5);
const float3x3 xform = float3x3(2);
const half4 inColor = half4(0.75);
return sample(fp1) *
sample(fp2, coords) *
sample(fp3, xform) *
sample(fp1, inColor) *
sample(fp2, coords, inColor) *
sample(fp3, xform, inColor);
sample(fp2, coords, inColor);
}

View File

@ -1,7 +0,0 @@
uniform half4 color;
in fragmentProcessor child;
half4 main(float2 coord) {
float3x3 matrix = float3x3(color.a);
return sample(child, matrix) * sample(child, coord / 2);
}

View File

@ -1,5 +0,0 @@
in fragmentProcessor child;
half4 main() {
return sample(child, float3x3(2));
}

View File

@ -1,5 +0,0 @@
in fragmentProcessor child;
half4 main(float2 coord) {
return sample(child, float3x3(0.5)) * sample(child, coord / 2);
}

View File

@ -1,7 +0,0 @@
in fragmentProcessor child;
in uniform float3x3 matrixA;
in uniform float3x3 matrixB;
half4 main() {
return sample(child, matrixA) + sample(child, matrixB);
}

View File

@ -1,6 +0,0 @@
in fragmentProcessor child;
in uniform float3x3 matrix;
half4 main() {
return sample(child, matrix);
}

View File

@ -1,6 +0,0 @@
in fragmentProcessor child;
uniform float3x3 matrix;
half4 main() {
return sample(child, matrix);
}

View File

@ -1,6 +0,0 @@
in fragmentProcessor child;
uniform float3x3 matrix;
half4 main() {
return sample(child, 0.5 * matrix);
}

View File

@ -1,17 +1,9 @@
uniform half4 C;
uniform float3x3 M0;
uniform float3x3 M1;
in fragmentProcessor passthrough;
in fragmentProcessor explicit;
in fragmentProcessor matrix_const;
in fragmentProcessor matrix_uniform;
in fragmentProcessor matrix_uniform_multi;
half4 main(float2 coord) {
return sample(passthrough, C) +
sample(explicit, coord / 2, C) +
sample(matrix_const, float3x3(2), C) +
sample(matrix_uniform, M0, C) +
sample(matrix_uniform_multi, M0, C) + sample(matrix_uniform_multi, M1, C);
sample(explicit, coord / 2, C);
}

View File

@ -1,6 +0,0 @@
uniform shader child;
half4 main() {
return sample(child, float3x3(2, 0, 0,
0, 1, 0,
0, 0, 1));
}

View File

@ -1,5 +0,0 @@
uniform shader child;
uniform float3x3 matrix;
half4 main() {
return sample(child, matrix);
}

View File

@ -1,7 +0,0 @@
uniform shader child;
half4 main() {
float x = sqrt(1.0);
return sample(child, float3x3(x, 0, 0,
0, x, 0,
0, 0, 1));
}

View File

@ -1,4 +1,4 @@
static uint8_t SKSL_INCLUDE_sksl_fp[] = {18,1,
static uint8_t SKSL_INCLUDE_sksl_fp[] = {255,0,
14,71,114,67,108,105,112,69,100,103,101,84,121,112,101,
12,80,77,67,111,110,118,101,114,115,105,111,110,
0,
@ -12,8 +12,6 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {18,1,
2,102,112,
17,102,114,97,103,109,101,110,116,80,114,111,99,101,115,115,111,114,
6,115,97,109,112,108,101,
9,116,114,97,110,115,102,111,114,109,
8,102,108,111,97,116,51,120,51,
6,99,111,111,114,100,115,
6,102,108,111,97,116,50,
5,105,110,112,117,116,
@ -24,7 +22,7 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {18,1,
5,107,76,97,115,116,
9,107,84,111,80,114,101,109,117,108,
11,107,84,111,85,110,112,114,101,109,117,108,
49,32,0,
49,23,0,
22,1,0,2,0,
22,2,0,17,0,
53,3,0,
@ -60,7 +58,7 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {18,1,
47,12,0,3,
53,15,0,
16,163,0,
50,16,0,173,0,3,
50,16,0,170,0,3,
52,17,0,2,
47,13,0,
30,18,0,
@ -71,96 +69,62 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {18,1,
16,135,0,
47,12,0,3,
53,20,0,
16,182,0,
50,21,0,189,0,3,
52,22,0,3,
16,177,0,
47,8,0,3,
52,21,0,3,
47,13,0,
47,18,0,
30,23,0,
30,22,0,
16,156,0,2,19,0,20,0,
47,8,0,
47,23,0,
53,24,0,
47,22,0,
53,23,0,
16,135,0,
47,12,0,3,
53,24,0,
16,163,0,
47,16,0,3,
53,25,0,
16,196,0,
16,177,0,
47,8,0,3,
52,26,0,4,
47,13,0,
47,18,0,
47,23,0,
47,22,0,
30,27,0,
16,156,0,2,24,0,25,0,
16,156,0,3,23,0,24,0,25,0,
47,8,0,
47,27,0,
53,28,0,
16,135,0,
47,12,0,3,
53,29,0,
16,163,0,
47,16,0,3,
53,30,0,
16,196,0,
47,8,0,3,
52,31,0,5,
47,13,0,
47,18,0,
47,23,0,
47,27,0,
30,32,0,
16,156,0,3,28,0,29,0,30,0,
47,8,0,
47,32,0,
53,33,0,
16,135,0,
47,12,0,3,
53,34,0,
16,182,0,
47,21,0,3,
53,35,0,
16,196,0,
47,8,0,3,
52,36,0,6,
47,13,0,
47,18,0,
47,23,0,
47,27,0,
47,32,0,
30,37,0,
16,156,0,3,33,0,34,0,35,0,
47,8,0,
47,37,0,8,0,
47,27,0,8,0,
0,0,
1,0,
5,0,
6,0,
4,0,
7,0,
30,0,
21,0,
2,0,
19,
21,2,0,
49,5,0,
53,38,0,
53,28,0,
37,
15,1,202,0,
15,1,183,0,
47,1,0,0,
53,39,0,
53,29,0,
37,
15,1,210,0,
15,1,191,0,
47,1,0,0,
53,40,0,
53,30,0,
37,
15,1,218,0,
15,1,199,0,
47,1,0,0,
53,41,0,
53,31,0,
37,
15,1,233,0,
15,1,214,0,
47,1,0,0,
53,42,0,
53,32,0,
37,
15,1,248,0,
15,1,229,0,
47,1,0,0,5,0,
1,0,
0,0,
@ -169,17 +133,17 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {18,1,
4,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,
21,17,0,
49,3,0,
53,43,0,
53,33,0,
37,
15,1,254,0,
15,1,235,0,
47,2,0,0,
53,44,0,
53,34,0,
37,
15,1,8,1,
15,1,245,0,
47,2,0,0,
53,45,0,
53,35,0,
37,
15,1,248,0,
15,1,229,0,
47,2,0,0,3,0,
2,0,
0,0,

View File

@ -1,4 +1,4 @@
static uint8_t SKSL_INCLUDE_sksl_runtime[] = {90,0,
static uint8_t SKSL_INCLUDE_sksl_runtime[] = {71,0,
0,
12,115,107,95,70,114,97,103,67,111,111,114,100,
6,102,108,111,97,116,52,
@ -6,13 +6,11 @@ static uint8_t SKSL_INCLUDE_sksl_runtime[] = {90,0,
6,115,104,97,100,101,114,
6,115,97,109,112,108,101,
5,104,97,108,102,52,
9,116,114,97,110,115,102,111,114,109,
8,102,108,111,97,116,51,120,51,
6,99,111,111,114,100,115,
6,102,108,111,97,116,50,
1,102,
11,99,111,108,111,114,70,105,108,116,101,114,
49,14,0,
49,10,0,
53,1,0,
37,
36,0,32,0,0,255,255,255,255,255,15,0,255,255,255,255,2,0,0,0,3,0,
@ -28,7 +26,7 @@ static uint8_t SKSL_INCLUDE_sksl_runtime[] = {90,0,
47,4,0,3,
53,8,0,
16,45,0,
50,9,0,55,0,3,
50,9,0,52,0,3,
52,10,0,2,
47,5,0,
30,11,0,
@ -36,30 +34,16 @@ static uint8_t SKSL_INCLUDE_sksl_runtime[] = {90,0,
47,6,0,
47,11,0,
53,12,0,
16,23,0,
47,4,0,3,
53,13,0,
16,64,0,
50,14,0,71,0,3,
52,15,0,3,
16,59,0,
50,13,0,61,0,3,
52,14,0,3,
47,5,0,
47,11,0,
30,16,0,
16,32,0,2,12,0,13,0,
30,15,0,
16,32,0,1,12,0,
47,6,0,
47,16,0,
53,17,0,
16,78,0,
50,18,0,80,0,3,
52,19,0,4,
47,5,0,
47,11,0,
47,16,0,
30,20,0,
16,32,0,1,17,0,
47,6,0,
47,20,0,2,0,
12,0,
47,15,0,2,0,
8,0,
0,0,
19,
55,

View File

@ -13,9 +13,7 @@ layout(builtin=9999) half4 gl_LastFragColorARM;
layout(builtin=9999) half4 gl_SecondaryFragColorEXT;
half4 sample(fragmentProcessor fp);
half4 sample(fragmentProcessor fp, float3x3 transform);
half4 sample(fragmentProcessor fp, float2 coords);
half4 sample(fragmentProcessor fp, half4 input);
half4 sample(fragmentProcessor fp, float3x3 transform, half4 input);
half4 sample(fragmentProcessor fp, float2 coords, half4 input);

View File

@ -8,7 +8,6 @@ layout(builtin=15) float4 sk_FragCoord;
// skbug.com/11813
half4 sample(shader s);
half4 sample(shader s, float3x3 transform);
half4 sample(shader s, float2 coords);
half4 sample(colorFilter f);

View File

@ -1533,11 +1533,8 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLSampleFragmentProcessor, r, ctxInfo) {
DSLVar child(kUniform_Modifier, kFragmentProcessor_Type, "child");
EXPECT_EQUAL(Sample(child), "sample(child)");
EXPECT_EQUAL(Sample(child, Float2(0, 0)), "sample(child, float2(0.0, 0.0))");
EXPECT_EQUAL(Sample(child, Float3x3(1.0)), "sample(child, float3x3(1.0))");
EXPECT_EQUAL(Sample(child, Half4(1)), "sample(child, half4(1.0))");
EXPECT_EQUAL(Sample(child, Float2(0), Half4(1)), "sample(child, float2(0.0), half4(1.0))");
EXPECT_EQUAL(Sample(child, Float3x3(1.0), Half4(1)),
"sample(child, float3x3(1.0), half4(1.0))");
{
ExpectError error(r, "error: no match for sample(fragmentProcessor, bool)\n");
@ -1551,7 +1548,6 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLSampleShader, r, ctxInfo) {
DSLVar shader(kUniform_Modifier, kShader_Type, "shader");
EXPECT_EQUAL(Sample(shader), "sample(shader)");
EXPECT_EQUAL(Sample(shader, Float2(0, 0)), "sample(shader, float2(0.0, 0.0))");
EXPECT_EQUAL(Sample(shader, Float3x3(1)), "sample(shader, float3x3(1.0))");
{
ExpectError error(r, "error: no match for sample(shader, half4)\n");

View File

@ -25,12 +25,10 @@ public:
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);
Var _coords(kConst_Modifier, DSLType(kFloat2_Type), "coords", Float2(0.5f));
Var _xform(kConst_Modifier, DSLType(kFloat3x3_Type), "xform", Float3x3(2.0f));
Var _inColor(kConst_Modifier, DSLType(kHalf4_Type), "inColor", Half4(0.75f));
Declare(_coords);
Declare(_xform);
Declare(_inColor);
Return(((((SampleChild(0) * SampleChild(1, _coords)) * SampleChild(2, _xform)) * SampleChild(0, _inColor)) * SampleChild(1, _coords, _inColor)) * SampleChild(2, _xform, _inColor));
Return(((SampleChild(0) * SampleChild(1, _coords)) * SampleChild(0, _inColor)) * SampleChild(1, _coords, _inColor));
EndFragmentProcessor();
}
private:

View File

@ -14,18 +14,17 @@
class GrDSLFPTest_Sample : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp1, std::unique_ptr<GrFragmentProcessor> fp2, std::unique_ptr<GrFragmentProcessor> fp3) {
return std::unique_ptr<GrFragmentProcessor>(new GrDSLFPTest_Sample(std::move(fp1), std::move(fp2), std::move(fp3)));
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp1, std::unique_ptr<GrFragmentProcessor> fp2) {
return std::unique_ptr<GrFragmentProcessor>(new GrDSLFPTest_Sample(std::move(fp1), std::move(fp2)));
}
GrDSLFPTest_Sample(const GrDSLFPTest_Sample& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "DSLFPTest_Sample"; }
private:
GrDSLFPTest_Sample(std::unique_ptr<GrFragmentProcessor> fp1, std::unique_ptr<GrFragmentProcessor> fp2, std::unique_ptr<GrFragmentProcessor> fp3)
GrDSLFPTest_Sample(std::unique_ptr<GrFragmentProcessor> fp1, std::unique_ptr<GrFragmentProcessor> fp2)
: INHERITED(kGrDSLFPTest_Sample_ClassID, kNone_OptimizationFlags) {
this->registerChild(std::move(fp1), SkSL::SampleUsage::PassThrough());
this->registerChild(std::move(fp2), SkSL::SampleUsage::Explicit());
this->registerChild(std::move(fp3), SkSL::SampleUsage::VariableMatrix(true));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;

View File

@ -1,63 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixAndCoords.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixAndCoords.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixAndCoords : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixAndCoords() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixAndCoords& _outer = args.fFp.cast<GrChildProcessorSampleMatrixAndCoords>();
(void) _outer;
colorVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf4_GrSLType, "color");
fragBuilder->codeAppendf(
R"SkSL(float3x3 matrix = float3x3(float(%s.w));)SkSL"
, args.fUniformHandler->getUniformCStr(colorVar));
SkString _matrix0("matrix");
SkString _sample0 = this->invokeChildWithMatrix(0, args, _matrix0.c_str());
SkString _coords1 = SkStringPrintf("%s / 2.0", args.fSampleCoord);
SkString _sample1 = this->invokeChild(0, args, _coords1.c_str());
fragBuilder->codeAppendf(
R"SkSL(
return %s * %s;
)SkSL"
, _sample0.c_str(), _sample1.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
UniformHandle colorVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixAndCoords::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixAndCoords>();
}
void GrChildProcessorSampleMatrixAndCoords::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixAndCoords::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixAndCoords& that = other.cast<GrChildProcessorSampleMatrixAndCoords>();
(void) that;
return true;
}
GrChildProcessorSampleMatrixAndCoords::GrChildProcessorSampleMatrixAndCoords(const GrChildProcessorSampleMatrixAndCoords& src)
: INHERITED(kGrChildProcessorSampleMatrixAndCoords_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
this->setUsesSampleCoordsDirectly();
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixAndCoords::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixAndCoords>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixAndCoords::onDumpInfo() const {
return SkString();
}
#endif

View File

@ -1,38 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixAndCoords.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixAndCoords_DEFINED
#define GrChildProcessorSampleMatrixAndCoords_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixAndCoords : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixAndCoords(std::move(child)));
}
GrChildProcessorSampleMatrixAndCoords(const GrChildProcessorSampleMatrixAndCoords& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixAndCoords"; }
private:
GrChildProcessorSampleMatrixAndCoords(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kGrChildProcessorSampleMatrixAndCoords_ClassID, kNone_OptimizationFlags) {
this->setUsesSampleCoordsDirectly();
this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kVariable, "", true, true, false));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -1,53 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixConstant.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixConstant.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixConstant : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixConstant() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixConstant& _outer = args.fFp.cast<GrChildProcessorSampleMatrixConstant>();
(void) _outer;
SkString _sample0 = this->invokeChildWithMatrix(0, args);
fragBuilder->codeAppendf(
R"SkSL(return %s;
)SkSL"
, _sample0.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixConstant::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixConstant>();
}
void GrChildProcessorSampleMatrixConstant::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixConstant::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixConstant& that = other.cast<GrChildProcessorSampleMatrixConstant>();
(void) that;
return true;
}
GrChildProcessorSampleMatrixConstant::GrChildProcessorSampleMatrixConstant(const GrChildProcessorSampleMatrixConstant& src)
: INHERITED(kGrChildProcessorSampleMatrixConstant_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixConstant::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixConstant>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixConstant::onDumpInfo() const {
return SkString();
}
#endif

View File

@ -1,37 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixConstant.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixConstant_DEFINED
#define GrChildProcessorSampleMatrixConstant_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixConstant : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixConstant(std::move(child)));
}
GrChildProcessorSampleMatrixConstant(const GrChildProcessorSampleMatrixConstant& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixConstant"; }
private:
GrChildProcessorSampleMatrixConstant(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kGrChildProcessorSampleMatrixConstant_ClassID, kNone_OptimizationFlags) {
this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("float3x3(2.0)", true));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -1,56 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixConstantAndCoords.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixConstantAndCoords.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixConstantAndCoords : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixConstantAndCoords() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixConstantAndCoords& _outer = args.fFp.cast<GrChildProcessorSampleMatrixConstantAndCoords>();
(void) _outer;
SkString _sample0 = this->invokeChildWithMatrix(0, args);
SkString _coords1 = SkStringPrintf("%s / 2.0", args.fSampleCoord);
SkString _sample1 = this->invokeChild(0, args, _coords1.c_str());
fragBuilder->codeAppendf(
R"SkSL(return %s * %s;
)SkSL"
, _sample0.c_str(), _sample1.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixConstantAndCoords::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixConstantAndCoords>();
}
void GrChildProcessorSampleMatrixConstantAndCoords::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixConstantAndCoords::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixConstantAndCoords& that = other.cast<GrChildProcessorSampleMatrixConstantAndCoords>();
(void) that;
return true;
}
GrChildProcessorSampleMatrixConstantAndCoords::GrChildProcessorSampleMatrixConstantAndCoords(const GrChildProcessorSampleMatrixConstantAndCoords& src)
: INHERITED(kGrChildProcessorSampleMatrixConstantAndCoords_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
this->setUsesSampleCoordsDirectly();
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixConstantAndCoords::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixConstantAndCoords>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixConstantAndCoords::onDumpInfo() const {
return SkString();
}
#endif

View File

@ -1,38 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixConstantAndCoords.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixConstantAndCoords_DEFINED
#define GrChildProcessorSampleMatrixConstantAndCoords_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixConstantAndCoords : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixConstantAndCoords(std::move(child)));
}
GrChildProcessorSampleMatrixConstantAndCoords(const GrChildProcessorSampleMatrixConstantAndCoords& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixConstantAndCoords"; }
private:
GrChildProcessorSampleMatrixConstantAndCoords(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kGrChildProcessorSampleMatrixConstantAndCoords_ClassID, kNone_OptimizationFlags) {
this->setUsesSampleCoordsDirectly();
this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kUniform, "float3x3(0.5)", true, true, false));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -1,73 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixMultipleUniforms.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixMultipleUniforms.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixMultipleUniforms : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixMultipleUniforms() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixMultipleUniforms& _outer = args.fFp.cast<GrChildProcessorSampleMatrixMultipleUniforms>();
(void) _outer;
auto matrixA = _outer.matrixA;
(void) matrixA;
auto matrixB = _outer.matrixB;
(void) matrixB;
matrixAVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrixA");
matrixBVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrixB");
SkString _matrix0(args.fUniformHandler->getUniformCStr(matrixAVar));
SkString _sample0 = this->invokeChildWithMatrix(0, args, _matrix0.c_str());
SkString _matrix1(args.fUniformHandler->getUniformCStr(matrixBVar));
SkString _sample1 = this->invokeChildWithMatrix(0, args, _matrix1.c_str());
fragBuilder->codeAppendf(
R"SkSL(return %s + %s;
)SkSL"
, _sample0.c_str(), _sample1.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
const GrChildProcessorSampleMatrixMultipleUniforms& _outer = _proc.cast<GrChildProcessorSampleMatrixMultipleUniforms>();
{
static_assert(1 == 1); pdman.setSkMatrix(matrixAVar, (_outer.matrixA));
static_assert(1 == 1); pdman.setSkMatrix(matrixBVar, (_outer.matrixB));
}
}
UniformHandle matrixAVar;
UniformHandle matrixBVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixMultipleUniforms::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixMultipleUniforms>();
}
void GrChildProcessorSampleMatrixMultipleUniforms::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixMultipleUniforms::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixMultipleUniforms& that = other.cast<GrChildProcessorSampleMatrixMultipleUniforms>();
(void) that;
if (matrixA != that.matrixA) return false;
if (matrixB != that.matrixB) return false;
return true;
}
GrChildProcessorSampleMatrixMultipleUniforms::GrChildProcessorSampleMatrixMultipleUniforms(const GrChildProcessorSampleMatrixMultipleUniforms& src)
: INHERITED(kGrChildProcessorSampleMatrixMultipleUniforms_ClassID, src.optimizationFlags())
, matrixA(src.matrixA)
, matrixB(src.matrixB) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixMultipleUniforms::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixMultipleUniforms>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixMultipleUniforms::onDumpInfo() const {
return SkStringPrintf("(matrixA=float3x3(%f, %f, %f, %f, %f, %f, %f, %f, %f), matrixB=float3x3(%f, %f, %f, %f, %f, %f, %f, %f, %f))", matrixA.rc(0, 0), matrixA.rc(1, 0), matrixA.rc(2, 0), matrixA.rc(0, 1), matrixA.rc(1, 1), matrixA.rc(2, 1), matrixA.rc(0, 2), matrixA.rc(1, 2), matrixA.rc(2, 2), matrixB.rc(0, 0), matrixB.rc(1, 0), matrixB.rc(2, 0), matrixB.rc(0, 1), matrixB.rc(1, 1), matrixB.rc(2, 1), matrixB.rc(0, 2), matrixB.rc(1, 2), matrixB.rc(2, 2));
}
#endif

View File

@ -1,41 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixMultipleUniforms.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixMultipleUniforms_DEFINED
#define GrChildProcessorSampleMatrixMultipleUniforms_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixMultipleUniforms : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child, SkMatrix matrixA, SkMatrix matrixB) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixMultipleUniforms(std::move(child), matrixA, matrixB));
}
GrChildProcessorSampleMatrixMultipleUniforms(const GrChildProcessorSampleMatrixMultipleUniforms& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixMultipleUniforms"; }
SkMatrix matrixA;
SkMatrix matrixB;
private:
GrChildProcessorSampleMatrixMultipleUniforms(std::unique_ptr<GrFragmentProcessor> child, SkMatrix matrixA, SkMatrix matrixB)
: INHERITED(kGrChildProcessorSampleMatrixMultipleUniforms_ClassID, kNone_OptimizationFlags)
, matrixA(matrixA)
, matrixB(matrixB) {
this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix(true));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -1,63 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixSingleInUniform.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixSingleInUniform.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixSingleInUniform : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixSingleInUniform() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixSingleInUniform& _outer = args.fFp.cast<GrChildProcessorSampleMatrixSingleInUniform>();
(void) _outer;
auto matrix = _outer.matrix;
(void) matrix;
matrixVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrix");
SkString _sample0 = this->invokeChildWithMatrix(0, args);
fragBuilder->codeAppendf(
R"SkSL(return %s;
)SkSL"
, _sample0.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
const GrChildProcessorSampleMatrixSingleInUniform& _outer = _proc.cast<GrChildProcessorSampleMatrixSingleInUniform>();
{
static_assert(1 == 1); pdman.setSkMatrix(matrixVar, (_outer.matrix));
}
}
UniformHandle matrixVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixSingleInUniform::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixSingleInUniform>();
}
void GrChildProcessorSampleMatrixSingleInUniform::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixSingleInUniform::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixSingleInUniform& that = other.cast<GrChildProcessorSampleMatrixSingleInUniform>();
(void) that;
if (matrix != that.matrix) return false;
return true;
}
GrChildProcessorSampleMatrixSingleInUniform::GrChildProcessorSampleMatrixSingleInUniform(const GrChildProcessorSampleMatrixSingleInUniform& src)
: INHERITED(kGrChildProcessorSampleMatrixSingleInUniform_ClassID, src.optimizationFlags())
, matrix(src.matrix) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixSingleInUniform::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixSingleInUniform>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixSingleInUniform::onDumpInfo() const {
return SkStringPrintf("(matrix=float3x3(%f, %f, %f, %f, %f, %f, %f, %f, %f))", matrix.rc(0, 0), matrix.rc(1, 0), matrix.rc(2, 0), matrix.rc(0, 1), matrix.rc(1, 1), matrix.rc(2, 1), matrix.rc(0, 2), matrix.rc(1, 2), matrix.rc(2, 2));
}
#endif

View File

@ -1,39 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixSingleInUniform.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixSingleInUniform_DEFINED
#define GrChildProcessorSampleMatrixSingleInUniform_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixSingleInUniform : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child, SkMatrix matrix) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixSingleInUniform(std::move(child), matrix));
}
GrChildProcessorSampleMatrixSingleInUniform(const GrChildProcessorSampleMatrixSingleInUniform& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixSingleInUniform"; }
SkMatrix matrix;
private:
GrChildProcessorSampleMatrixSingleInUniform(std::unique_ptr<GrFragmentProcessor> child, SkMatrix matrix)
: INHERITED(kGrChildProcessorSampleMatrixSingleInUniform_ClassID, kNone_OptimizationFlags)
, matrix(matrix) {
this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix", matrix.hasPerspective()));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -1,55 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixSingleUniform.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixSingleUniform.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixSingleUniform : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixSingleUniform() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixSingleUniform& _outer = args.fFp.cast<GrChildProcessorSampleMatrixSingleUniform>();
(void) _outer;
matrixVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrix");
SkString _sample0 = this->invokeChildWithMatrix(0, args);
fragBuilder->codeAppendf(
R"SkSL(return %s;
)SkSL"
, _sample0.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
UniformHandle matrixVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixSingleUniform::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixSingleUniform>();
}
void GrChildProcessorSampleMatrixSingleUniform::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixSingleUniform::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixSingleUniform& that = other.cast<GrChildProcessorSampleMatrixSingleUniform>();
(void) that;
return true;
}
GrChildProcessorSampleMatrixSingleUniform::GrChildProcessorSampleMatrixSingleUniform(const GrChildProcessorSampleMatrixSingleUniform& src)
: INHERITED(kGrChildProcessorSampleMatrixSingleUniform_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixSingleUniform::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixSingleUniform>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixSingleUniform::onDumpInfo() const {
return SkString();
}
#endif

View File

@ -1,37 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixSingleUniform.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixSingleUniform_DEFINED
#define GrChildProcessorSampleMatrixSingleUniform_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixSingleUniform : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixSingleUniform(std::move(child)));
}
GrChildProcessorSampleMatrixSingleUniform(const GrChildProcessorSampleMatrixSingleUniform& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixSingleUniform"; }
private:
GrChildProcessorSampleMatrixSingleUniform(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kGrChildProcessorSampleMatrixSingleUniform_ClassID, kNone_OptimizationFlags) {
this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix", true));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -1,56 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixSingleUniformExpr.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixSingleUniformExpr.h"
#include "src/core/SkUtils.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLCPP.h"
#include "src/sksl/SkSLUtil.h"
class GrGLSLChildProcessorSampleMatrixSingleUniformExpr : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixSingleUniformExpr() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixSingleUniformExpr& _outer = args.fFp.cast<GrChildProcessorSampleMatrixSingleUniformExpr>();
(void) _outer;
matrixVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrix");
SkString _matrix0 = SkStringPrintf("0.5 * %s", args.fUniformHandler->getUniformCStr(matrixVar));
SkString _sample0 = this->invokeChildWithMatrix(0, args, _matrix0.c_str());
fragBuilder->codeAppendf(
R"SkSL(return %s;
)SkSL"
, _sample0.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
UniformHandle matrixVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixSingleUniformExpr::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixSingleUniformExpr>();
}
void GrChildProcessorSampleMatrixSingleUniformExpr::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixSingleUniformExpr::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixSingleUniformExpr& that = other.cast<GrChildProcessorSampleMatrixSingleUniformExpr>();
(void) that;
return true;
}
GrChildProcessorSampleMatrixSingleUniformExpr::GrChildProcessorSampleMatrixSingleUniformExpr(const GrChildProcessorSampleMatrixSingleUniformExpr& src)
: INHERITED(kGrChildProcessorSampleMatrixSingleUniformExpr_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixSingleUniformExpr::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixSingleUniformExpr>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixSingleUniformExpr::onDumpInfo() const {
return SkString();
}
#endif

View File

@ -1,37 +0,0 @@
/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixSingleUniformExpr.fp; do not modify.
**************************************************************************************************/
#ifndef GrChildProcessorSampleMatrixSingleUniformExpr_DEFINED
#define GrChildProcessorSampleMatrixSingleUniformExpr_DEFINED
#include "include/core/SkM44.h"
#include "include/core/SkTypes.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrChildProcessorSampleMatrixSingleUniformExpr : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleMatrixSingleUniformExpr(std::move(child)));
}
GrChildProcessorSampleMatrixSingleUniformExpr(const GrChildProcessorSampleMatrixSingleUniformExpr& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleMatrixSingleUniformExpr"; }
private:
GrChildProcessorSampleMatrixSingleUniformExpr(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kGrChildProcessorSampleMatrixSingleUniformExpr_ClassID, kNone_OptimizationFlags) {
this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix(true));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
#if GR_TEST_UTILS
SkString onDumpInfo() const override;
#endif
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
using INHERITED = GrFragmentProcessor;
};
#endif

View File

@ -20,34 +20,20 @@ public:
const GrChildProcessorSampleWithColor& _outer = args.fFp.cast<GrChildProcessorSampleWithColor>();
(void) _outer;
CVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf4_GrSLType, "C");
M0Var = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "M0");
M1Var = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "M1");
SkString _input0(args.fUniformHandler->getUniformCStr(CVar));
SkString _sample0 = this->invokeChild(0, _input0.c_str(), args);
SkString _input1(args.fUniformHandler->getUniformCStr(CVar));
SkString _coords1 = SkStringPrintf("%s / 2.0", args.fSampleCoord);
SkString _sample1 = this->invokeChild(1, _input1.c_str(), args, _coords1.c_str());
SkString _input2(args.fUniformHandler->getUniformCStr(CVar));
SkString _sample2 = this->invokeChildWithMatrix(2, _input2.c_str(), args);
SkString _input3(args.fUniformHandler->getUniformCStr(CVar));
SkString _sample3 = this->invokeChildWithMatrix(3, _input3.c_str(), args);
SkString _input4(args.fUniformHandler->getUniformCStr(CVar));
SkString _matrix4(args.fUniformHandler->getUniformCStr(M0Var));
SkString _sample4 = this->invokeChildWithMatrix(4, _input4.c_str(), args, _matrix4.c_str());
SkString _input5(args.fUniformHandler->getUniformCStr(CVar));
SkString _matrix5(args.fUniformHandler->getUniformCStr(M1Var));
SkString _sample5 = this->invokeChildWithMatrix(4, _input5.c_str(), args, _matrix5.c_str());
fragBuilder->codeAppendf(
R"SkSL(return ((((%s + %s) + %s) + %s) + %s) + %s;
R"SkSL(return %s + %s;
)SkSL"
, _sample0.c_str(), _sample1.c_str(), _sample2.c_str(), _sample3.c_str(), _sample4.c_str(), _sample5.c_str());
, _sample0.c_str(), _sample1.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
UniformHandle CVar;
UniformHandle M0Var;
UniformHandle M1Var;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleWithColor::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleWithColor>();

View File

@ -14,21 +14,18 @@
class GrChildProcessorSampleWithColor : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> passthrough, std::unique_ptr<GrFragmentProcessor> explicit, std::unique_ptr<GrFragmentProcessor> matrix_const, std::unique_ptr<GrFragmentProcessor> matrix_uniform, std::unique_ptr<GrFragmentProcessor> matrix_uniform_multi) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleWithColor(std::move(passthrough), std::move(explicit), std::move(matrix_const), std::move(matrix_uniform), std::move(matrix_uniform_multi)));
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> passthrough, std::unique_ptr<GrFragmentProcessor> explicit) {
return std::unique_ptr<GrFragmentProcessor>(new GrChildProcessorSampleWithColor(std::move(passthrough), std::move(explicit)));
}
GrChildProcessorSampleWithColor(const GrChildProcessorSampleWithColor& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "ChildProcessorSampleWithColor"; }
private:
GrChildProcessorSampleWithColor(std::unique_ptr<GrFragmentProcessor> passthrough, std::unique_ptr<GrFragmentProcessor> explicit, std::unique_ptr<GrFragmentProcessor> matrix_const, std::unique_ptr<GrFragmentProcessor> matrix_uniform, std::unique_ptr<GrFragmentProcessor> matrix_uniform_multi)
GrChildProcessorSampleWithColor(std::unique_ptr<GrFragmentProcessor> passthrough, std::unique_ptr<GrFragmentProcessor> explicit)
: INHERITED(kGrChildProcessorSampleWithColor_ClassID, kNone_OptimizationFlags) {
this->setUsesSampleCoordsDirectly();
this->registerChild(std::move(passthrough), SkSL::SampleUsage::PassThrough());
this->registerChild(std::move(explicit), SkSL::SampleUsage::Explicit());
this->registerChild(std::move(matrix_const), SkSL::SampleUsage::UniformMatrix("float3x3(2.0)", true));
this->registerChild(std::move(matrix_uniform), SkSL::SampleUsage::UniformMatrix("M0", true));
this->registerChild(std::move(matrix_uniform_multi), SkSL::SampleUsage::VariableMatrix(true));
}
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;

View File

@ -1,26 +0,0 @@
9 registers, 24 instructions:
0 r0 = uniform32 ptr0 0
1 r1 = uniform32 ptr0 C
2 r2 = splat 40000000 (2)
3 r0 = trunc r0
4 r1 = mul_i32 r0 r1
5 r0 = splat 1 (1.4012985e-45)
6 r3 = splat 2 (2.8025969e-45)
7 r4 = splat 3 (4.2038954e-45)
loop:
8 r5 = index
9 r5 = mul_f32 r2 r5
10 r5 = trunc r5
11 r5 = add_i32 r5 r1
12 r5 = shl_i32 r5 2
13 r6 = gather32 ptr0 4 r5
14 r7 = add_i32 r5 r0
15 r7 = gather32 ptr0 4 r7
16 r8 = add_i32 r5 r3
17 r8 = gather32 ptr0 4 r8
18 r5 = add_i32 r5 r4
19 r5 = gather32 ptr0 4 r5
20 store32 ptr1 r6
21 store32 ptr2 r7
22 store32 ptr3 r8
23 store32 ptr4 r5

View File

@ -1,4 +0,0 @@
half4 main()
{
return half4(sample(child_0, float3x3(2.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)));
}

View File

@ -1,49 +0,0 @@
18 registers, 47 instructions:
0 r0 = uniform32 ptr0 0
1 r1 = uniform32 ptr0 C
2 r2 = uniform32 ptr0 10
3 r3 = uniform32 ptr0 14
4 r4 = uniform32 ptr0 18
5 r5 = uniform32 ptr0 1C
6 r6 = uniform32 ptr0 20
7 r7 = uniform32 ptr0 24
8 r8 = uniform32 ptr0 28
9 r9 = uniform32 ptr0 2C
10 r10 = uniform32 ptr0 30
11 r5 = mul_f32 r5 r0
12 r6 = mul_f32 r6 r0
13 r0 = mul_f32 r7 r0
14 r7 = splat 3F800000 (1)
15 r11 = splat 1 (1.4012985e-45)
16 r12 = splat 2 (2.8025969e-45)
17 r13 = splat 3 (4.2038954e-45)
loop:
18 r14 = index
19 r15 = mul_f32 r2 r14
20 r15 = add_f32 r15 r5
21 r15 = add_f32 r15 r8
22 r16 = mul_f32 r3 r14
23 r16 = add_f32 r16 r6
24 r16 = add_f32 r16 r9
25 r14 = mul_f32 r4 r14
26 r14 = add_f32 r14 r0
27 r14 = add_f32 r14 r10
28 r14 = div_f32 r7 r14
29 r15 = mul_f32 r15 r14
30 r14 = mul_f32 r16 r14
31 r15 = trunc r15
32 r14 = trunc r14
33 r14 = mul_i32 r14 r1
34 r14 = add_i32 r15 r14
35 r14 = shl_i32 r14 2
36 r15 = gather32 ptr0 4 r14
37 r16 = add_i32 r14 r11
38 r16 = gather32 ptr0 4 r16
39 r17 = add_i32 r14 r12
40 r17 = gather32 ptr0 4 r17
41 r14 = add_i32 r14 r13
42 r14 = gather32 ptr0 4 r14
43 store32 ptr1 r15
44 store32 ptr2 r16
45 store32 ptr3 r17
46 store32 ptr4 r14

View File

@ -1,5 +0,0 @@
uniform float3x3 matrix;
half4 main()
{
return half4(sample(child_0, matrix));
}

View File

@ -1,24 +0,0 @@
8 registers, 22 instructions:
0 r0 = uniform32 ptr0 0
1 r1 = uniform32 ptr0 C
2 r0 = trunc r0
3 r1 = mul_i32 r0 r1
4 r0 = splat 1 (1.4012985e-45)
5 r2 = splat 2 (2.8025969e-45)
6 r3 = splat 3 (4.2038954e-45)
loop:
7 r4 = index
8 r4 = trunc r4
9 r4 = add_i32 r4 r1
10 r4 = shl_i32 r4 2
11 r5 = gather32 ptr0 4 r4
12 r6 = add_i32 r4 r0
13 r6 = gather32 ptr0 4 r6
14 r7 = add_i32 r4 r2
15 r7 = gather32 ptr0 4 r7
16 r4 = add_i32 r4 r3
17 r4 = gather32 ptr0 4 r4
18 store32 ptr1 r5
19 store32 ptr2 r6
20 store32 ptr3 r7
21 store32 ptr4 r4

View File

@ -1,5 +0,0 @@
half4 main()
{
float x = sqrt(1.0);
return half4(sample(child_0, float3x3(x, 0.0, 0.0, 0.0, x, 0.0, 0.0, 0.0, 1.0)));
}