Revert "SkSL now supports null child processors"
This reverts commit 0e8dc4ce36f900ea428abd30ebcecbcc679d580c.
Reason for revert: ASAN complaints
Original change's description:
> SkSL now supports null child processors
>
> Bug: skia:
> Change-Id: Icb3f2d57b393e3d40247aaad98c17344b507f0d7
> Reviewed-on: https://skia-review.googlesource.com/c/193379
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
TBR=bsalomon@google.com,ethannicholas@google.com,fmalita@chromium.org
Change-Id: Ibf739b3c6afd32d44f6b20705922618c29960d16
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/194020
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/sksl/SkSLHCodeGenerator.cpp b/src/sksl/SkSLHCodeGenerator.cpp
index e4f0acd..cb8712e 100644
--- a/src/sksl/SkSLHCodeGenerator.cpp
+++ b/src/sksl/SkSLHCodeGenerator.cpp
@@ -41,9 +41,7 @@
if (layout.fCType != Layout::CType::kDefault) {
return layout.fCType;
}
- if (type.kind() == Type::kNullable_Kind) {
- return ParameterCType(context, type.componentType(), layout);
- } else if (type == *context.fFloat_Type || type == *context.fHalf_Type) {
+ if (type == *context.fFloat_Type || type == *context.fHalf_Type) {
return Layout::CType::kFloat;
} else if (type == *context.fInt_Type ||
type == *context.fShort_Type ||
@@ -191,7 +189,7 @@
fFullName.c_str());
separator = "";
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
- if (param->fType.nonnullable() == *fContext.fFragmentProcessor_Type) {
+ if (param->fType == *fContext.fFragmentProcessor_Type) {
this->writef("%sstd::move(%s)", separator, String(param->fName).c_str());
} else {
this->writef("%s%s", separator, String(param->fName).c_str());
@@ -239,8 +237,7 @@
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
String nameString(param->fName);
const char* name = nameString.c_str();
- const Type& type = param->fType.nonnullable();
- if (type.kind() == Type::kSampler_Kind) {
+ if (param->fType.kind() == Type::kSampler_Kind) {
this->writef("\n , %s(std::move(%s)", FieldName(name).c_str(), name);
for (const Section* s : fSectionAndParameterHelper.getSections(
SAMPLER_PARAMS_SECTION)) {
@@ -249,7 +246,7 @@
}
}
this->writef(")");
- } else if (type == *fContext.fFragmentProcessor_Type) {
+ } else if (param->fType == *fContext.fFragmentProcessor_Type) {
// do nothing
} else {
this->writef("\n , %s(%s)", FieldName(name).c_str(), name);
@@ -273,19 +270,9 @@
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
if (param->fType.kind() == Type::kSampler_Kind) {
++samplerCount;
- } else if (param->fType.nonnullable() == *fContext.fFragmentProcessor_Type) {
- if (param->fType.kind() == Type::kNullable_Kind) {
- this->writef(" if (%s) {\n", String(param->fName).c_str());
- } else {
- this->writef(" SkASSERT(%s);", String(param->fName).c_str());
- }
- this->writef(" %s_index = this->numChildProcessors();",
- FieldName(String(param->fName).c_str()).c_str());
- this->writef(" this->registerChildProcessor(std::move(%s));",
+ } else if (param->fType == *fContext.fFragmentProcessor_Type) {
+ this->writef(" this->registerChildProcessor(std::move(%s));",
String(param->fName).c_str());
- if (param->fType.kind() == Type::kNullable_Kind) {
- this->writef(" }");
- }
}
}
if (samplerCount) {
@@ -302,14 +289,12 @@
void HCodeGenerator::writeFields() {
this->writeSection(FIELDS_SECTION);
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
- String name = FieldName(String(param->fName).c_str());
- if (param->fType.nonnullable() == *fContext.fFragmentProcessor_Type) {
- this->writef(" int %s_index = -1;\n", name.c_str());
- } else {
- this->writef(" %s %s;\n", FieldType(fContext, param->fType,
- param->fModifiers.fLayout).c_str(),
- name.c_str());
+ if (param->fType == *fContext.fFragmentProcessor_Type) {
+ continue;
}
+ this->writef(" %s %s;\n", FieldType(fContext, param->fType,
+ param->fModifiers.fLayout).c_str(),
+ FieldName(String(param->fName).c_str()).c_str());
}
const auto transforms = fSectionAndParameterHelper.getSections(COORD_TRANSFORM_SECTION);
for (size_t i = 0; i < transforms.size(); ++i) {
@@ -356,19 +341,15 @@
}
this->writeSection(CLASS_SECTION);
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
- if (param->fType.kind() == Type::kSampler_Kind) {
+ if (param->fType.kind() == Type::kSampler_Kind ||
+ param->fType.kind() == Type::kOther_Kind) {
continue;
}
String nameString(param->fName);
const char* name = nameString.c_str();
- if (param->fType.nonnullable() == *fContext.fFragmentProcessor_Type) {
- this->writef(" int %s_index() const { return %s_index; }\n", name,
- FieldName(name).c_str());
- } else {
- this->writef(" %s %s() const { return %s; }\n",
- AccessType(fContext, param->fType, param->fModifiers.fLayout).c_str(),
- name, FieldName(name).c_str());
- }
+ this->writef(" %s %s() const { return %s; }\n",
+ AccessType(fContext, param->fType, param->fModifiers.fLayout).c_str(), name,
+ FieldName(name).c_str());
}
this->writeMake();
this->writef(" %s(const %s& src);\n"