[WebGL] ANGLE Extension directive location incorrectly enforced for webgl 1.0
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 05:10:11 +0000 (05:10 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 05:10:11 +0000 (05:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198811

Reviewed by Dean Jackson.

Source/ThirdParty/ANGLE:

Apply ANGLE change from https://chromium-review.googlesource.com/c/angle/angle/+/1648661 to
prevent enforcing ESSL late extension rule on WebGL 1.0 shaders.

* src/compiler/preprocessor/DiagnosticsBase.cpp:
(angle::pp::Diagnostics::message):
* src/compiler/preprocessor/DiagnosticsBase.h:
* src/compiler/preprocessor/DirectiveParser.cpp:
(angle::pp::DirectiveParser::parseExtension):

LayoutTests:

ANGLE was updated so that this case should not be an error.

* webgl/webgl-extension-directive-location-no-error-expected.txt: Added.
* webgl/webgl-extension-directive-location-no-error.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/webgl/webgl-extension-directive-location-no-error-expected.txt [new file with mode: 0644]
LayoutTests/webgl/webgl-extension-directive-location-no-error.html [new file with mode: 0644]
Source/ThirdParty/ANGLE/ChangeLog
Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h
Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp

index 00c8196..1e5c720 100644 (file)
@@ -1,3 +1,15 @@
+2019-06-12  Justin Fan  <justin_fan@apple.com>
+
+        [WebGL] ANGLE Extension directive location incorrectly enforced for webgl 1.0
+        https://bugs.webkit.org/show_bug.cgi?id=198811
+
+        Reviewed by Dean Jackson.
+
+        ANGLE was updated so that this case should not be an error.
+
+        * webgl/webgl-extension-directive-location-no-error-expected.txt: Added.
+        * webgl/webgl-extension-directive-location-no-error.html: Added.
+
 2019-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [cairo][SVG] If clipPath has multiple elements, clip-path doesn't work with transform
diff --git a/LayoutTests/webgl/webgl-extension-directive-location-no-error-expected.txt b/LayoutTests/webgl/webgl-extension-directive-location-no-error-expected.txt
new file mode 100644 (file)
index 0000000..641e237
--- /dev/null
@@ -0,0 +1,3 @@
+Ensure that if a shader extension directive is specified after non-preprocessor symbols, no errors are logged.
+
+
diff --git a/LayoutTests/webgl/webgl-extension-directive-location-no-error.html b/LayoutTests/webgl/webgl-extension-directive-location-no-error.html
new file mode 100644 (file)
index 0000000..03259b7
--- /dev/null
@@ -0,0 +1,29 @@
+<body>
+<p>Ensure that if a shader extension directive is specified after non-preprocessor symbols, no errors are logged.</p>
+<canvas></canvas>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+const fragmentShaderSource = `
+    precision highp float;
+    #extension GL_OES_standard_derivatives : enable
+
+    void main() {
+        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+    }
+    `;
+
+const canvas = document.querySelector('canvas');
+const gl = canvas.getContext("webgl");
+
+gl.getExtension('OES_standard_derivatives');
+
+const shader = gl.createShader(gl.FRAGMENT_SHADER);
+gl.shaderSource(shader, fragmentShaderSource);
+gl.compileShader(shader);
+const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+if (!success)
+    console.log(gl.getShaderInfoLog(shader));
+</script>
+</body>
\ No newline at end of file
index dd1e479..5b50ceb 100644 (file)
@@ -1,3 +1,19 @@
+2019-06-12  Justin Fan  <justin_fan@apple.com>
+
+        [WebGL] ANGLE Extension directive location incorrectly enforced for webgl 1.0
+        https://bugs.webkit.org/show_bug.cgi?id=198811
+
+        Reviewed by Dean Jackson.
+
+        Apply ANGLE change from https://chromium-review.googlesource.com/c/angle/angle/+/1648661 to
+        prevent enforcing ESSL late extension rule on WebGL 1.0 shaders.
+
+        * src/compiler/preprocessor/DiagnosticsBase.cpp:
+        (angle::pp::Diagnostics::message):
+        * src/compiler/preprocessor/DiagnosticsBase.h:
+        * src/compiler/preprocessor/DirectiveParser.cpp:
+        (angle::pp::DirectiveParser::parseExtension):
+
 2019-05-23  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] Use target oriented design for bmalloc
index 575b151..c4832c6 100644 (file)
@@ -115,6 +115,8 @@ const char *Diagnostics::message(ID id)
             return "invalid file number";
         case PP_INVALID_LINE_DIRECTIVE:
             return "invalid line directive";
+        case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1:
+            return "extension directive must occur before any non-preprocessor tokens in ESSL1";
         case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
             return "extension directive must occur before any non-preprocessor tokens in ESSL3";
         case PP_UNDEFINED_SHIFT:
@@ -129,7 +131,7 @@ const char *Diagnostics::message(ID id)
             return "unexpected token after conditional expression";
         case PP_UNRECOGNIZED_PRAGMA:
             return "unrecognized pragma";
-        case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1:
+        case PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL:
             return "extension directive should occur before any non-preprocessor tokens";
         case PP_WARNING_MACRO_NAME_RESERVED:
             return "macro name with a double underscore is reserved - unintented behavior is "
index bb90bf0..6be5c72 100644 (file)
@@ -73,6 +73,7 @@ class Diagnostics
         PP_WARNING_BEGIN,
         PP_EOF_IN_DIRECTIVE,
         PP_UNRECOGNIZED_PRAGMA,
+        PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL,
         PP_WARNING_MACRO_NAME_RESERVED,
         PP_WARNING_END
     };
index e99d843..b7f8d91 100644 (file)
@@ -676,8 +676,16 @@ void DirectiveParser::parseExtension(Token *token)
         }
         else
         {
-            mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
-                                 token->location, token->text);
+            if (mSettings.shaderSpec == SH_WEBGL_SPEC)
+            {
+                mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL,
+                                     token->location, token->text);
+            }
+            else
+            {
+                mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
+                                     token->location, token->text);
+            }
         }
     }
     if (valid)