WebKit Bugzilla
Attachment 348440 Details for
Bug 189101
: [WHLSL] Test row-majorness of matrices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189101-20180829153253.patch (text/plain), 7.17 KB, created by
Myles C. Maxfield
on 2018-08-29 15:32:55 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-08-29 15:32:55 PDT
Size:
7.17 KB
patch
obsolete
>Subversion Revision: 235475 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 472bc3e9d6d4f8c0c0b2092c427c7931e85a3088..96b789446c171347096c189416be67fc184c6166 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-29 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [WHLSL] Test row-majorness of matrices >+ https://bugs.webkit.org/show_bug.cgi?id=189101 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebGPUShadingLanguageRI/Intrinsics.js: >+ * WebGPUShadingLanguageRI/StandardLibrary.js: >+ (let.standardLibrary): >+ * WebGPUShadingLanguageRI/Test.js: >+ > 2018-08-29 Jer Noble <jer.noble@apple.com> > > Muted elements do not have their Now Playing status updated when unmuted. >diff --git a/Tools/WebGPUShadingLanguageRI/Intrinsics.js b/Tools/WebGPUShadingLanguageRI/Intrinsics.js >index 79f59070daffb55a3f3a70a3b1badb4ce68cd4ef..b004067f5ebfb3a8b4bd98e437a8c0768be26f1e 100644 >--- a/Tools/WebGPUShadingLanguageRI/Intrinsics.js >+++ b/Tools/WebGPUShadingLanguageRI/Intrinsics.js >@@ -316,11 +316,11 @@ class Intrinsics { > } > } > >- for (let type of ["half", "float"]) { >+ for (let typeName of ["half", "float"]) { > for (let height = 2; height <= 4; ++height) { > for (let width = 2; width <= 4; ++width) { >- this._map.set(`native typedef matrix<${type}, ${height}, ${width}>`, type => { >- this[`matrix<${type}, ${height}, ${width}>`] = type; >+ this._map.set(`native typedef matrix<${typeName}, ${height}, ${width}>`, type => { >+ this[`matrix<${typeName}, ${height}, ${width}>`] = type; > }); > } > } >diff --git a/Tools/WebGPUShadingLanguageRI/StandardLibrary.js b/Tools/WebGPUShadingLanguageRI/StandardLibrary.js >index 6a33236617a431bd8239baa469d3ed80c1a9a02f..3dd4fee18600d5cd2a895ad5a479721da7788cc1 100644 >--- a/Tools/WebGPUShadingLanguageRI/StandardLibrary.js >+++ b/Tools/WebGPUShadingLanguageRI/StandardLibrary.js >@@ -1876,9 +1876,9 @@ let standardLibrary = (function() { > print(` ${type}${i}x${k} result;`); > for (var p = 0; p < i; ++p) { > for (var r = 0; r < k; ++r) { >- print(` result[${p}][${k}] = 0;`); >+ print(` result[${p}][${r}] = 0;`); > for (var q = 0; q < j; ++q) { >- print(` result[${p}][${k}] += x[${p}][${q}] * y[${q}][${r}];`); >+ print(` result[${p}][${r}] += x[${p}][${q}] * y[${q}][${r}];`); > } > } > } >diff --git a/Tools/WebGPUShadingLanguageRI/Test.js b/Tools/WebGPUShadingLanguageRI/Test.js >index ab96bc477f7f1e29dbdf62f5260ce49e5e7100d8..5d1877c8249c724433ef78d6e1b5115b9f043927 100644 >--- a/Tools/WebGPUShadingLanguageRI/Test.js >+++ b/Tools/WebGPUShadingLanguageRI/Test.js >@@ -5451,6 +5451,115 @@ tests.halfSimpleMath = function() { > checkHalf(program, callFunction(program, "foo", [makeHalf(program, 7), makeHalf(program, -2)]), -3.5); > } > >+tests.matrixMultiplication = function() { >+ let program = doPrep(` >+ float2x4 multiply(float2x3 x, float3x4 y) { >+ // Copied and pasted from the standard library >+ float2x4 result; >+ result[0][0] = 0; >+ result[0][0] += x[0][0] * y[0][0]; >+ result[0][0] += x[0][1] * y[1][0]; >+ result[0][0] += x[0][2] * y[2][0]; >+ result[0][1] = 0; >+ result[0][1] += x[0][0] * y[0][1]; >+ result[0][1] += x[0][1] * y[1][1]; >+ result[0][1] += x[0][2] * y[2][1]; >+ result[0][2] = 0; >+ result[0][2] += x[0][0] * y[0][2]; >+ result[0][2] += x[0][1] * y[1][2]; >+ result[0][2] += x[0][2] * y[2][2]; >+ result[0][3] = 0; >+ result[0][3] += x[0][0] * y[0][3]; >+ result[0][3] += x[0][1] * y[1][3]; >+ result[0][3] += x[0][2] * y[2][3]; >+ result[1][0] = 0; >+ result[1][0] += x[1][0] * y[0][0]; >+ result[1][0] += x[1][1] * y[1][0]; >+ result[1][0] += x[1][2] * y[2][0]; >+ result[1][1] = 0; >+ result[1][1] += x[1][0] * y[0][1]; >+ result[1][1] += x[1][1] * y[1][1]; >+ result[1][1] += x[1][2] * y[2][1]; >+ result[1][2] = 0; >+ result[1][2] += x[1][0] * y[0][2]; >+ result[1][2] += x[1][1] * y[1][2]; >+ result[1][2] += x[1][2] * y[2][2]; >+ result[1][3] = 0; >+ result[1][3] += x[1][0] * y[0][3]; >+ result[1][3] += x[1][1] * y[1][3]; >+ result[1][3] += x[1][2] * y[2][3]; >+ return result; >+ } >+ float2x4 foo() { >+ float2x3 x; >+ x[0][0] = 2; >+ x[0][1] = 3; >+ x[0][2] = 5; >+ x[1][0] = 7; >+ x[1][1] = 11; >+ x[1][2] = 13; >+ float3x4 y; >+ y[0][0] = 17; >+ y[0][1] = 19; >+ y[0][2] = 23; >+ y[0][3] = 29; >+ y[1][0] = 31; >+ y[1][1] = 37; >+ y[1][2] = 41; >+ y[1][3] = 43; >+ y[2][0] = 47; >+ y[2][1] = 53; >+ y[2][2] = 59; >+ y[2][3] = 61; >+ return multiply(x, y); >+ } >+ float bar() { >+ float2x3 x; >+ x[0][0] = 2; >+ x[0][1] = 3; >+ x[0][2] = 5; >+ x[1][0] = 7; >+ x[1][1] = 11; >+ x[1][2] = 13; >+ float3x4 y; >+ y[0][0] = 17; >+ y[0][1] = 19; >+ y[0][2] = 23; >+ y[0][3] = 29; >+ y[1][0] = 31; >+ y[1][1] = 37; >+ y[1][2] = 41; >+ y[1][3] = 43; >+ y[2][0] = 47; >+ y[2][1] = 53; >+ y[2][2] = 59; >+ y[2][3] = 61; >+ return multiply(x, y)[0][1]; >+ } >+ `); >+ let result = callFunction(program, "foo", []); >+ if (!result.type.equals(program.intrinsics["matrix<float, 2, 4>"])) >+ throw new Error("Wrong result type: " + result.type); >+ // Matrices are a collection of rows >+ if (result.ePtr.get(0) != 17 * 2 + 31 * 3 + 47 * 5) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(1) != 19 * 2 + 37 * 3 + 53 * 5) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(2) != 23 * 2 + 41 * 3 + 59 * 5) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(3) != 29 * 2 + 43 * 3 + 61 * 5) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(4) != 17 * 7 + 31 * 11 + 47 * 13) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(5) != 19 * 7 + 37 * 11 + 53 * 13) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(6) != 23 * 7 + 41 * 11 + 59 * 13) >+ throw new Error("Wrong result!"); >+ if (result.ePtr.get(7) != 29 * 7 + 43 * 11 + 61 * 13) >+ throw new Error("Wrong result!"); >+ checkFloat(program, callFunction(program, "bar", []), 19 * 2 + 37 * 3 + 53 * 5); >+} >+ > okToTest = true; > > let testFilter = /.*/; // run everything by default
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189101
:
348440
|
348451
|
348452
|
348457
|
348458