Title: [289700] trunk
Revision
289700
Author
[email protected]
Date
2022-02-12 14:44:19 -0800 (Sat, 12 Feb 2022)

Log Message

WebGL2 AllowShared TypedArray should be accepted
https://bugs.webkit.org/show_bug.cgi?id=232662

Reviewed by Dean Jackson.

Source/WebCore:

Test: webgl/webgl-allow-shared-typed-array.html

TypedArray with [AllowShared] annotation is not handled properly, which results in handling it as Sequence<T>,
invoking iteration protocol to copy them. This patch adds that as the same to [AllowShared] ArrayBuffer / ArrayBufferView.

* bindings/IDLTypes.h:
* bindings/js/JSDOMConvertUnion.h:

LayoutTests:

* webgl/webgl-allow-shared-typed-array-expected.txt: Added.
* webgl/webgl-allow-shared-typed-array.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289699 => 289700)


--- trunk/LayoutTests/ChangeLog	2022-02-12 21:33:33 UTC (rev 289699)
+++ trunk/LayoutTests/ChangeLog	2022-02-12 22:44:19 UTC (rev 289700)
@@ -1,3 +1,13 @@
+2022-02-12  Yusuke Suzuki  <[email protected]>
+
+        WebGL2 AllowShared TypedArray should be accepted
+        https://bugs.webkit.org/show_bug.cgi?id=232662
+
+        Reviewed by Dean Jackson.
+
+        * webgl/webgl-allow-shared-typed-array-expected.txt: Added.
+        * webgl/webgl-allow-shared-typed-array.html: Added.
+
 2022-02-12  Tim Nguyen  <[email protected]>
 
         Unreviewed test gardening: imported/w3c/web-platform-tests/url/toascii.window.html

Added: trunk/LayoutTests/webgl/webgl-allow-shared-typed-array-expected.txt (0 => 289700)


--- trunk/LayoutTests/webgl/webgl-allow-shared-typed-array-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgl/webgl-allow-shared-typed-array-expected.txt	2022-02-12 22:44:19 UTC (rev 289700)
@@ -0,0 +1,3 @@
+
+PASS WebGL2 AllowShared uniformMatrix4fv
+

Added: trunk/LayoutTests/webgl/webgl-allow-shared-typed-array.html (0 => 289700)


--- trunk/LayoutTests/webgl/webgl-allow-shared-typed-array.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/webgl-allow-shared-typed-array.html	2022-02-12 22:44:19 UTC (rev 289700)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>AllowShared TypedArray in WebGL</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<canvas width="100" height="100"></canvas>
+<script>
+test(() => {
+    const canvas = document.querySelectorAll('canvas')[0];
+    const gl = canvas.getContext("webgl2");
+    const buffer = gl.createBuffer();
+    const bufferData = new Float32Array(new SharedArrayBuffer(1024 * 1024))
+    for (var i = 0; i < 1e4; ++i)
+        gl.uniformMatrix4fv(null, true, bufferData);
+}, `WebGL2 AllowShared uniformMatrix4fv`);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (289699 => 289700)


--- trunk/Source/WebCore/ChangeLog	2022-02-12 21:33:33 UTC (rev 289699)
+++ trunk/Source/WebCore/ChangeLog	2022-02-12 22:44:19 UTC (rev 289700)
@@ -1,3 +1,18 @@
+2022-02-12  Yusuke Suzuki  <[email protected]>
+
+        WebGL2 AllowShared TypedArray should be accepted
+        https://bugs.webkit.org/show_bug.cgi?id=232662
+
+        Reviewed by Dean Jackson.
+
+        Test: webgl/webgl-allow-shared-typed-array.html
+
+        TypedArray with [AllowShared] annotation is not handled properly, which results in handling it as Sequence<T>,
+        invoking iteration protocol to copy them. This patch adds that as the same to [AllowShared] ArrayBuffer / ArrayBufferView.
+
+        * bindings/IDLTypes.h:
+        * bindings/js/JSDOMConvertUnion.h:
+
 2022-02-12  Patrick Angle  <[email protected]>
 
         Web Inspector: [Flexbox] Show item bounds, gaps, and free space in flex overlays

Modified: trunk/Source/WebCore/bindings/IDLTypes.h (289699 => 289700)


--- trunk/Source/WebCore/bindings/IDLTypes.h	2022-02-12 21:33:33 UTC (rev 289699)
+++ trunk/Source/WebCore/bindings/IDLTypes.h	2022-02-12 22:44:19 UTC (rev 289700)
@@ -329,6 +329,9 @@
 struct IsIDLTypedArray : public std::integral_constant<bool, WTF::IsBaseOfTemplate<IDLTypedArray, T>::value> { };
 
 template<typename T>
+struct IsIDLTypedArrayAllowShared : public std::integral_constant<bool, WTF::IsBaseOfTemplate<IDLTypedArray, T>::value && WTF::IsBaseOfTemplate<IDLAllowSharedAdaptor, T>::value> { };
+
+template<typename T>
 struct IsIDLArrayBuffer : public std::integral_constant<bool, std::is_base_of<IDLArrayBuffer, T>::value> { };
 
 template<typename T>

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h (289699 => 289700)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h	2022-02-12 21:33:33 UTC (rev 289699)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h	2022-02-12 22:44:19 UTC (rev 289700)
@@ -273,7 +273,7 @@
                 using ImplementationType = typename Type::ImplementationType;
                 using WrapperType = typename Converter<Type>::WrapperType;
 
-                auto castedValue = WrapperType::toWrapped(vm, value);
+                auto castedValue = (brigand::any<TypeList, IsIDLTypedArrayAllowShared<brigand::_1>>::value) ? WrapperType::toWrappedAllowShared(vm, value) : WrapperType::toWrapped(vm, value);
                 if (!castedValue)
                     return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to