Added: trunk/LayoutTests/webgpu/whlsl/matrix-constructors-list-of-scalars.html (0 => 248754)
--- trunk/LayoutTests/webgpu/whlsl/matrix-constructors-list-of-scalars.html (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl/matrix-constructors-list-of-scalars.html 2019-08-16 01:39:34 UTC (rev 248754)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test prefix/postfix.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+const epsilon = 0.0001;
+
+whlslTests.listOfScalarsMatrixConstructors = async () =>
+{
+ let program = `
+ float a()
+ {
+ float2x2 m = float2x2(1, 2, 3, 4);
+ return m[1][0];
+ }
+ float b()
+ {
+ float2x3 m = float2x3(1, 2, 3, 4, 5, 6);
+ return m[1][0];
+ }
+ float c()
+ {
+ float2x4 m = float2x4(1, 2, 3, 4, 5, 6, 7, 8);
+ return m[1][0];
+ }
+ float d()
+ {
+ float3x2 m = float3x2(1, 2, 3, 4, 5, 6);
+ return m[1][0];
+ }
+ float e()
+ {
+ float3x3 m = float3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
+ return m[1][0];
+ }
+ float f()
+ {
+ float3x4 m = float3x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+ return m[1][0];
+ }
+ float g()
+ {
+ float4x2 m = float4x2(1, 2, 3, 4, 5, 6, 7, 8);
+ return m[1][0];
+ }
+ float h()
+ {
+ float4x3 m = float4x3(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+ return m[1][0];
+ }
+ float i()
+ {
+ float4x4 m = float4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+ return m[1][0];
+ }
+ `;
+ assert_approx_equals(await callFloatFunction(program, "a", []), 3, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "b", []), 4, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "c", []), 5, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "d", []), 3, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "e", []), 4, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "f", []), 5, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "g", []), 3, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "h", []), 4, epsilon);
+ assert_approx_equals(await callFloatFunction(program, "i", []), 5, epsilon);
+}
+
+
+runTests(whlslTests);
+</script>
+</html>
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt (248753 => 248754)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt 2019-08-16 00:43:11 UTC (rev 248753)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt 2019-08-16 01:39:34 UTC (rev 248754)
@@ -13196,8 +13196,34 @@
result[3] = d;
return result;
}
+operator float2x2(float a, float b, float e, float f) {
+ return float2x2(float2(a, b), float2(e, f));
+}
+operator float2x3(float a, float b, float c, float e, float f, float g) {
+ return float2x3(float3(a, b, c), float3(e, f, g));
+}
+operator float2x4(float a, float b, float c, float d, float e, float f, float g, float h) {
+ return float2x4(float4(a, b, c, d), float4(e, f, g, h));
+}
+operator float3x2(float a, float b, float e, float f, float i, float j) {
+ return float3x2(float2(a, b), float2(e, f), float2(i, j));
+}
+operator float3x3(float a, float b, float c, float e, float f, float g, float i, float j, float k) {
+ return float3x3(float3(a, b, c), float3(e, f, g), float3(i, j, k));
+}
+operator float3x4(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l) {
+ return float3x4(float4(a, b, c, d), float4(e, f, g, h), float4(i, j, k, l));
+}
+operator float4x2(float a, float b, float e, float f, float i, float j, float m, float n) {
+ return float4x2(float2(a, b), float2(e, f), float2(i, j), float2(m, n));
+}
+operator float4x3(float a, float b, float c, float e, float f, float g, float i, float j, float k, float m, float n, float o) {
+ return float4x3(float3(a, b, c), float3(e, f, g), float3(i, j, k), float3(m, n, o));
+}
+operator float4x4(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o, float p) {
+ return float4x4(float4(a, b, c, d), float4(e, f, g, h), float4(i, j, k, l), float4(m, n, o, p));
+}
-
/* Functions named operator.wyx */
bool3 operator.wyx(bool4 v) {
bool3 result;