Interpreter: Fix bool literals

Change-Id: I0cf8e12d5ddb9b89aff39f484d8a017f61e4a20f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213465
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2019-05-13 14:19:12 -04:00 committed by Skia Commit-Bot
parent dfcaaa94b7
commit 44d44761c7
2 changed files with 3 additions and 1 deletions

View File

@ -307,7 +307,7 @@ void ByteCodeGenerator::writeBinaryExpression(const BinaryExpression& b) {
void ByteCodeGenerator::writeBoolLiteral(const BoolLiteral& b) {
this->align(4, 3);
this->write(ByteCodeInstruction::kPushImmediate);
this->write32(1);
this->write32(b.fValue ? 1 : 0);
}
void ByteCodeGenerator::writeConstructor(const Constructor& c) {

View File

@ -204,6 +204,8 @@ DEF_TEST(SkSLInterpreterDo, r) {
"(true); }", 0, 0, 0, 0, 1.5, 0, 0, 0);
test(r, "void main(inout half4 color) {do { color.r += 0.5; if (color.r < 5) "
"continue; if (color.r >= 5) break; } while (true); }", 0, 0, 0, 0, 5, 0, 0, 0);
test(r, "void main(inout half4 color) { do { color.r += 0.5; } while (false); }",
0, 0, 0, 0, 0.5, 0, 0, 0);
}
DEF_TEST(SkSLInterpreterFor, r) {