aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-07-05 10:05:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-13 16:15:42 +0000
commitfd444bef1d8f2d7341191d19bfcaa94716fbeb3d (patch)
treec94305a5fb8f48abb119a51366655283f08fc493
parent89717fcbf10bdf7621795d7e5d32b034e1603a35 (diff)
SPIR-V support for more integer operations
Bug: skia: Change-Id: Ic4ff8dd8b08df8c44222bd7844f4a872377ff240 Reviewed-on: https://skia-review.googlesource.com/21440 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
-rw-r--r--src/sksl/SkSLSPIRVCodeGenerator.cpp58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index 21b83393e3..6426fc8ace 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -2236,6 +2236,23 @@ SpvId SPIRVCodeGenerator::writeBinaryExpression(const BinaryExpression& b, Outpu
case Token::PERCENT:
return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFMod,
SpvOpSMod, SpvOpUMod, SpvOpUndef, out);
+ case Token::SHL:
+ return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpUndef,
+ SpvOpShiftLeftLogical, SpvOpShiftLeftLogical,
+ SpvOpUndef, out);
+ case Token::SHR:
+ return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpUndef,
+ SpvOpShiftRightArithmetic, SpvOpShiftRightLogical,
+ SpvOpUndef, out);
+ case Token::BITWISEAND:
+ return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpUndef,
+ SpvOpBitwiseAnd, SpvOpBitwiseAnd, SpvOpUndef, out);
+ case Token::BITWISEOR:
+ return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpUndef,
+ SpvOpBitwiseOr, SpvOpBitwiseOr, SpvOpUndef, out);
+ case Token::BITWISEXOR:
+ return this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpUndef,
+ SpvOpBitwiseXor, SpvOpBitwiseXor, SpvOpUndef, out);
case Token::PLUSEQ: {
SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFAdd,
SpvOpIAdd, SpvOpIAdd, SpvOpUndef, out);
@@ -2281,8 +2298,47 @@ SpvId SPIRVCodeGenerator::writeBinaryExpression(const BinaryExpression& b, Outpu
lvalue->store(result, out);
return result;
}
+ case Token::SHLEQ: {
+ SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs,
+ SpvOpUndef, SpvOpShiftLeftLogical,
+ SpvOpShiftLeftLogical, SpvOpUndef, out);
+ ASSERT(lvalue);
+ lvalue->store(result, out);
+ return result;
+ }
+ case Token::SHREQ: {
+ SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs,
+ SpvOpUndef, SpvOpShiftRightArithmetic,
+ SpvOpShiftRightLogical, SpvOpUndef, out);
+ ASSERT(lvalue);
+ lvalue->store(result, out);
+ return result;
+ }
+ case Token::BITWISEANDEQ: {
+ SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs,
+ SpvOpUndef, SpvOpBitwiseAnd, SpvOpBitwiseAnd,
+ SpvOpUndef, out);
+ ASSERT(lvalue);
+ lvalue->store(result, out);
+ return result;
+ }
+ case Token::BITWISEOREQ: {
+ SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs,
+ SpvOpUndef, SpvOpBitwiseOr, SpvOpBitwiseOr,
+ SpvOpUndef, out);
+ ASSERT(lvalue);
+ lvalue->store(result, out);
+ return result;
+ }
+ case Token::BITWISEXOREQ: {
+ SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs,
+ SpvOpUndef, SpvOpBitwiseXor, SpvOpBitwiseXor,
+ 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());
}
}