Remove unused members from GLSLCodeGenerator.

Change-Id: I49ed41170d5ac39658554435f806af0218911316
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/516158
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2022-03-04 13:41:25 -05:00 committed by SkCQ
parent 9a822433df
commit 1a01d5a1f1
2 changed files with 8 additions and 39 deletions

View File

@ -57,7 +57,7 @@ void GLSLCodeGenerator::write(std::string_view s) {
void GLSLCodeGenerator::writeLine(std::string_view s) { void GLSLCodeGenerator::writeLine(std::string_view s) {
this->write(s); this->write(s);
fOut->writeText(fLineEnding); fOut->writeText("\n");
fAtLineStart = true; fAtLineStart = true;
} }
@ -650,16 +650,12 @@ void GLSLCodeGenerator::writeFunctionCall(const FunctionCall& c) {
proj = false; proj = false;
break; break;
} }
if (!fTextureFunctionOverride.empty()) { this->write("texture");
this->write(fTextureFunctionOverride.c_str()); if (this->caps().generation() < SkSL::GLSLGeneration::k130) {
} else { this->write(dim);
this->write("texture"); }
if (this->caps().generation() < SkSL::GLSLGeneration::k130) { if (proj) {
this->write(dim); this->write("Proj");
}
if (proj) {
this->write("Proj");
}
} }
nameWritten = true; nameWritten = true;
break; break;

View File

@ -8,8 +8,6 @@
#ifndef SKSL_GLSLCODEGENERATOR #ifndef SKSL_GLSLCODEGENERATOR
#define SKSL_GLSLCODEGENERATOR #define SKSL_GLSLCODEGENERATOR
#include <unordered_map>
#include "src/sksl/SkSLOperators.h" #include "src/sksl/SkSLOperators.h"
#include "src/sksl/SkSLStringStream.h" #include "src/sksl/SkSLStringStream.h"
#include "src/sksl/codegen/SkSLCodeGenerator.h" #include "src/sksl/codegen/SkSLCodeGenerator.h"
@ -50,8 +48,7 @@ class VariableReference;
class GLSLCodeGenerator : public CodeGenerator { class GLSLCodeGenerator : public CodeGenerator {
public: public:
GLSLCodeGenerator(const Context* context, const Program* program, OutputStream* out) GLSLCodeGenerator(const Context* context, const Program* program, OutputStream* out)
: INHERITED(context, program, out) : INHERITED(context, program, out) {}
, fLineEnding("\n") {}
bool generateCode() override; bool generateCode() override;
@ -170,7 +167,6 @@ protected:
const ShaderCaps& caps() const { return fContext.fCaps; } const ShaderCaps& caps() const { return fContext.fCaps; }
const char* fLineEnding;
StringStream fExtensions; StringStream fExtensions;
StringStream fGlobals; StringStream fGlobals;
StringStream fExtraFunctions; StringStream fExtraFunctions;
@ -186,29 +182,6 @@ protected:
bool fSetupClockwise = false; bool fSetupClockwise = false;
bool fSetupFragPosition = false; bool fSetupFragPosition = false;
bool fSetupFragCoordWorkaround = false; bool fSetupFragCoordWorkaround = false;
// if non-empty, replace all texture / texture2D / textureProj / etc. calls with this name
std::string fTextureFunctionOverride;
// We map function names to function class so we can quickly deal with function calls that need
// extra processing
enum class FunctionClass {
kAbs,
kAtan,
kDeterminant,
kDFdx,
kDFdy,
kFwidth,
kFMA,
kFract,
kInverse,
kInverseSqrt,
kMin,
kPow,
kSaturate,
kTexture,
kTranspose
};
static std::unordered_map<std::string_view, FunctionClass>* fFunctionClasses;
using INHERITED = CodeGenerator; using INHERITED = CodeGenerator;
}; };