ByteCode: Allow calls to functions that return void
Change-Id: Ia2e21bc984c509cd2405499f93ee5e19941cc492
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222499
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/sksl/SkSLByteCodeGenerator.cpp b/src/sksl/SkSLByteCodeGenerator.cpp
index d8dcb25..4a71b0d 100644
--- a/src/sksl/SkSLByteCodeGenerator.cpp
+++ b/src/sksl/SkSLByteCodeGenerator.cpp
@@ -28,7 +28,9 @@
int ByteCodeGenerator::SlotCount(const Type& type) {
- if (type.kind() == Type::kStruct_Kind) {
+ if (type.kind() == Type::kOther_Kind) {
+ return 0;
+ } else if (type.kind() == Type::kStruct_Kind) {
int slots = 0;
for (const auto& f : type.fields()) {
slots += SlotCount(*f.fType);
@@ -828,7 +830,7 @@
if (count > 4) {
this->write(ByteCodeInstruction::kPopN);
this->write8(count);
- } else {
+ } else if (count != 0) {
this->write(vector_instruction(ByteCodeInstruction::kPop, count));
}
discard = false;