Title: [279968] trunk
Revision
279968
Author
[email protected]
Date
2021-07-15 15:56:57 -0700 (Thu, 15 Jul 2021)

Log Message

WebGL2 demo doesn't work due to failing compilation to metal backend
https://bugs.webkit.org/show_bug.cgi?id=226865
Source/ThirdParty/ANGLE:

Fix translation of struct-arrays to contain the array type as well.
Reviewed by Dean Jackson.

* src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp:

LayoutTests:

Fix translation of struct-arrays to contain the array type as well.
Reviewed by Dean Jackson.

* fast/canvas/webgl/shader-with-struct-array.html: Added.
* fast/canvas/webgl/shader-with-struct-array-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (279967 => 279968)


--- trunk/LayoutTests/ChangeLog	2021-07-15 22:52:51 UTC (rev 279967)
+++ trunk/LayoutTests/ChangeLog	2021-07-15 22:56:57 UTC (rev 279968)
@@ -1,3 +1,14 @@
+2021-07-15  Kyle Piddington  <[email protected]>
+
+        WebGL2 demo doesn't work due to failing compilation to metal backend
+        https://bugs.webkit.org/show_bug.cgi?id=226865
+
+        Fix translation of struct-arrays to contain the array type as well.
+        Reviewed by Dean Jackson.
+
+        * fast/canvas/webgl/shader-with-struct-array.html: Added.
+        * fast/canvas/webgl/shader-with-struct-array-expected.txt: Added.
+
 2021-07-15  Ayumi Kojima  <[email protected]>
 
         [Big Sur wk1 Debug] imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-duration-loop.html is a flaky failure.

Added: trunk/LayoutTests/fast/canvas/webgl/shader-with-struct-array-expected.txt (0 => 279968)


--- trunk/LayoutTests/fast/canvas/webgl/shader-with-struct-array-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/shader-with-struct-array-expected.txt	2021-07-15 22:56:57 UTC (rev 279968)
@@ -0,0 +1,10 @@
+Tests that program compiling/linking with a struct-array construct.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getError was expected value: NO_ERROR : no error for struct array in program
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/canvas/webgl/shader-with-struct-array.html (0 => 279968)


--- trunk/LayoutTests/fast/canvas/webgl/shader-with-struct-array.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/shader-with-struct-array.html	2021-07-15 22:56:57 UTC (rev 279968)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="" type="text/_javascript_"></script>
+    <script src="" type="text/_javascript_"></script>
+    <script src="" </script>
+    
+</head>
+<body>
+    <canvas id="webgl-canvas" width="100px" height="100px"></canvas>
+    <script>
+    var wtu = WebGLTestUtils;
+    
+    function runShaderTest(gl, vShaderSource, fshaderSource, errorShouldBeText)
+    {
+        var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
+        var program = gl.createProgram();
+        var vertexShader = gl.createShader(gl.VERTEX_SHADER);
+        gl.shaderSource(vertexShader, vShaderSource);
+        gl.compileShader(vertexShader);
+        gl.shaderSource(fragmentShader, fshaderSource);
+        gl.compileShader(fragmentShader);
+        gl.attachShader(program, vertexShader);
+        gl.attachShader(program, fragmentShader);
+        gl.linkProgram(program);
+        gl.useProgram(program);
+        gl.drawArrays(gl.TRIANGLES, 0, 3);
+        
+        wtu.glErrorShouldBe(gl,0,errorShouldBeText);
+        gl.deleteProgram(program)
+        gl.deleteShader(vertexShader);
+        gl.deleteShader(fragmentShader);
+    }
+    function runTest()
+    {
+        description("Tests that program compiling/linking with a struct-array construct.");
+        var canvas = document.getElementById('webgl-canvas');
+        var gl = canvas.getContext("webgl2");
+  
+        {
+            var vShaderSource = '#version 300 es\n in vec2 pos;\nvoid main() { gl_Position = vec4(pos, 0, 1); }'
+            var fshaderSource = '#version 300 es\n precision mediump float;\n out vec4 color;\n struct s { float a; } global[2];\n void main() { float a = global[1].a; color = vec4(a,0.8,0,1); }\n'
+            runShaderTest(gl, vShaderSource, fshaderSource, "no error for struct array in program")
+        }
+        
+       
+        
+        
+
+    }
+    runTest();
+
+    </script>
+</body>
+</html>

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (279967 => 279968)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-07-15 22:52:51 UTC (rev 279967)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-07-15 22:56:57 UTC (rev 279968)
@@ -1,3 +1,13 @@
+2021-07-15  Kyle Piddington  <[email protected]>
+
+        WebGL2 demo doesn't work due to failing compilation to metal backend
+        https://bugs.webkit.org/show_bug.cgi?id=226865
+	
+        Fix translation of struct-arrays to contain the array type as well.
+        Reviewed by Dean Jackson.
+
+        * src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp:
+
 2021-07-13  Kyle Piddington  <[email protected]>
 
         rAF driven WebGL submits excessive amount of GPU work when frames are slow

Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp (279967 => 279968)


--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp	2021-07-15 22:52:51 UTC (rev 279967)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp	2021-07-15 22:56:57 UTC (rev 279968)
@@ -53,7 +53,12 @@
                                                 new TType(structure, true), SymbolType::Empty);
                 instanceType = new TType(structure, false);
             }
+            if (type.isArray())
+            {
+                instanceType->makeArrays(type.getArraySizes());
+            }
             instanceType->setQualifier(type.getQualifier());
+            
             auto *instanceVar = new TVariable(mSymbolTable, var.name(), instanceType,
                                               symbolType, var.extension());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to