Avoid making a constructor with a $literal type.

While working on an unrelated fix, I noticed that Ossfuzz28904.sksl has
an expression which generates a constructor of $literal type: `-2 .L1`

This shouldn't ever happen, so the code is now fixed to avoid it. This
doesn't affect any of the output from our existing tests. (In that
oss-fuzz test, that literal constructor is immediately expanded out to
an ivec2 by the swizzle, at which point it loses its $literal status
anyway.)

Change-Id: I34d1b0ad9e7c25987119d3337f4bb9e7b8a5619c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376617
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-02-26 09:52:22 -05:00 committed by Skia Commit-Bot
parent 85e1ecf4da
commit e7f071acc1

View File

@ -26,7 +26,7 @@ std::unique_ptr<Expression> Constructor::Make(const Context& context,
return std::move(args[0]);
}
if (type.isScalar()) {
return MakeScalarConstructor(context, offset, type, std::move(args));
return MakeScalarConstructor(context, offset, type.scalarTypeForLiteral(), std::move(args));
}
if (type.isVector() || type.isMatrix()) {
return MakeCompoundConstructor(context, offset, type, std::move(args));