Title: [290923] branches/safari-613-branch
Revision
290923
Author
[email protected]
Date
2022-03-07 14:09:26 -0800 (Mon, 07 Mar 2022)

Log Message

Cherry-pick r289700. rdar://problem/85249360

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289700 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (290922 => 290923)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-07 22:09:22 UTC (rev 290922)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-07 22:09:26 UTC (rev 290923)
@@ -1,5 +1,42 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r289700. rdar://problem/85249360
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r289533. rdar://problem/88452971
 
     Settling of a fetch promise should be delayed in case page is entering page cache

Added: branches/safari-613-branch/LayoutTests/webgl/webgl-allow-shared-typed-array-expected.txt (0 => 290923)


--- branches/safari-613-branch/LayoutTests/webgl/webgl-allow-shared-typed-array-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webgl/webgl-allow-shared-typed-array-expected.txt	2022-03-07 22:09:26 UTC (rev 290923)
@@ -0,0 +1,3 @@
+
+PASS WebGL2 AllowShared uniformMatrix4fv
+

Added: branches/safari-613-branch/LayoutTests/webgl/webgl-allow-shared-typed-array.html (0 => 290923)


--- branches/safari-613-branch/LayoutTests/webgl/webgl-allow-shared-typed-array.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webgl/webgl-allow-shared-typed-array.html	2022-03-07 22:09:26 UTC (rev 290923)
@@ -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: branches/safari-613-branch/Source/WebCore/ChangeLog (290922 => 290923)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-07 22:09:22 UTC (rev 290922)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-07 22:09:26 UTC (rev 290923)
@@ -1,5 +1,47 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r289700. rdar://problem/85249360
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r289597. rdar://problem/88324745
 
     Check bidiLevels are valid before reordering

Modified: branches/safari-613-branch/Source/WebCore/bindings/IDLTypes.h (290922 => 290923)


--- branches/safari-613-branch/Source/WebCore/bindings/IDLTypes.h	2022-03-07 22:09:22 UTC (rev 290922)
+++ branches/safari-613-branch/Source/WebCore/bindings/IDLTypes.h	2022-03-07 22:09:26 UTC (rev 290923)
@@ -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: branches/safari-613-branch/Source/WebCore/bindings/js/JSDOMConvertUnion.h (290922 => 290923)


--- branches/safari-613-branch/Source/WebCore/bindings/js/JSDOMConvertUnion.h	2022-03-07 22:09:22 UTC (rev 290922)
+++ branches/safari-613-branch/Source/WebCore/bindings/js/JSDOMConvertUnion.h	2022-03-07 22:09:26 UTC (rev 290923)
@@ -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