Title: [221490] trunk/Tools
Revision
221490
Author
fpi...@apple.com
Date
2017-09-01 11:57:15 -0700 (Fri, 01 Sep 2017)

Log Message

[WSL] Add tests for storing to arrays
https://bugs.webkit.org/show_bug.cgi?id=176237

Reviewed by Myles Maxfield.
        
Storing to arrays works now.

* WebGPUShadingLanguageRI/ArrayType.js:
(ArrayType):
* WebGPUShadingLanguageRI/Test.js:
(TEST_threadArrayStore):
(TEST_deviceArrayStore):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (221489 => 221490)


--- trunk/Tools/ChangeLog	2017-09-01 18:54:50 UTC (rev 221489)
+++ trunk/Tools/ChangeLog	2017-09-01 18:57:15 UTC (rev 221490)
@@ -1,3 +1,18 @@
+2017-09-01  Filip Pizlo  <fpi...@apple.com>
+
+        [WSL] Add tests for storing to arrays
+        https://bugs.webkit.org/show_bug.cgi?id=176237
+
+        Reviewed by Myles Maxfield.
+        
+        Storing to arrays works now.
+
+        * WebGPUShadingLanguageRI/ArrayType.js:
+        (ArrayType):
+        * WebGPUShadingLanguageRI/Test.js:
+        (TEST_threadArrayStore):
+        (TEST_deviceArrayStore):
+
 2017-09-01  Alex Christensen  <achristen...@webkit.org>
 
         Replace WKUIDelegatePrivate's isPlayingMediaDidChange with KVO _isPlayingAudio on WKWebView

Modified: trunk/Tools/WebGPUShadingLanguageRI/ArrayType.js (221489 => 221490)


--- trunk/Tools/WebGPUShadingLanguageRI/ArrayType.js	2017-09-01 18:54:50 UTC (rev 221489)
+++ trunk/Tools/WebGPUShadingLanguageRI/ArrayType.js	2017-09-01 18:57:15 UTC (rev 221490)
@@ -27,6 +27,7 @@
 class ArrayType extends Type {
     constructor(origin, elementType, numElements)
     {
+        super();
         this._origin = origin;
         this._elementType = elementType;
         this._numElements = numElements;

Modified: trunk/Tools/WebGPUShadingLanguageRI/Test.js (221489 => 221490)


--- trunk/Tools/WebGPUShadingLanguageRI/Test.js	2017-09-01 18:54:50 UTC (rev 221489)
+++ trunk/Tools/WebGPUShadingLanguageRI/Test.js	2017-09-01 18:57:15 UTC (rev 221490)
@@ -183,6 +183,46 @@
     checkInt(program, result, 89);
 }
 
+function TEST_threadArrayStore()
+{
+    let program = doPrep(`
+        void foo(thread int[] array, int value)
+        {
+            array[0u] = value;
+        }`);
+    let buffer = new EBuffer(1);
+    buffer.set(0, 15);
+    let arrayRef = TypedValue.box(
+        new ArrayRefType(null, "thread", program.intrinsics.int32),
+        new EArrayRef(new EPtr(buffer, 0), 1));
+    callFunction(program, "foo", [], [arrayRef, makeInt(program, 65)]);
+    if (buffer.get(0) != 65)
+        throw new Error("Bad value stored into buffer (expected 65): " + buffer.get(0));
+    callFunction(program, "foo", [], [arrayRef, makeInt(program, -111)]);
+    if (buffer.get(0) != -111)
+        throw new Error("Bad value stored into buffer (expected -111): " + buffer.get(0));
+}
+
+function TEST_deviceArrayStore()
+{
+    let program = doPrep(`
+        void foo(device int[] array, int value)
+        {
+            array[0u] = value;
+        }`);
+    let buffer = new EBuffer(1);
+    buffer.set(0, 15);
+    let arrayRef = TypedValue.box(
+        new ArrayRefType(null, "device", program.intrinsics.int32),
+        new EArrayRef(new EPtr(buffer, 0), 1));
+    callFunction(program, "foo", [], [arrayRef, makeInt(program, 65)]);
+    if (buffer.get(0) != 65)
+        throw new Error("Bad value stored into buffer (expected 65): " + buffer.get(0));
+    callFunction(program, "foo", [], [arrayRef, makeInt(program, -111)]);
+    if (buffer.get(0) != -111)
+        throw new Error("Bad value stored into buffer (expected -111): " + buffer.get(0));
+}
+
 let before = preciseTime();
 
 let filter = /.*/; // run everything by default
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to