aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLHCodeGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-10-25 21:04:34 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-25 21:05:05 +0000
commit2d3cac58fcc8f2d398a421b0341c36479a6ba324 (patch)
tree9994cea43500dc53bf48601e0145c50046ab7bf6 /src/sksl/SkSLHCodeGenerator.cpp
parentd52c6c27b748ca32453261179e621665e2864a6a (diff)
Revert "converted OverdrawColorFilter to SkSL"
This reverts commit 8aa4dc9052a64d84cfd0a4330910057bd37b6bf7. Reason for revert: strncmp getting mad Original change's description: > converted OverdrawColorFilter to SkSL > > Bug: skia: > Change-Id: Idcc0502758df1e60ed131a168b5c9a65a4d834a1 > Reviewed-on: https://skia-review.googlesource.com/63840 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,ethannicholas@google.com Change-Id: Ib78d7c878c4597918d059bddb4d61f6a7f59a511 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/63561 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLHCodeGenerator.cpp')
-rw-r--r--src/sksl/SkSLHCodeGenerator.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/sksl/SkSLHCodeGenerator.cpp b/src/sksl/SkSLHCodeGenerator.cpp
index da67126baf..21f4f2842c 100644
--- a/src/sksl/SkSLHCodeGenerator.cpp
+++ b/src/sksl/SkSLHCodeGenerator.cpp
@@ -23,11 +23,8 @@ HCodeGenerator::HCodeGenerator(const Context* context, const Program* program,
, fFullName(String::printf("Gr%s", fName.c_str()))
, fSectionAndParameterHelper(*program, *errors) {}
-String HCodeGenerator::ParameterType(const Context& context, const Type& type,
- const Layout& layout) {
- if (layout.fCType != "") {
- return layout.fCType;
- } else if (type == *context.fFloat_Type || type == *context.fHalf_Type) {
+String HCodeGenerator::ParameterType(const Context& context, const Type& type) {
+ if (type == *context.fFloat_Type || type == *context.fHalf_Type) {
return "float";
} else if (type == *context.fFloat2_Type || type == *context.fHalf2_Type) {
return "SkPoint";
@@ -45,8 +42,7 @@ String HCodeGenerator::ParameterType(const Context& context, const Type& type,
return type.name();
}
-String HCodeGenerator::FieldType(const Context& context, const Type& type,
- const Layout& layout) {
+String HCodeGenerator::FieldType(const Context& context, const Type& type) {
if (type.kind() == Type::kSampler_Kind) {
return "TextureSampler";
} else if (type == *context.fFragmentProcessor_Type) {
@@ -55,7 +51,7 @@ String HCodeGenerator::FieldType(const Context& context, const Type& type,
ASSERT(false);
return "<error>";
}
- return ParameterType(context, type, layout);
+ return ParameterType(context, type);
}
void HCodeGenerator::writef(const char* s, va_list va) {
@@ -138,8 +134,7 @@ void HCodeGenerator::writeMake() {
this->writef(" static std::unique_ptr<GrFragmentProcessor> Make(");
separator = "";
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
- this->writef("%s%s %s", separator, ParameterType(fContext, param->fType,
- param->fModifiers.fLayout).c_str(),
+ this->writef("%s%s %s", separator, ParameterType(fContext, param->fType).c_str(),
String(param->fName).c_str());
separator = ", ";
}
@@ -181,8 +176,7 @@ void HCodeGenerator::writeConstructor() {
this->writef(" %s(", fFullName.c_str());
const char* separator = "";
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
- this->writef("%s%s %s", separator, ParameterType(fContext, param->fType,
- param->fModifiers.fLayout).c_str(),
+ this->writef("%s%s %s", separator, ParameterType(fContext, param->fType).c_str(),
String(param->fName).c_str());
separator = ", ";
}
@@ -241,8 +235,7 @@ void HCodeGenerator::writeFields() {
if (param->fType == *fContext.fFragmentProcessor_Type) {
continue;
}
- this->writef(" %s %s;\n", FieldType(fContext, param->fType,
- param->fModifiers.fLayout).c_str(),
+ this->writef(" %s %s;\n", FieldType(fContext, param->fType).c_str(),
FieldName(String(param->fName).c_str()).c_str());
}
for (const Section* s : fSectionAndParameterHelper.getSections(COORD_TRANSFORM_SECTION)) {
@@ -274,8 +267,7 @@ bool HCodeGenerator::generateCode() {
String nameString(param->fName);
const char* name = nameString.c_str();
this->writef(" %s %s() const { return %s; }\n",
- FieldType(fContext, param->fType, param->fModifiers.fLayout).c_str(), name,
- FieldName(name).c_str());
+ FieldType(fContext, param->fType).c_str(), name, FieldName(name).c_str());
}
this->writeMake();
this->writef(" %s(const %s& src);\n"