Fix assertion when swizzling literals.
The fuzzer generated the expression `(6).xx`, which triggered a type-checking assertion. This swizzle was otherwise harmless. Change-Id: Icb12f93fe3f6d88265d67e689ceb85cf1085c9e8 Bug: oss-fuzz:36655 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434464 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
58920bbdca
commit
d340042cd6
@ -14,7 +14,7 @@ std::unique_ptr<Expression> ConstructorSplat::Make(const Context& context,
|
||||
int offset,
|
||||
const Type& type,
|
||||
std::unique_ptr<Expression> arg) {
|
||||
SkASSERT(arg->type() == type.componentType());
|
||||
SkASSERT(arg->type().scalarTypeForLiteral() == type.componentType().scalarTypeForLiteral());
|
||||
SkASSERT(arg->type().isScalar());
|
||||
|
||||
// A "splat" to a scalar type is a no-op and can be eliminated.
|
||||
|
@ -382,8 +382,7 @@ std::unique_ptr<Expression> Swizzle::Make(const Context& context,
|
||||
}
|
||||
SkASSERT(writeIdx == numConstructorArgs);
|
||||
|
||||
// Count up the number of times each constructor argument is used by the
|
||||
// swizzle.
|
||||
// Count up the number of times each constructor argument is used by the swizzle.
|
||||
// `half4(bar.yz, half2(foo)).xwxy` -> { 3, 1 }
|
||||
// - bar.yz is referenced 3 times, by `.x_xy`
|
||||
// - half(foo) is referenced 1 time, by `._w__`
|
||||
|
Loading…
Reference in New Issue
Block a user