Remove pipeline-stage workarounds from the GLSL code generator.

These checks don't appear to be useful; the methods in question are
overloaded anyway, and don't access the INHERITED:: methods.

Change-Id: I2ae637b7fb7f2281dc00fe148fbbbccb464cded9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314885
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2020-09-02 15:44:18 -04:00 committed by Skia Commit-Bot
parent 72de11581b
commit fffe3844ef

View File

@ -1212,44 +1212,47 @@ void GLSLCodeGenerator::writeSetting(const Setting& s) {
void GLSLCodeGenerator::writeFunction(const FunctionDefinition& f) {
fSetupFragPositionLocal = false;
fSetupFragCoordWorkaround = false;
if (fProgramKind != Program::kPipelineStage_Kind) {
this->writeTypePrecision(f.fDeclaration.fReturnType);
this->writeType(f.fDeclaration.fReturnType);
this->write(" " + f.fDeclaration.fName + "(");
const char* separator = "";
for (const auto& param : f.fDeclaration.fParameters) {
this->write(separator);
separator = ", ";
this->writeModifiers(param->fModifiers, false);
std::vector<int> sizes;
const Type* type = &param->fType;
while (type->kind() == Type::kArray_Kind) {
sizes.push_back(type->columns());
type = &type->componentType();
}
this->writeTypePrecision(*type);
this->writeType(*type);
this->write(" " + param->fName);
for (int s : sizes) {
if (s <= 0) {
this->write("[]");
} else {
this->write("[" + to_string(s) + "]");
}
// The pipeline-stage code generator can't use functions written this way, so make sure we don't
// accidentally end up here.
SkASSERT(fProgramKind != Program::kPipelineStage_Kind);
this->writeTypePrecision(f.fDeclaration.fReturnType);
this->writeType(f.fDeclaration.fReturnType);
this->write(" " + f.fDeclaration.fName + "(");
const char* separator = "";
for (const auto& param : f.fDeclaration.fParameters) {
this->write(separator);
separator = ", ";
this->writeModifiers(param->fModifiers, false);
std::vector<int> sizes;
const Type* type = &param->fType;
while (type->kind() == Type::kArray_Kind) {
sizes.push_back(type->columns());
type = &type->componentType();
}
this->writeTypePrecision(*type);
this->writeType(*type);
this->write(" " + param->fName);
for (int s : sizes) {
if (s <= 0) {
this->write("[]");
} else {
this->write("[" + to_string(s) + "]");
}
}
this->writeLine(") {");
fIndentation++;
}
this->writeLine(") {");
fIndentation++;
fFunctionHeader = "";
OutputStream* oldOut = fOut;
StringStream buffer;
fOut = &buffer;
this->writeStatements(f.fBody->as<Block>().fStatements);
if (fProgramKind != Program::kPipelineStage_Kind) {
fIndentation--;
this->writeLine("}");
}
fIndentation--;
this->writeLine("}");
fOut = oldOut;
this->write(fFunctionHeader);
@ -1736,9 +1739,7 @@ void GLSLCodeGenerator::writeInputVars() {
}
bool GLSLCodeGenerator::generateCode() {
if (fProgramKind != Program::kPipelineStage_Kind) {
this->writeHeader();
}
this->writeHeader();
if (Program::kGeometry_Kind == fProgramKind &&
fProgram.fSettings.fCaps->geometryShaderExtensionString()) {
this->writeExtension(fProgram.fSettings.fCaps->geometryShaderExtensionString());