From 6860db769b3f8dc1d35f476dc872b9e466bdb504 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Thu, 15 Apr 2021 14:13:53 -0400 Subject: [PATCH] Insert newlines in generated FP constructors Cleans up registerChild calls, which were all on one long line. Change-Id: I2b665b033edb88cf1de5e4da433833c0be26c92b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397147 Commit-Queue: Brian Osman Commit-Queue: John Stiles Auto-Submit: Brian Osman Reviewed-by: John Stiles --- src/sksl/codegen/SkSLHCodeGenerator.cpp | 4 ++-- tests/sksl/fp/GrChildProcessorAndGlobal.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleCoords.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixAndCoords.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixConstant.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixConstantAndCoords.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixSingleInUniform.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniform.h | 3 ++- tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniformExpr.h | 3 ++- tests/sksl/fp/GrChildProcessorWithInputExpression.h | 3 ++- tests/sksl/fp/GrChildProcessors.h | 4 +++- tests/sksl/fp/GrChildProcessorsWithInput.h | 4 +++- tests/sksl/fp/GrNestedCall.h | 3 ++- tests/sksl/fp/GrNestedChildProcessors.h | 4 +++- 15 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/sksl/codegen/SkSLHCodeGenerator.cpp b/src/sksl/codegen/SkSLHCodeGenerator.cpp index d877257e59..47f5f9fcee 100644 --- a/src/sksl/codegen/SkSLHCodeGenerator.cpp +++ b/src/sksl/codegen/SkSLHCodeGenerator.cpp @@ -290,13 +290,13 @@ void HCodeGenerator::writeConstructor() { } std::string usageArg = usage.constructor(std::move(perspExpression)); - this->writef(" this->registerChild(std::move(%s), %s);", + this->writef(" this->registerChild(std::move(%s), %s);\n", String(param->name()).c_str(), usageArg.c_str()); } } if (samplerCount) { - this->writef(" this->setTextureSamplerCnt(%d);", samplerCount); + this->writef(" this->setTextureSamplerCnt(%d);\n", samplerCount); } this->writef(" }\n"); } diff --git a/tests/sksl/fp/GrChildProcessorAndGlobal.h b/tests/sksl/fp/GrChildProcessorAndGlobal.h index 98d990127d..6acb1ba514 100644 --- a/tests/sksl/fp/GrChildProcessorAndGlobal.h +++ b/tests/sksl/fp/GrChildProcessorAndGlobal.h @@ -23,7 +23,8 @@ public: private: GrChildProcessorAndGlobal(std::unique_ptr child) : INHERITED(kGrChildProcessorAndGlobal_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child), SkSL::SampleUsage::PassThrough()); } + this->registerChild(std::move(child), SkSL::SampleUsage::PassThrough()); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleCoords.h b/tests/sksl/fp/GrChildProcessorSampleCoords.h index 6114fc4d7f..3d6bf77f86 100644 --- a/tests/sksl/fp/GrChildProcessorSampleCoords.h +++ b/tests/sksl/fp/GrChildProcessorSampleCoords.h @@ -24,7 +24,8 @@ private: GrChildProcessorSampleCoords(std::unique_ptr child) : INHERITED(kGrChildProcessorSampleCoords_ClassID, kNone_OptimizationFlags) { this->setUsesSampleCoordsDirectly(); - this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kNone, "", false, true, true)); } + this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kNone, "", false, true, true)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixAndCoords.h b/tests/sksl/fp/GrChildProcessorSampleMatrixAndCoords.h index 4692dd8a56..cabc5cd946 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixAndCoords.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixAndCoords.h @@ -24,7 +24,8 @@ private: GrChildProcessorSampleMatrixAndCoords(std::unique_ptr child) : INHERITED(kGrChildProcessorSampleMatrixAndCoords_ClassID, kNone_OptimizationFlags) { this->setUsesSampleCoordsDirectly(); - this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kVariable, "", true, true, false)); } + this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kVariable, "", true, true, false)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixConstant.h b/tests/sksl/fp/GrChildProcessorSampleMatrixConstant.h index 3041522d16..6dd7cccc95 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixConstant.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixConstant.h @@ -23,7 +23,8 @@ public: private: GrChildProcessorSampleMatrixConstant(std::unique_ptr child) : INHERITED(kGrChildProcessorSampleMatrixConstant_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("float3x3(2.0)", true)); } + this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("float3x3(2.0)", true)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixConstantAndCoords.h b/tests/sksl/fp/GrChildProcessorSampleMatrixConstantAndCoords.h index d02754e8e1..3fcfb00e8f 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixConstantAndCoords.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixConstantAndCoords.h @@ -24,7 +24,8 @@ private: GrChildProcessorSampleMatrixConstantAndCoords(std::unique_ptr 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)); } + this->registerChild(std::move(child), SkSL::SampleUsage(SkSL::SampleUsage::Kind::kUniform, "float3x3(0.5)", true, true, false)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.h b/tests/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.h index ba42ad2066..2be421eba1 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.h @@ -27,7 +27,8 @@ private: : INHERITED(kGrChildProcessorSampleMatrixMultipleUniforms_ClassID, kNone_OptimizationFlags) , matrixA(matrixA) , matrixB(matrixB) { - this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix(true)); } + this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix(true)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixSingleInUniform.h b/tests/sksl/fp/GrChildProcessorSampleMatrixSingleInUniform.h index 92500814aa..f641bac452 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixSingleInUniform.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixSingleInUniform.h @@ -25,7 +25,8 @@ private: GrChildProcessorSampleMatrixSingleInUniform(std::unique_ptr child, SkMatrix matrix) : INHERITED(kGrChildProcessorSampleMatrixSingleInUniform_ClassID, kNone_OptimizationFlags) , matrix(matrix) { - this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix", matrix.hasPerspective())); } + this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix", matrix.hasPerspective())); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniform.h b/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniform.h index 7d4ca6f568..f9ec9ee0b3 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniform.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniform.h @@ -23,7 +23,8 @@ public: private: GrChildProcessorSampleMatrixSingleUniform(std::unique_ptr child) : INHERITED(kGrChildProcessorSampleMatrixSingleUniform_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix", true)); } + this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix", true)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniformExpr.h b/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniformExpr.h index 083c29203c..769152f80b 100644 --- a/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniformExpr.h +++ b/tests/sksl/fp/GrChildProcessorSampleMatrixSingleUniformExpr.h @@ -23,7 +23,8 @@ public: private: GrChildProcessorSampleMatrixSingleUniformExpr(std::unique_ptr child) : INHERITED(kGrChildProcessorSampleMatrixSingleUniformExpr_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix(true)); } + this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix(true)); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorWithInputExpression.h b/tests/sksl/fp/GrChildProcessorWithInputExpression.h index d6a7882c3e..a74273af5a 100644 --- a/tests/sksl/fp/GrChildProcessorWithInputExpression.h +++ b/tests/sksl/fp/GrChildProcessorWithInputExpression.h @@ -23,7 +23,8 @@ public: private: GrChildProcessorWithInputExpression(std::unique_ptr child) : INHERITED(kGrChildProcessorWithInputExpression_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child), SkSL::SampleUsage::PassThrough()); } + this->registerChild(std::move(child), SkSL::SampleUsage::PassThrough()); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessors.h b/tests/sksl/fp/GrChildProcessors.h index 2c8816f089..d623b44f18 100644 --- a/tests/sksl/fp/GrChildProcessors.h +++ b/tests/sksl/fp/GrChildProcessors.h @@ -23,7 +23,9 @@ public: private: GrChildProcessors(std::unique_ptr child1, std::unique_ptr child2) : INHERITED(kGrChildProcessors_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child1), SkSL::SampleUsage::PassThrough()); this->registerChild(std::move(child2), SkSL::SampleUsage::PassThrough()); } + this->registerChild(std::move(child1), SkSL::SampleUsage::PassThrough()); + this->registerChild(std::move(child2), SkSL::SampleUsage::PassThrough()); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrChildProcessorsWithInput.h b/tests/sksl/fp/GrChildProcessorsWithInput.h index b84df3ec66..3b4e8e07e1 100644 --- a/tests/sksl/fp/GrChildProcessorsWithInput.h +++ b/tests/sksl/fp/GrChildProcessorsWithInput.h @@ -23,7 +23,9 @@ public: private: GrChildProcessorsWithInput(std::unique_ptr child1, std::unique_ptr child2) : INHERITED(kGrChildProcessorsWithInput_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child1), SkSL::SampleUsage::PassThrough()); this->registerChild(std::move(child2), SkSL::SampleUsage::PassThrough()); } + this->registerChild(std::move(child1), SkSL::SampleUsage::PassThrough()); + this->registerChild(std::move(child2), SkSL::SampleUsage::PassThrough()); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrNestedCall.h b/tests/sksl/fp/GrNestedCall.h index 807f115df9..ed82415fc2 100644 --- a/tests/sksl/fp/GrNestedCall.h +++ b/tests/sksl/fp/GrNestedCall.h @@ -23,7 +23,8 @@ public: private: GrNestedCall(std::unique_ptr fp) : INHERITED(kGrNestedCall_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(fp), SkSL::SampleUsage::PassThrough()); } + this->registerChild(std::move(fp), SkSL::SampleUsage::PassThrough()); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/tests/sksl/fp/GrNestedChildProcessors.h b/tests/sksl/fp/GrNestedChildProcessors.h index bc6e539e0a..e5f8a7b0bb 100644 --- a/tests/sksl/fp/GrNestedChildProcessors.h +++ b/tests/sksl/fp/GrNestedChildProcessors.h @@ -23,7 +23,9 @@ public: private: GrNestedChildProcessors(std::unique_ptr child1, std::unique_ptr child2) : INHERITED(kGrNestedChildProcessors_ClassID, kNone_OptimizationFlags) { - this->registerChild(std::move(child1), SkSL::SampleUsage::PassThrough()); this->registerChild(std::move(child2), SkSL::SampleUsage::PassThrough()); } + this->registerChild(std::move(child1), SkSL::SampleUsage::PassThrough()); + this->registerChild(std::move(child2), SkSL::SampleUsage::PassThrough()); + } std::unique_ptr onMakeProgramImpl() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override;