Disallow narrowing conversions as part of matrix multiply-assignment

By doing the component-type deduction with simple multiplication:

  halfVec *= floatMat

Would decide that the resulting component type could be float, which
actually caused an assert later (because coerce() had to wrap the
variable reference in a Constructor, making it an invalid target for a
write).

Change-Id: I459897c62d80ecb1e406e5b351a80c25427d5a30
Bug: skia:10732
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317587
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2020-09-17 15:10:25 -04:00 committed by Skia Commit-Bot
parent 95cf99b4ea
commit 3ed22a9c0c

View File

@ -1597,7 +1597,7 @@ static bool determine_binary_type(const Context& context,
case Token::Kind::TK_STAR:
if (is_matrix_multiply(left, right)) {
// determine final component type
if (determine_binary_type(context, allowNarrowing, Token::Kind::TK_STAR,
if (determine_binary_type(context, allowNarrowing, op,
left.componentType(), right.componentType(),
outLeftType, outRightType, outResultType)) {
*outLeftType = &(*outResultType)->toCompound(context, left.columns(),