skslc SPIR-V mod support
authorEthan Nicholas <ethannicholas@google.com>
Wed, 17 May 2017 17:13:21 +0000 (13:13 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 17 May 2017 17:41:09 +0000 (17:41 +0000)
Change-Id: I2df761ff0d25712dc48d367585d4b639e46d5d97
Reviewed-on: https://skia-review.googlesource.com/17243
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

src/sksl/SkSLSPIRVCodeGenerator.cpp

index 1cbd127..00ab25c 100644 (file)
@@ -2188,6 +2188,9 @@ SpvId SPIRVCodeGenerator::writeBinaryExpression(const BinaryExpression& b, Outpu
         case Token::SLASH:
             return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFDiv,
                                               SpvOpSDiv, SpvOpUDiv, SpvOpUndef, out);
+        case Token::PERCENT:
+            return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFMod,
+                                              SpvOpSMod, SpvOpUMod, SpvOpUndef, out);
         case Token::PLUSEQ: {
             SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFAdd,
                                                       SpvOpIAdd, SpvOpIAdd, SpvOpUndef, out);
@@ -2226,6 +2229,13 @@ SpvId SPIRVCodeGenerator::writeBinaryExpression(const BinaryExpression& b, Outpu
             lvalue->store(result, out);
             return result;
         }
+        case Token::PERCENTEQ: {
+            SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFMod,
+                                                      SpvOpSMod, SpvOpUMod, SpvOpUndef, out);
+            ASSERT(lvalue);
+            lvalue->store(result, out);
+            return result;
+        }
         default:
             // FIXME: missing support for some operators (bitwise, &&=, ||=, shift...)
             ABORT("unsupported binary expression: %s", b.description().c_str());