Make Program owned-elements public.
Change-Id: I7680376d0f0a7bbaa7cb845e2223b9ce4d29c96f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456797
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index a3f9ede..4d429b6 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -477,12 +477,12 @@
return true;
};
- program.fElements.erase(std::remove_if(program.fElements.begin(),
- program.fElements.end(),
- [&](const std::unique_ptr<ProgramElement>& element) {
- return isDeadFunction(element.get());
- }),
- program.fElements.end());
+ program.fOwnedElements.erase(std::remove_if(program.fOwnedElements.begin(),
+ program.fOwnedElements.end(),
+ [&](const std::unique_ptr<ProgramElement>& pe) {
+ return isDeadFunction(pe.get());
+ }),
+ program.fOwnedElements.end());
program.fSharedElements.erase(std::remove_if(program.fSharedElements.begin(),
program.fSharedElements.end(),
isDeadFunction),
@@ -508,12 +508,12 @@
return true;
};
- program.fElements.erase(std::remove_if(program.fElements.begin(),
- program.fElements.end(),
- [&](const std::unique_ptr<ProgramElement>& element) {
- return isDeadVariable(element.get());
- }),
- program.fElements.end());
+ program.fOwnedElements.erase(std::remove_if(program.fOwnedElements.begin(),
+ program.fOwnedElements.end(),
+ [&](const std::unique_ptr<ProgramElement>& pe) {
+ return isDeadVariable(pe.get());
+ }),
+ program.fOwnedElements.end());
program.fSharedElements.erase(std::remove_if(program.fSharedElements.begin(),
program.fSharedElements.end(),
isDeadVariable),
@@ -523,7 +523,7 @@
}
void Compiler::removeUnreachableCode(Program& program, ProgramUsage* usage) {
- for (std::unique_ptr<ProgramElement>& pe : program.ownedElements()) {
+ for (std::unique_ptr<ProgramElement>& pe : program.fOwnedElements) {
if (pe->is<FunctionDefinition>()) {
Transform::EliminateUnreachableCode(pe->as<FunctionDefinition>().body(), usage);
}
@@ -542,7 +542,7 @@
if (this->errorCount() == 0) {
// Run the inliner only once; it is expensive! Multiple passes can occasionally shake out
// more wins, but it's diminishing returns.
- this->runInliner(program.ownedElements(), program.fSymbols, usage);
+ this->runInliner(program.fOwnedElements, program.fSymbols, usage);
// Unreachable code can confuse some drivers, so it's worth removing. (skia:12012)
this->removeUnreachableCode(program, usage);
@@ -589,7 +589,7 @@
if (fContext->fConfig->strictES2Mode() && this->errorCount() == 0) {
// Enforce Appendix A, Section 5 of the GLSL ES 1.00 spec -- Indexing. This logic assumes
// that all loops meet the criteria of Section 4, and if they don't, could crash.
- for (const auto& pe : program.ownedElements()) {
+ for (const auto& pe : program.fOwnedElements) {
Analysis::ValidateIndexingForES2(*pe, this->errorReporter());
}
// Verify that the program size is reasonable after unrolling and inlining. This also