fixed type error in SPIRV code generator

Bug: skia:7281
Change-Id: Icf3b4fb22292ef089aeff5f54d8ea3c54bcbc2e7
Reviewed-on: https://skia-review.googlesource.com/70103
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2017-11-10 13:49:18 -05:00 committed by Skia Commit-Bot
parent 71a38d9bae
commit 024301a822

View File

@ -2608,11 +2608,11 @@ SpvId SPIRVCodeGenerator::writeTernaryExpression(const TernaryExpression& t, Out
}
std::unique_ptr<Expression> create_literal_1(const Context& context, const Type& type) {
if (type == *context.fInt_Type) {
return std::unique_ptr<Expression>(new IntLiteral(context, -1, 1));
if (type.isInteger()) {
return std::unique_ptr<Expression>(new IntLiteral(context, -1, 1, &type));
}
else if (type == *context.fFloat_Type) {
return std::unique_ptr<Expression>(new FloatLiteral(context, -1, 1.0));
else if (type.isFloat()) {
return std::unique_ptr<Expression>(new FloatLiteral(context, -1, 1.0, &type));
} else {
ABORT("math is unsupported on type '%s'", type.name().c_str());
}