WebKit Bugzilla
Attachment 348451 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-20180829165220.patch (text/plain), 7.67 KB, created by
Myles C. Maxfield
on 2018-08-29 16:52:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-08-29 16:52:21 PDT
Size:
7.67 KB
patch
obsolete
>Subversion Revision: 235487 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 3ad6772a8a07b5ea6819e7bb50bf6e7ba66efd99..be5c5927fb808c91e1bb87e3ac9fcdfb9b3a5400 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-29 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [WHLSL] Test row-majorness of matrices >+ https://bugs.webkit.org/show_bug.cgi?id=189101 >+ >+ The matrix multiplication functions are temporarily commented out of the standard library, >+ so I've temporarily copy/pasted them into the test. Matrix multiplication is not >+ commutative, so it requires the right indexing order. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebGPUShadingLanguageRI/Intrinsics.js: >+ * WebGPUShadingLanguageRI/StandardLibrary.js: >+ (let.standardLibrary): >+ * WebGPUShadingLanguageRI/Test.js: >+ > 2018-08-29 Jer Noble <jer.noble@apple.com> > > Unreviewed test gardening; NowPlayingTest API tests require High Sierra. >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.html b/Tools/WebGPUShadingLanguageRI/Test.html >index 607a6953253da727b1de37678ec388b4fa240405..20ddd95d0c4db021222cf4b10c6afbef8f727962 100644 >--- a/Tools/WebGPUShadingLanguageRI/Test.html >+++ b/Tools/WebGPUShadingLanguageRI/Test.html >@@ -152,7 +152,7 @@ > <script> > function doTestInBrowser() > { >- var tester = doTest(/.*/); >+ var tester = doTest(/matrixMultiplication/); > var lastTime; > function next() > { >diff --git a/Tools/WebGPUShadingLanguageRI/Test.js b/Tools/WebGPUShadingLanguageRI/Test.js >index ab96bc477f7f1e29dbdf62f5260ce49e5e7100d8..2b5f872d8970c9e9e039a8b1827e377380789ffb 100644 >--- a/Tools/WebGPUShadingLanguageRI/Test.js >+++ b/Tools/WebGPUShadingLanguageRI/Test.js >@@ -5451,6 +5451,106 @@ 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; >+ } >+ float2x3 matrix1() { >+ 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; >+ return x; >+ } >+ float3x4 matrix2() { >+ 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 y; >+ } >+ float foo00() { >+ return multiply(matrix1(), matrix2())[0][0]; >+ } >+ float foo01() { >+ return multiply(matrix1(), matrix2())[0][1]; >+ } >+ float foo02() { >+ return multiply(matrix1(), matrix2())[0][2]; >+ } >+ float foo03() { >+ return multiply(matrix1(), matrix2())[0][3]; >+ } >+ float foo10() { >+ return multiply(matrix1(), matrix2())[1][0]; >+ } >+ float foo11() { >+ return multiply(matrix1(), matrix2())[1][1]; >+ } >+ float foo12() { >+ return multiply(matrix1(), matrix2())[1][2]; >+ } >+ float foo13() { >+ return multiply(matrix1(), matrix2())[1][3]; >+ } >+ `); >+ checkFloat(program, callFunction(program, "foo00", []), 17 * 2 + 31 * 3 + 47 * 5); >+ checkFloat(program, callFunction(program, "foo01", []), 19 * 2 + 37 * 3 + 53 * 5); >+ checkFloat(program, callFunction(program, "foo02", []), 23 * 2 + 41 * 3 + 59 * 5); >+ checkFloat(program, callFunction(program, "foo03", []), 29 * 2 + 43 * 3 + 61 * 5); >+ checkFloat(program, callFunction(program, "foo10", []), 17 * 7 + 31 * 11 + 47 * 13); >+ checkFloat(program, callFunction(program, "foo11", []), 19 * 7 + 37 * 11 + 53 * 13); >+ checkFloat(program, callFunction(program, "foo12", []), 23 * 7 + 41 * 11 + 59 * 13); >+ checkFloat(program, callFunction(program, "foo13", []), 29 * 7 + 43 * 11 + 61 * 13); >+} >+ > 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