144ea42b1a
Compile-time optimization is not yet implemented so the generated code contains a lot of checks which will be optimized away in a followup CL. Change-Id: I83b5df8580a6712686d18812e3848a703feac315 Bug: skia:12202 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447300 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>
45 lines
3.0 KiB
Plaintext
45 lines
3.0 KiB
Plaintext
uniform half4 colorGreen, colorRed;
|
|
uniform float2x2 testMatrix2x2;
|
|
uniform float3x3 testMatrix3x3;
|
|
uniform half4 testInputs; // equals (-1.25, 0, 0.75, 2.25)
|
|
|
|
half4 main(float2 coords) {
|
|
const float2 c12 = float2(1, 2);
|
|
const float2 c34 = float2(3, 4);
|
|
const float3 c123 = float3(1, 2, 3);
|
|
const float3 c456 = float3(4, 5, 6);
|
|
|
|
return (outerProduct(testMatrix2x2[0], testMatrix2x2[1]) == float2x2(3, 6,
|
|
4, 8)
|
|
&& outerProduct(c12, c34) == float2x2(3, 6,
|
|
4, 8)
|
|
&& outerProduct(testMatrix3x3[0], testMatrix3x3[1]) == float3x3(4, 8, 12,
|
|
5, 10, 15,
|
|
6, 12, 18)
|
|
&& outerProduct(c123, c456) == float3x3(4, 8, 12,
|
|
5, 10, 15,
|
|
6, 12, 18)
|
|
&& outerProduct(testMatrix2x2[0], testMatrix3x3[1]) == float3x2(4, 8,
|
|
5, 10,
|
|
6, 12)
|
|
&& outerProduct(c12, c456) == float3x2(4, 8,
|
|
5, 10,
|
|
6, 12)
|
|
&& outerProduct(testInputs, half4(1, 0, 0, 2)) == float4x4(-1.25, 0.0, 0.75, 2.25,
|
|
0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0.0, 0.0,
|
|
-2.50, 0.0, 1.50, 4.50)
|
|
&& outerProduct(half4(-1.25, 0, 0.75, 2.25), half4(1, 0, 0, 2))
|
|
== float4x4(-1.25, 0.0, 0.75, 2.25,
|
|
0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0.0, 0.0,
|
|
-2.50, 0.0, 1.50, 4.50)
|
|
&& outerProduct(testInputs, c12) == float2x4(-1.25, 0.0, 0.75, 2.25,
|
|
-2.50, 0.0, 1.50, 4.50)
|
|
&& outerProduct(c12, testInputs) == float4x2(-1.25, -2.50,
|
|
0.0, 0.0,
|
|
0.75, 1.50,
|
|
2.25, 4.50))
|
|
? colorGreen : colorRed;
|
|
}
|