d0f712f3fe
The fuzzer managed to create a test case which temporarily evaluates to expression `half2(half(0.2)) + 2` as it is optimized. This requires a bunch of temporary nonsense math as the IR Generator is attempting to simplify as it goes; various attempts to remove terms from the fuzzer test-case would cause it to stop reproducing the error. Constructor::getVecComponent assumed that any constructor with a single scalar argument would always implement `getConstantFloat` and `getConstantInt`; however, constructors themselves did not actually implement these methods. This meant that nesting a scalar constructor inside a non-scalar constructor would abort when it tried to deduce the value inside the inner constructor. This has been fixed by implementing `getConstantFloat` and `getConstantInt` for Constructors. These methods will assert if the constructor has more than one argument or is a non-scalar type. This should allow any number of nested constructors, e.g. `half4(half(half(half(1))))` should recursively evaluate properly, should we somehow generate this as an intermediate expression. Change-Id: Iaee4284cba03974443cd7b5dccfd7909c1a5f3a6 Bug: oss-fuzz:27614 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335868 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>
14 lines
362 B
Metal
14 lines
362 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _outputStruct;
|
|
thread Outputs* _out = &_outputStruct;
|
|
return *_out;
|
|
}
|