fixed issue with SkSL dead code elimination
Bug: skia:6747 Change-Id: I8566f0f6822a452167079cca004730ec0db318a8 Reviewed-on: https://skia-review.googlesource.com/19275 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
2ee0f42a4b
commit
b310fd597f
@ -736,7 +736,7 @@ void GLSLCodeGenerator::writeIfStatement(const IfStatement& stmt) {
|
||||
|
||||
void GLSLCodeGenerator::writeForStatement(const ForStatement& f) {
|
||||
this->write("for (");
|
||||
if (f.fInitializer) {
|
||||
if (f.fInitializer && !f.fInitializer->isEmpty()) {
|
||||
this->writeStatement(*f.fInitializer);
|
||||
} else {
|
||||
this->write("; ");
|
||||
|
@ -1375,4 +1375,22 @@ DEF_TEST(SkSLDependentInitializers, r) {
|
||||
"}\n");
|
||||
}
|
||||
|
||||
DEF_TEST(SkSLDeadLoopVar, r) {
|
||||
test(r,
|
||||
"void main() {"
|
||||
"for (int x = 0; x < 4; ) {"
|
||||
"break;"
|
||||
"}"
|
||||
"}",
|
||||
*SkSL::ShaderCapsFactory::Default(),
|
||||
"#version 400\n"
|
||||
"out vec4 sk_FragColor;\n"
|
||||
"void main() {\n"
|
||||
" for (; true; ) {\n"
|
||||
" break;\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user