summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc')
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/00_test_list.txt126
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/attrib-location-length-limits.html89
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/boolean_precision.html72
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/const-variable-initialization.html244
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/embedded-struct-definitions-forbidden.html41
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty-declaration.html111
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty_main.vert.html33
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/expression-list-in-declarator-initializer.html68
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/fragcolor-fragdata-invariant.html40
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/gl_position_unset.vert.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/global-variable-init.html323
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-2types-of-textures-on-same-unit.html132
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-function-nodes.html134
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-long-variable-names.html227
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-vertex-branch.html128
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/include.vs4
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/large-loop-compile.html172
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/local-variable-shadowing-outer-function.html59
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii-comments.vert.html54
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii.vert.html54
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/re-compile-re-link.html150
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sampler-operand.html51
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sequence-operator-returns-constant.html60
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-precision-format-obeyed.html83
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-struct-scope.html231
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-uniform-packing-restrictions.html251
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-varying-packing-restrictions.html188
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-define.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-identifier.frag.html105
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-define.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-identifier.frag.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-_webgl-identifier.vert.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.frag.html41
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.vert.html40
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html133
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-uniform.html145
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-array.vert.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-struct.vert.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-clipvertex.vert.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-assignment.html41
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-conditional-assignment.html192
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-separated-variable-declarations.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping-negative.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping.html45
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.frag.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.vert.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx-no-ext.frag.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx.frag.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-do-loop.html40
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-error-directive.html51
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-explicit-int-cast.vert.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-float-return-value.frag.html46
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-loop.html83
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-scoping.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-frag-depth.frag.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-recursion.frag.html45
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-scoped-struct.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-functional-scoping.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glcolor.vert.html35
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-1.frag.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-symbol.frag.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-global-variable-precision-mismatch.html128
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glprojectionmatrix.vert.html35
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-hex-int-constant-macro.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.frag.html238
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.vert.html224
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-implicit-vec3-to-vec4-cast.vert.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-include.vert.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-int-return-value.frag.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-invalid-identifier.frag.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec2-return-value.frag.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec3-return-value.frag.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec4-return-value.frag.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-limited-indexing.frag.html54
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-long-line.html67
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-ascii-error.frag.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-1-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-2-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-3-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-4-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-5-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-6-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-7-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-8-of-8.html31
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-precision.frag.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-preprocessor-whitespace.html62
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-quoted-error.frag.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-reserved-words.html263
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-short-circuiting-operators.html156
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-similar-uniform-array-names.html109
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-too-many-uniforms.html123
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-two-initializer-types.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-undefined-preprocessor-symbol.frag.html39
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-uniform-in-loop-condition.vert.html42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec2-return-value.frag.html44
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec3-return-value.frag.html44
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-return-value.frag.html44
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-vec3-vec4-conditional.html36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.frag.html41
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.vert.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-120.vert.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-130.vert.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-webgl-identifier.vert.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-while-loop.html38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-without-precision.frag.html37
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html115
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-invariance.html332
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-uniforms.html87
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-varyings.html80
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-missing-varyings.html74
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-name-conflicts.html88
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-uniform-structs.html289
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-varyings.html103
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shared.html151
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-inout-parameter.html117
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-out-parameter.html115
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-assign.html214
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-equals.html217
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-mixed-array-declarators.html71
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-exceeds-maximum.html55
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-of-variable-names.html74
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-under-maximum.html51
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-specifiers-in-uniforms.html65
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-unary-operators.html70
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operator-on-arrays.html64
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-global-initializers.html67
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-initializers.html124
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uniform-location-length-limits.html86
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uninitialized-local-global-variables.html274
129 files changed, 10635 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/00_test_list.txt
new file mode 100644
index 0000000000..c60310df14
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/00_test_list.txt
@@ -0,0 +1,126 @@
+--max-version 1.9.9 attrib-location-length-limits.html
+--min-version 1.0.3 boolean_precision.html
+--min-version 1.0.4 const-variable-initialization.html
+embedded-struct-definitions-forbidden.html
+--min-version 1.0.4 empty-declaration.html
+empty_main.vert.html
+--min-version 1.0.3 expression-list-in-declarator-initializer.html
+--min-version 1.0.4 fragcolor-fragdata-invariant.html
+gl_position_unset.vert.html
+--min-version 1.0.4 global-variable-init.html
+# this test is intentionally disabled as it is too strict and to hard to simulate
+# glsl-2types-of-textures-on-same-unit.html
+glsl-function-nodes.html
+--min-version 1.0.2 glsl-vertex-branch.html
+glsl-long-variable-names.html
+--min-version 1.0.4 local-variable-shadowing-outer-function.html
+non-ascii-comments.vert.html
+non-ascii.vert.html
+--min-version 1.0.2 re-compile-re-link.html
+--min-version 1.0.4 sequence-operator-returns-constant.html
+--min-version 1.0.3 shader-precision-format-obeyed.html
+--min-version 1.0.3 shader-struct-scope.html
+--min-version 1.0.2 shader-uniform-packing-restrictions.html
+--min-version 1.0.2 shader-varying-packing-restrictions.html
+--min-version 1.0.2 shader-with-256-character-define.html
+shader-with-256-character-identifier.frag.html
+--min-version 1.0.2 --max-version 1.9.9 shader-with-257-character-define.html
+--max-version 1.9.9 shader-with-257-character-identifier.frag.html
+shader-with-_webgl-identifier.vert.html
+shader-with-arbitrary-indexing.frag.html
+shader-with-arbitrary-indexing.vert.html
+--min-version 1.0.2 shader-with-array-of-structs-containing-arrays.html
+--min-version 1.0.2 shader-with-array-of-structs-uniform.html
+shader-with-attrib-array.vert.html
+shader-with-attrib-struct.vert.html
+shader-with-clipvertex.vert.html
+--min-version 1.0.2 shader-with-conditional-scoping.html
+--min-version 1.0.2 shader-with-conditional-scoping-negative.html
+shader-with-default-precision.frag.html
+shader-with-default-precision.vert.html
+shader-with-dfdx-no-ext.frag.html
+shader-with-dfdx.frag.html
+--min-version 1.0.2 shader-with-do-loop.html
+shader-with-error-directive.html
+shader-with-explicit-int-cast.vert.html
+shader-with-float-return-value.frag.html
+--min-version 1.0.2 shader-with-for-scoping.html
+--min-version 1.0.2 shader-with-for-loop.html
+shader-with-frag-depth.frag.html
+shader-with-function-recursion.frag.html
+--min-version 1.0.2 shader-with-function-scoped-struct.html
+--min-version 1.0.2 shader-with-functional-scoping.html
+--min-version 1.0.2 shader-with-comma-assignment.html
+--min-version 1.0.2 shader-with-comma-conditional-assignment.html
+--min-version 1.0.4 shader-with-comma-separated-variable-declarations.html
+shader-with-glcolor.vert.html
+shader-with-gles-1.frag.html
+shader-with-gles-symbol.frag.html
+shader-with-glprojectionmatrix.vert.html
+shader-with-implicit-vec3-to-vec4-cast.vert.html
+shader-with-include.vert.html
+shader-with-int-return-value.frag.html
+shader-with-invalid-identifier.frag.html
+shader-with-ivec2-return-value.frag.html
+shader-with-ivec3-return-value.frag.html
+shader-with-ivec4-return-value.frag.html
+shader-with-limited-indexing.frag.html
+--min-version 1.0.2 shader-with-hex-int-constant-macro.html
+shader-with-long-line.html
+shader-with-non-ascii-error.frag.html
+--min-version 1.0.2 shader-with-non-reserved-words-1-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-2-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-3-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-4-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-5-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-6-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-7-of-8.html
+--min-version 1.0.2 shader-with-non-reserved-words-8-of-8.html
+shader-with-precision.frag.html
+--min-version 1.0.3 shader-with-preprocessor-whitespace.html
+shader-with-quoted-error.frag.html
+--min-version 1.0.2 shader-with-reserved-words.html
+--min-version 1.0.2 shader-with-similar-uniform-array-names.html
+--min-version 1.0.2 shader-with-too-many-uniforms.html
+--min-version 1.0.4 shader-with-two-initializer-types.html
+shader-with-undefined-preprocessor-symbol.frag.html
+shader-with-uniform-in-loop-condition.vert.html
+shader-with-vec2-return-value.frag.html
+shader-with-vec3-return-value.frag.html
+shader-with-vec4-return-value.frag.html
+--min-version 1.0.2 shader-with-vec4-vec3-vec4-conditional.html
+shader-with-version-100.frag.html
+shader-with-version-100.vert.html
+shader-with-version-120.vert.html
+shader-with-version-130.vert.html
+shader-with-webgl-identifier.vert.html
+--min-version 1.0.2 shader-with-while-loop.html
+shader-without-precision.frag.html
+--min-version 1.0.3 shaders-with-constant-expression-loop-conditions.html
+--min-version 1.0.3 shaders-with-invariance.html
+--min-version 1.0.3 shaders-with-name-conflicts.html
+--min-version 1.0.2 shaders-with-mis-matching-uniforms.html
+--min-version 1.0.2 shaders-with-mis-matching-varyings.html
+--min-version 1.0.2 shaders-with-missing-varyings.html
+--min-version 1.0.3 shaders-with-uniform-structs.html
+--min-version 1.0.2 shaders-with-varyings.html
+shared.html
+--min-version 1.0.4 struct-as-inout-parameter.html
+--min-version 1.0.4 struct-as-out-parameter.html
+struct-nesting-exceeds-maximum.html
+struct-nesting-under-maximum.html
+--max-version 1.9.9 uniform-location-length-limits.html
+--min-version 1.0.2 shader-with-short-circuiting-operators.html
+--min-version 1.0.2 shader-with-global-variable-precision-mismatch.html
+--min-version 1.0.2 large-loop-compile.html
+--min-version 1.0.3 struct-equals.html
+--min-version 1.0.4 struct-assign.html
+--min-version 1.0.3 struct-mixed-array-declarators.html
+--min-version 1.0.3 struct-nesting-of-variable-names.html
+--min-version 1.0.3 struct-specifiers-in-uniforms.html
+--min-version 1.0.3 struct-unary-operators.html
+--min-version 1.0.4 ternary-operator-on-arrays.html
+--min-version 1.0.3 ternary-operators-in-global-initializers.html
+--min-version 1.0.3 ternary-operators-in-initializers.html
+--min-version 1.0.4 uninitialized-local-global-variables.html
+--min-version 1.0.4 sampler-operand.html
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/attrib-location-length-limits.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/attrib-location-length-limits.html
new file mode 100644
index 0000000000..1f18a2309b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/attrib-location-length-limits.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<title>WebGL attrib location length tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+There is supposed to be an example drawing here, but it's not important.
+</canvas>
+<div id="description">Verify limits on the lengths of attribute locations per WebGL spec, "Maximum Uniform and Attribute Location Lengths".</div>
+<div id="console"></div>
+<script id="goodVertexShader" type="x-shader/x-vertex">
+// A vertex shader where the needed attrib location is exactly 256 characters.
+attribute vec4 vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
+
+void main()
+{
+ gl_Position = vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
+}
+</script>
+<script id="badVertexShader" type="x-shader/x-vertex">
+// A vertex shader where the needed attrib location is 257 characters.
+attribute vec4 vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567;
+
+void main()
+{
+ gl_Position = vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567;
+}
+</script>
+<script id="fragmentShader" type="x-shader/x-fragment">
+precision mediump float;
+
+void main() {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+description("test attrib location length limit");
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+
+debug("Test attrib location underneath the length limit");
+var program = wtu.loadProgramFromScript(gl, "goodVertexShader", "fragmentShader");
+shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
+var attrib256Name = "vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456";
+gl.bindAttribLocation(program, 0, attrib256Name);
+wtu.glErrorShouldBe(gl, gl.NONE);
+var attribLoc = gl.getAttribLocation(program, attrib256Name);
+if (attribLoc == -1) {
+ testFailed("attrib location was -1, should not be");
+} else {
+ testPassed("attrib location should not be -1");
+}
+wtu.glErrorShouldBe(gl, gl.NONE);
+
+debug("Test attrib location over the length limit");
+var attrib257Name = attrib256Name + "7";
+
+debug("Shader compilation or link should fail");
+shouldBe('wtu.loadProgramFromScriptExpectError(gl, "badVertexShader", "fragmentShader")', 'null');
+wtu.glErrorShouldBe(gl, gl.NONE);
+
+debug("Attempt to bind too-long attrib location should produce error");
+program = gl.createProgram();
+gl.bindAttribLocation(program, 0, attrib257Name);
+wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
+
+debug("Attempt to fetch too-long attrib location should produce error");
+program = wtu.loadStandardProgram(gl);
+shouldBe('gl.getAttribLocation(program, attrib257Name)', '-1');
+wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/boolean_precision.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/boolean_precision.html
new file mode 100644
index 0000000000..da0c55a164
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/boolean_precision.html
@@ -0,0 +1,72 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexTest" type="text/something-not-javascript">
+// parsing boolean variables with precision should fail
+void main() {
+ mediump $(type) fail = $(initializer);
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script id="fragmentTest" type="text/something-not-javascript">
+// parsing boolean variables with precision should fail
+void main() {
+ mediump $(type) fail = $(initializer);
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+
+var types = ['bool', 'bvec2', 'bvec3', 'bvec4'];
+var tests = [];
+var vTestSource = wtu.getScript("vertexTest");
+var fTestSource = wtu.getScript("fragmentTest");
+
+for (var i = 0; i < types.length; ++i) {
+ var initializer = 'true';
+ if (types[i] !== 'bool') {
+ initializer = types[i] + "(true";
+ for (var j = 0; j < i; ++j) {
+ initializer += ", true";
+ }
+ initializer += ")";
+ }
+ var subs = {type: types[i], initializer: initializer};
+ tests.push({
+ vShaderSource: wtu.replaceParams(vTestSource, subs),
+ vShaderSuccess: false,
+ passMsg: "vertex shader with a " + types[i] + " variable with precision should fail."
+ });
+ tests.push({
+ fShaderSource: wtu.replaceParams(fTestSource, subs),
+ fShaderSuccess: false,
+ passMsg: "fragment shader with a " + types[i] + " variable with precision should fail."
+ });
+}
+GLSLConformanceTester.runTests(tests);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/const-variable-initialization.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/const-variable-initialization.html
new file mode 100644
index 0000000000..f9d8be7f70
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/const-variable-initialization.html
@@ -0,0 +1,244 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>All valid constant expressions should be allowed in the initialization of const variables</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<script id="VertexTemplate" type="x-shader/x-vertex">
+precision mediump float;
+
+$(init)
+
+void main() {
+ const $(constType) c = $(constantExpression);
+ gl_Position = vec4(float(c$(constTypeToScalar)));
+}
+</script>
+<script id="FragmentTemplate" type="x-shader/x-fragment">
+precision mediump float;
+
+$(init)
+
+void main() {
+ const $(constType) c = $(constantExpression);
+ gl_FragColor = vec4(float(c$(constTypeToScalar)));
+}
+</script>
+</head>
+<body onload="runTest()">
+<div id="description"></div>
+<div id="console"></div>
+<script type="application/javascript">
+"use strict";
+description();
+
+var wtu = WebGLTestUtils;
+
+// ESSL 1.00 spec section 4.3.2.
+// Initializers for const declarations must be a constant expression.
+
+// ESSL 1.00 spec section 5.10.
+// A constant expression is one of
+// * a literal value (e.g., 5 or true)
+// * a global or local variable qualified as const excluding function parameters
+// * an expression formed by an operator on operands that are constant expressions, including getting
+// an element of a constant vector or a constant matrix, or a field of a constant structure
+// * a constructor whose arguments are all constant expressions
+// * a built-in function call whose arguments are all constant expressions, with the exception of the
+// texture lookup functions.
+
+var binaryOpsGenTypeRValuesToGenType = [
+ '+',
+ '-',
+ '*',
+ '/'
+];
+
+var binaryOpsScalarsToBool = [
+ '<',
+ '>',
+ '<=',
+ '>='
+];
+
+var binaryOpsRValuesToBool = [
+ '==',
+ '!='
+];
+
+var binaryOpsBoolsToBool = [
+ '&&',
+ '^^',
+ '||'
+];
+
+var builtInsGenTypeToGenType = [
+ 'radians',
+ 'degrees',
+ 'sin',
+ 'cos',
+ 'tan',
+ 'asin',
+ 'acos',
+ 'atan',
+ 'exp',
+ 'log',
+ 'exp2',
+ 'log2',
+ 'sqrt',
+ 'inversesqrt',
+ 'abs',
+ 'sign',
+ 'floor',
+ 'ceil',
+ 'fract'
+];
+
+var builtIns2VecToBvec = [
+ 'lessThan',
+ 'lessThanEqual',
+ 'greaterThan',
+ 'greaterThanEqual',
+ 'equal',
+ 'notEqual'
+];
+
+var builtIns2GenTypeToGenType = [
+ 'atan',
+ 'pow',
+ 'mod',
+ 'min',
+ 'max',
+ 'step'
+];
+
+var runTest = function() {
+ var vsTemplate = document.getElementById('VertexTemplate').text;
+ var fsTemplate = document.getElementById('FragmentTemplate').text;
+
+ var tests = [];
+ var i;
+ var op;
+ var builtIn;
+
+ var pushTest = function(constType, constantExpression, expectSuccess, opt_init) {
+ if (opt_init === undefined) {
+ opt_init = '';
+ }
+ var constTypeToScalar = '';
+ if (constType.substring(0, 3) == 'vec' || constType.substring(1, 4) == 'vec') {
+ constTypeToScalar = '.x';
+ } else if (constType.substring(0, 3) == 'mat') {
+ constTypeToScalar = '[0].x';
+ } else if (constType == 'my_struct') {
+ constTypeToScalar = '.field';
+ }
+ var vs = wtu.replaceParams(vsTemplate, {constType: constType, constantExpression: constantExpression, constTypeToScalar: constTypeToScalar, init: opt_init});
+ var fs = wtu.replaceParams(fsTemplate, {constType: constType, constantExpression: constantExpression, constTypeToScalar: constTypeToScalar, init: opt_init});
+ tests.push({
+ vShaderSource: vs,
+ vShaderSuccess: expectSuccess,
+ linkSuccess: expectSuccess,
+ passMsg: "Assigning " + constantExpression + " to a const in a vertex shader should " + (expectSuccess ? "compile." : "fail compilation.")
+ });
+ tests.push({
+ fShaderSource: fs,
+ fShaderSuccess: expectSuccess,
+ linkSuccess: expectSuccess,
+ passMsg: "Assigning " + constantExpression + " to a const in a fragment shader should " + (expectSuccess ? "compile." : "fail compilation.")
+ });
+ }
+
+ // Handle some one of a kind cases first
+ pushTest('float', 'vec4(0.5).x', true);
+ pushTest('float', 'vec4(0.5)[0]', true);
+ pushTest('float', 'true ? 0.5 : 0.2', true);
+ pushTest('my_struct', 'my_struct(0.5, 0.2)', true, 'struct my_struct { float field; float field2; };');
+ pushTest('float', '(0.2, 0.5)', true);
+
+ pushTest('float', 'clamp(0.2, 0.3, 0.4)', true);
+ pushTest('float', 'mix(0.2, 0.3, 0.4)', true);
+ pushTest('float', 'smoothstep(0.2, 0.3, 0.4)', true);
+ pushTest('float', 'length(vec4(0.5))', true);
+ pushTest('float', 'distance(vec4(0.5), vec4(0.2))', true);
+ pushTest('float', 'dot(vec4(0.5), vec4(0.2))', true);
+ pushTest('vec3', 'cross(vec3(0.5), vec3(0.2))', true);
+ pushTest('vec4', 'normalize(vec4(0.5))', true);
+ pushTest('vec4', 'faceforward(vec4(0.2), vec4(0.3), vec4(0.4))', true);
+ pushTest('vec4', 'reflect(vec4(0.2), vec4(0.5))', true);
+ pushTest('vec4', 'refract(vec4(0.2), vec4(0.3), 0.4)', true);
+ pushTest('mat4', 'matrixCompMult(mat4(0.2), mat4(0.5))', true);
+
+ // Handle built-in constructors
+ for (i = 2; i <= 4; ++i) {
+ var vecType = 'vec' + i;
+ pushTest(vecType, vecType + '(0.5)', true);
+ pushTest('i' + vecType, 'i' + vecType + '(1)', true);
+ pushTest('b' + vecType, 'b' + vecType + '(true)', true);
+ pushTest('mat' + i, 'mat' + i + '(0.5)', true);
+ }
+
+ // Handle ops
+ for (i = 0; i < binaryOpsGenTypeRValuesToGenType.length; ++i) {
+ var op = binaryOpsGenTypeRValuesToGenType[i];
+ pushTest('float', '0.2 ' + op + ' 0.5', true);
+ pushTest('vec4', 'vec4(0.2) ' + op + ' vec4(0.5)', true);
+ pushTest('mat4', 'mat4(0.2) ' + op + ' mat4(0.5)', true);
+ }
+
+ for (i = 0; i < binaryOpsScalarsToBool.length; ++i) {
+ var op = binaryOpsScalarsToBool[i];
+ pushTest('bool', '0.2 ' + op + ' 0.5', true);
+ }
+
+ for (i = 0; i < binaryOpsRValuesToBool.length; ++i) {
+ var op = binaryOpsRValuesToBool[i];
+ pushTest('bool', '0.2 ' + op + ' 0.5', true);
+ pushTest('bool', 'vec4(0.2) ' + op + ' vec4(0.5)', true);
+ }
+
+ for (i = 0; i < binaryOpsBoolsToBool.length; ++i) {
+ var op = binaryOpsBoolsToBool[i];
+ pushTest('bool', 'false ' + op + ' true', true);
+ }
+
+ // Handle allowed built-ins
+ for (i = 0; i < builtInsGenTypeToGenType.length; ++i) {
+ builtIn = builtInsGenTypeToGenType[i];
+ pushTest('float', builtIn + '(0.5)', true);
+ pushTest('vec4', builtIn + '(vec4(0.5))', true);
+ }
+
+ for (i = 0; i < builtIns2VecToBvec.length; ++i) {
+ builtIn = builtIns2VecToBvec[i];
+ pushTest('bvec4', builtIn + '(vec4(0.2), vec4(0.5))', true);
+ }
+
+ for (i = 0; i < builtIns2GenTypeToGenType.length; ++i) {
+ builtIn = builtIns2GenTypeToGenType[i];
+ pushTest('float', builtIn + '(0.2, 0.5)', true);
+ pushTest('vec4', builtIn + '(vec4(0.2), vec4(0.5))', true);
+ }
+
+ // Include some expressions with a constant variable reference
+ pushTest('float', 'cc', true, 'const float cc = 0.5;');
+ pushTest('float', 'cc + cc2', true, 'const float cc = 0.5; const float cc2 = 0.2;');
+ pushTest('float', 'sqrt(cc)', true, 'const float cc = 0.5;');
+
+ GLSLConformanceTester.runTests(tests);
+}
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/embedded-struct-definitions-forbidden.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/embedded-struct-definitions-forbidden.html
new file mode 100644
index 0000000000..dc945fe2c6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/embedded-struct-definitions-forbidden.html
@@ -0,0 +1,41 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// embedded structure definitions are forbidden per GLSL ES section 4.1.8, "Structures", and should fail
+struct nesting1 {
+ struct nesting2 {
+ vec4 vector;
+ } field2;
+};
+
+uniform nesting1 uniform1;
+void main()
+{
+ gl_Position = uniform1.field2.vector;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty-declaration.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty-declaration.html
new file mode 100644
index 0000000000..785180f7e8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty-declaration.html
@@ -0,0 +1,111 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - empty declarations</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexEmptyDeclaration" type="text/something-not-javascript">
+// Vertex shader with an empty declaration should succeed.
+// See shading language grammar rules init_declarator_list and single_declaration
+// in ESSL specs.
+// Empty declarations are a side effect of how grammar for structs is defined.
+void main() {
+ float;
+ gl_Position = vec4(0.0);
+}
+</script>
+<script id="vertexEmptyDeclarationPlus" type="text/something-not-javascript">
+// Vertex shader with an empty declaration followed by declarator should succeed.
+// See shading language grammar rules init_declarator_list and single_declaration
+// in ESSL specs.
+void main() {
+ float, a = 0.0;
+ gl_Position = vec4(a);
+}
+</script>
+<script id="vertexEmptyStructDeclarationPlus" type="text/something-not-javascript">
+// Vertex shader with an empty declaration followed by declarator should succeed.
+// See shading language grammar rules init_declarator_list and single_declaration
+// in ESSL specs.
+
+struct S {
+ float member;
+}, a;
+
+void main() {
+ a.member = 0.0;
+ gl_Position = vec4(a.member);
+}
+</script>
+<script id="vertexEmptyDeclarationInStruct" type="text/something-not-javascript">
+// Vertex shader with an empty declaration inside struct should fail.
+// In-struct declarations have different grammar from declarations outside structs.
+struct S {
+ float;
+ float a;
+};
+
+void main() {
+ gl_Position = vec4(0.0);
+}
+</script>
+<script id="vertexEmptyDeclarationPlusInStruct" type="text/something-not-javascript">
+// Vertex shader with an empty declaration inside struct should fail.
+// In-struct declarations have different grammar from declarations outside structs.
+struct S {
+ float, a;
+ float b;
+};
+
+void main() {
+ gl_Position = vec4(0.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ { vShaderId: 'vertexEmptyDeclaration',
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'Vertex shader with an empty declaration should succeed'
+ },
+ { vShaderId: 'vertexEmptyDeclarationPlus',
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'Vertex shader with an empty declaration followed by declarator should succeed'
+ },
+ { vShaderId: 'vertexEmptyStructDeclarationPlus',
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'Vertex shader with an empty struct declaration followed by declarator should succeed'
+ },
+ { vShaderId: 'vertexEmptyDeclarationInStruct',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'Vertex shader with an empty declaration in a struct should fail'
+ },
+ { vShaderId: 'vertexEmptyDeclarationPlusInStruct',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'Vertex shader with an empty declaration followed by declarator in a struct should fail'
+ }
+]);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty_main.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty_main.vert.html
new file mode 100644
index 0000000000..b8c308d2d9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/empty_main.vert.html
@@ -0,0 +1,33 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader with an empty main() should succeed
+void main() { }
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/expression-list-in-declarator-initializer.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/expression-list-in-declarator-initializer.html
new file mode 100644
index 0000000000..3db79d94e5
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/expression-list-in-declarator-initializer.html
@@ -0,0 +1,68 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title></title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+void main() {
+ $(type) a, b;
+ $(type) c = (b = $(initializer), a = b);
+ gl_FragColor = $(asVec4);
+}
+</script>
+<script>
+"use strict";
+description("Verifies expression lists in declarator initializers work correctly.");
+var tests = [];
+var wtu = WebGLTestUtils;
+var typeInfos = [
+ { type: 'float', initializer: '1.0', asVec4: 'vec4(0.0,$(var),0.0,1.0)' },
+ { type: 'vec2', initializer: 'vec2(0.0, 1.0)', asVec4: 'vec4($(var),0.0,1.0)' },
+ { type: 'vec3', initializer: 'vec3(0.0, 1.0, 0.0)', asVec4: 'vec4($(var),1.0)' },
+ { type: 'vec4', initializer: 'vec4(0.0, 1.0, 0.0, 1.0)', asVec4: '$(var)' },
+ { type: 'int', initializer: '1', asVec4: 'vec4(0.0,$(var),0.0,1.0)' },
+ { type: 'ivec2', initializer: 'ivec2(0, 1)', asVec4: 'vec4($(var),0.0,1.0)' },
+ { type: 'ivec3', initializer: 'ivec3(0, 1, 0)', asVec4: 'vec4($(var),1.0)' },
+ { type: 'ivec4', initializer: 'ivec4(0, 1, 0, 1)', asVec4: 'vec4($(var))' },
+ { type: 'bool', initializer: 'true', asVec4: 'vec4(0.0,$(var),0.0,1.0)' },
+ { type: 'bvec2', initializer: 'bvec2(false, true)', asVec4: 'vec4($(var),0.0,1.0)' },
+ { type: 'bvec3', initializer: 'bvec3(false, true, false)', asVec4: 'vec4($(var),1.0)' },
+ { type: 'bvec4', initializer: 'bvec4(false,true,false,true)',asVec4: 'vec4($(var))' },
+];
+// Ensure that each variable is properly initialized to green, not just c.
+['a', 'b', 'c'].forEach(function(varName) {
+ typeInfos.forEach(function (typeInfo) {
+ var replaceParams = {
+ type: typeInfo.type,
+ initializer: typeInfo.initializer,
+ asVec4: wtu.replaceParams(typeInfo.asVec4, {var: varName}),
+ };
+ tests.push({
+ fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
+ passMsg: typeInfo.type + ' with contents of ' + varName + ' rendered',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render:true
+ });
+ });
+});
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/fragcolor-fragdata-invariant.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/fragcolor-fragdata-invariant.html
new file mode 100644
index 0000000000..d936872514
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/fragcolor-fragdata-invariant.html
@@ -0,0 +1,40 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - gl_FragColor and gl_FragData both declared as invariant</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Declaring both gl_FragColor and gl_FragData invariant should succeed.
+precision mediump float;
+
+// Static write of both gl_FragColor and gl_FragData is disallowed. However, simply declaring a variable invariant is not really accessing the variable, so it should be ok.
+invariant gl_FragColor;
+invariant gl_FragData;
+
+void main()
+{
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/gl_position_unset.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/gl_position_unset.vert.html
new file mode 100644
index 0000000000..6e462c123a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/gl_position_unset.vert.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader without gl_Position being written should succeed
+void main() {
+ vec4 a = vec4(0.0, 0.0, 0.0, 1.0);
+ float f = a.x;
+ a.y = f;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/global-variable-init.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/global-variable-init.html
new file mode 100644
index 0000000000..99e7417f69
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/global-variable-init.html
@@ -0,0 +1,323 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Global variable initializer restrictions</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="constGlobalShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+const float c = 1.0;
+float f = c;
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="globalShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+float c = 1.0;
+float f = c;
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="uniformShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+uniform float u;
+float f = u;
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="builtinFunctionShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+float c = 1.0;
+float f = sin(c);
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="builtinTextureFunctionShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+uniform sampler2D s;
+float f = texture2DLod(s, vec2(0.5, 0.5), 0.0).x;
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="attributeShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+float f = aPosition.x;
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="userDefinedFunctionShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+float foo() {
+ return 1.0;
+}
+float f = foo();
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="varyingShader" type="x-shader/x-fragment">
+precision mediump float;
+varying float v;
+float f = v;
+
+void main() {
+ gl_FragColor = vec4(f);
+}
+</script>
+<script id="globalLValueShader" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+float c = 1.0;
+float f = (c = 0.0);
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="globalLValueShader2" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 aPosition;
+varying float v;
+
+float c = 1.0;
+float f = (c++);
+
+void main() {
+ v = f;
+ gl_Position = aPosition;
+}
+</script>
+<script id="globalNonConstTernary" type="x-shader/x-fragment">
+precision mediump float;
+float green = 1.0;
+float black = 0.0;
+float f = true ? green : black;
+
+void main() {
+ gl_FragColor = vec4(0.0, f, 0.0, 1.0);
+}
+</script>
+<script id="globalUniformTernary" type="x-shader/x-fragment">
+precision mediump float;
+uniform float u_zero;
+float green = 1.0 + u_zero;
+float f = true ? green : u_zero;
+
+void main() {
+ gl_FragColor = vec4(0.0, f, 0.0, 1.0);
+}
+</script>
+<script id="globalUniformTernary2" type="x-shader/x-fragment">
+precision mediump float;
+uniform float u_zero;
+float green = 1.0;
+float f = (u_zero < 0.1) ? green : 0.0;
+
+void main() {
+ gl_FragColor = vec4(0.0, f, 0.0, 1.0);
+}
+</script>
+<script id="globalUniformStruct" type="x-shader/x-fragment">
+precision mediump float;
+struct S {
+ float zero;
+ int one;
+};
+uniform S us;
+S s = us;
+
+void main() {
+ float green = (s.one == 1) ? 1.0 : 0.0;
+ gl_FragColor = vec4(0.0, green, 0.0, 1.0);
+}
+</script>
+<script id="builtInConstant" type="x-shader/x-fragment">
+precision mediump float;
+int i = gl_MaxFragmentUniformVectors;
+
+void main() {
+ float green = (i > 0) ? 1.0 : 0.0;
+ gl_FragColor = vec4(0.0, green, 0.0, 1.0);
+}
+</script>
+<script id="builtInNonConstant" type="x-shader/x-fragment">
+precision mediump float;
+vec4 v = gl_FragCoord;
+
+void main() {
+ gl_FragColor = v;
+}
+</script>
+<script type="application/javascript">
+"use strict";
+description();
+GLSLConformanceTester.runTests([
+ {
+ vShaderId: "constGlobalShader",
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "A const global in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ vShaderId: "globalShader",
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Another global in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ vShaderId: "uniformShader",
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "A uniform in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ vShaderId: "builtinFunctionShader",
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "A built-in math function in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ vShaderId: "builtinTextureFunctionShader",
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "A texture lookup function in a global variable initializer should not be accepted by WebGL."
+ },
+ {
+ vShaderId: "attributeShader",
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "An attribute in a global variable initializer should not be accepted by WebGL."
+ },
+ {
+ vShaderId: "userDefinedFunctionShader",
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "A user-defined function call in a global variable initializer should not be accepted by WebGL."
+ },
+ {
+ vShaderId: "constGlobalShader",
+ vShaderSuccess: true,
+ fShaderId: "varyingShader",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "A varying in a global variable initializer should not be accepted by WebGL."
+ },
+ {
+ vShaderId: "globalLValueShader",
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Another global as an l-value in a global variable initializer should not be accepted by WebGL."
+ },
+ {
+ vShaderId: "globalLValueShader2",
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Another global as an l-value (parameter of ++) in a global variable initializer should not be accepted by WebGL."
+ },
+ {
+ fShaderId: "globalNonConstTernary",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Non-const global variables as operands for a ternary operator in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ fShaderId: "globalUniformTernary",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "A uniform as the second operand for a ternary operator in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ fShaderId: "globalUniformTernary2",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Referencing a uniform inside the first operand for a ternary operator in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ fShaderId: "globalUniformStruct",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ uniforms: [
+ { name: 'us.one', functionName: 'uniform1i', value: 1 }
+ ],
+ passMsg: "A global struct initialized with a uniform struct should be accepted by WebGL."
+ },
+ {
+ fShaderId: "builtInConstant",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Referencing a built-in constant in a global variable initializer should be accepted by WebGL."
+ },
+ {
+ fShaderId: "builtInNonConstant",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Referencing a built-in non-constant in a global variable initializer should not be accepted by WebGL."
+ }
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-2types-of-textures-on-same-unit.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-2types-of-textures-on-same-unit.html
new file mode 100644
index 0000000000..1e8aebde39
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-2types-of-textures-on-same-unit.html
@@ -0,0 +1,132 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+<meta charset="utf-8">
+ <title>WebGL GLSL 2 types of textures on same unit conformance test.</title>
+ <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+ <script src="../../../js/js-test-pre.js"></script>
+ <script src="../../../js/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="2" height="2" style="width: 40px; height: 40px;"></canvas>
+<canvas id="canvas2d" width="1" height="1" style="width: 40px; height: 40px;"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 vPosition;
+attribute vec2 texCoord0;
+varying vec2 texCoord;
+void main()
+{
+ gl_Position = vPosition;
+ texCoord = texCoord0;
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+
+uniform sampler2D tex2d;
+uniform samplerCube texCube;
+varying vec2 texCoord;
+void main()
+{
+ gl_FragColor = texture2D(tex2d, texCoord) +
+ textureCube(texCube, vec3(0,1,0));
+}
+</script>
+
+ <script>
+ "use strict";
+function init()
+{
+ description(
+ "Tests that using 2 types of textures on the same texture unit" +
+ "and referencing them both in the same program fails as per" +
+ "OpenGL ES 2.0.24 spec section 2.10.4, Samplers subsection.");
+
+ var canvas2d = document.getElementById("canvas2d");
+ var ctx2d = canvas2d.getContext("2d");
+
+ var wtu = WebGLTestUtils;
+ var gl = wtu.create3DContext("example");
+ var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition", "texCoord0"]);
+
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(
+ gl.ARRAY_BUFFER,
+ new Float32Array([
+ -1, 1,0, 1,1,0, -1,-1,0,
+ -1,-1,0, 1,1,0, 1,-1,0]),
+ gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(0);
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(
+ gl.ARRAY_BUFFER,
+ new Float32Array([
+ 0,0, 1,0, 0,1,
+ 0,1, 1,0, 1,1]),
+ gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(1);
+ gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0);
+
+ // Make texture unit 1 active.
+ gl.activeTexture(gl.TEXTURE1);
+
+ // Make a 2d texture
+ var tex2d = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, tex2d);
+ ctx2d.fillStyle = "rgba(0, 0, 255, 255)";
+ ctx2d.fillRect(0, 0, 1, 1);
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d);
+
+ // make a cube texture
+ var texCube = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCube);
+ ctx2d.fillStyle = "rgba(0, 255, 0, 64)";
+ ctx2d.fillRect(0, 0, 1, 1);
+ var targets = [
+ gl.TEXTURE_CUBE_MAP_POSITIVE_X,
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
+ gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];
+ for (var ii = 0; ii < targets.length; ++ii) {
+ gl.texImage2D(targets[ii], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d);
+ }
+
+ var tex2dLoc = gl.getUniformLocation(program, "tex2d");
+ var texCubeLoc = gl.getUniformLocation(program, "texCube");
+ gl.uniform1i(tex2dLoc, 1);
+ gl.uniform1i(texCubeLoc, 1);
+
+ gl.clearColor(1,0,0,1);
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+
+ for (var ii = 0; ii < 4; ++ii) {
+ var x = ii % 2;
+ var y = Math.floor(ii / 2);
+ gl.drawArrays(gl.TRIANGLES, 0, 6);
+ wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION,
+ "drawing with 2 different targets on the same texture unit should generate INVALID_VALUE");
+ }
+}
+
+init();
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-function-nodes.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-function-nodes.html
new file mode 100644
index 0000000000..566356fc43
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-function-nodes.html
@@ -0,0 +1,134 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL function nodes Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+
+<script id="vshaderFunction" type="x-shader/x-vertex">
+attribute vec4 aPosition;
+varying vec4 vColor;
+
+float sign_emu(float value) {
+ if (value == 0.0) return 0.0;
+ return value > 0.0 ? 1.0 : -1.0;
+}
+
+void main()
+{
+ gl_Position = aPosition;
+ vec2 texcoord = vec2(aPosition.xy * 0.5 + vec2(0.5, 0.5));
+ vec4 color = vec4(
+ texcoord,
+ texcoord.x * texcoord.y,
+ (1.0 - texcoord.x) * texcoord.y * 0.5 + 0.5);
+ vColor = vec4(
+ sign_emu(color.x * 2.0 - 1.0) * 0.5 + 0.5,
+ sign_emu(color.y * 2.0 - 1.0) * 0.5 + 0.5,
+ 0,
+ 1);
+}
+</script>
+
+<script id="vshaderMacro" type="x-shader/x-vertex">
+attribute vec4 aPosition;
+varying vec4 vColor;
+
+#define sign_emu(value) ((value) == 0.0 ? 0.0 : ((value) > 0.0 ? 1.0 : -1.0))
+
+void main()
+{
+ gl_Position = aPosition;
+ vec2 texcoord = vec2(aPosition.xy * 0.5 + vec2(0.5, 0.5));
+ vec4 color = vec4(
+ texcoord,
+ texcoord.x * texcoord.y,
+ (1.0 - texcoord.x) * texcoord.y * 0.5 + 0.5);
+ vColor = vec4(
+ sign_emu(color.x * 2.0 - 1.0) * 0.5 + 0.5,
+ sign_emu(color.y * 2.0 - 1.0) * 0.5 + 0.5,
+ 0,
+ 1);
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+varying vec4 vColor;
+void main()
+{
+ gl_FragColor = vColor;
+}
+</script>
+</head>
+<body>
+<canvas id="canvasFunction" width="50" height="50"></canvas>
+<canvas id="canvasMacro" width="50" height="50"></canvas>
+<div id="description">This tests against a Mac driver bug related to function calls.</div>
+<div id="console"></div>
+<script>
+"use strict";
+var width = 50;
+var height = 50;
+var wtu = WebGLTestUtils;
+
+function drawAndRead(canvasID, vshaderID, buffer)
+{
+ var gl = wtu.create3DContext(canvasID);
+ var program = wtu.setupProgram(gl, [vshaderID, "fshader"], ["aPosition"]);
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(0);
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buffer);
+ if (gl.getError() != gl.NO_ERROR)
+ return false;
+ return true;
+}
+
+function compareRendering(buffer1, buffer2, tol)
+{
+ for (var i = 0; i < width * height * 4; ++i) {
+ if (Math.abs(buffer1[i] - buffer2[i]) > tol)
+ return false;
+ }
+ return true;
+}
+
+function init()
+{
+ description("tests function nodes");
+
+ var bufFunction = new Uint8Array(width * height * 4);
+ var bufMacro = new Uint8Array(width * height * 4);
+
+ if (drawAndRead("canvasFunction", "vshaderFunction", bufFunction) == false ||
+ drawAndRead("canvasMacro", "vshaderMacro", bufMacro) == false) {
+ testFailed("Setup failed");
+ } else {
+ if (compareRendering(bufFunction, bufMacro, 4) == false)
+ testFailed("Rendering results are different");
+ else
+ testPassed("Rendering results are the same");
+ }
+}
+
+init();
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-long-variable-names.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-long-variable-names.html
new file mode 100644
index 0000000000..31e88027a6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-long-variable-names.html
@@ -0,0 +1,227 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>glsl long variable name mapping tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+There is supposed to be an example drawing here, but it's not important.
+</canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader_shared_uniform" type="x-shader/x-vertex">
+attribute vec3 vPosition;
+uniform mediump float value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
+void main()
+{
+ gl_Position = vec4(vPosition, value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890);
+}
+</script>
+
+<script id="fshader_shared_uniform" type="x-shader/x-fragment">
+precision mediump float;
+uniform float value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
+void main()
+{
+ gl_FragColor = vec4(1.0, 0.0, value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890, 1.0);
+}
+</script>
+
+<script id="vshader_uniform_array" type="x-shader/x-vertex">
+attribute vec3 vPosition;
+void main()
+{
+ gl_Position = vec4(vPosition, 1.0);
+}
+</script>
+
+<script id="fshader_uniform_array" type="x-shader/x-fragment">
+precision mediump float;
+uniform float color01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567[2];
+void main()
+{
+ gl_FragColor = vec4(color01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567[0], color01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567[1], 1.0, 1.0);
+}
+</script>
+
+<script id="vshader_varying" type="x-shader/x-vertex">
+attribute vec3 vPosition;
+varying float value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
+void main()
+{
+ value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 = 1.0;
+ gl_Position = vec4(vPosition, 1.0);
+}
+</script>
+
+<script id="fshader_varying" type="x-shader/x-fragment">
+precision mediump float;
+varying float value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
+void main()
+{
+ gl_FragColor = vec4(value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890, 0.0, 1.0, 1.0);
+}
+</script>
+
+<script id="vshader_local" type="x-shader/x-vertex">
+attribute vec3 vPosition;
+void main()
+{
+ for (int i012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 = 0; i012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 < 1; ++i012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234)
+ {
+ gl_Position = vec4(vPosition, 1.0);
+ }
+}
+</script>
+
+<script id="fshader_local" type="x-shader/x-fragment">
+precision mediump float;
+void main()
+{
+ for (int i012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 = 0; i012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 < 1; ++i012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234)
+ {
+ gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
+ }
+}
+</script>
+
+<script id="vshader_attrib" type="x-shader/x-vertex">
+attribute vec3 vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
+void main()
+{
+ gl_Position = vec4(vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456, 1.0);
+}
+</script>
+
+<script id="fshader_attrib" type="x-shader/x-fragment">
+precision mediump float;
+void main()
+{
+ gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
+}
+</script>
+
+<script>
+"use strict";
+description("Verify that shader long variable names works fine if they are within 256 characters.");
+
+debug("Test same long uniform name in both vertex shader and fragment shader");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+var program = wtu.setupProgram(gl, ["vshader_shared_uniform", "fshader_shared_uniform"], ["vPosition"]);
+shouldBeNonNull("gl");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+var prog = gl.getParameter(gl.CURRENT_PROGRAM);
+shouldBeNonNull("prog");
+var valueLoc = gl.getUniformLocation(prog, "value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+shouldBeNonNull("valueLoc");
+shouldBe("gl.getProgramParameter(prog, gl.ACTIVE_UNIFORMS)", "1");
+var activeUniform = gl.getActiveUniform(prog, 0);
+shouldBeNonNull("activeUniform");
+shouldBe("activeUniform.type", "gl.FLOAT");
+shouldBe("activeUniform.size", "1");
+shouldBe("activeUniform.name", "'value01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'");
+gl.uniform1f(valueLoc, 1.0);
+drawAndCheckPixels(gl);
+shouldBe("gl.getError()", "gl.NO_ERROR");
+debug("");
+
+debug("Test long uniform array name");
+var gl = wtu.create3DContext("example");
+var program = wtu.setupProgram(gl, ["vshader_uniform_array", "fshader_uniform_array"], ["vPosition"]);
+shouldBeNonNull("gl");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+var prog = gl.getParameter(gl.CURRENT_PROGRAM);
+shouldBeNonNull("prog");
+var redLoc = gl.getUniformLocation(prog, "color01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567[0]");
+shouldBeNonNull("redLoc");
+var greenLoc = gl.getUniformLocation(prog, "color01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567[1]");
+shouldBeNonNull("greenLoc");
+shouldBe("gl.getProgramParameter(prog, gl.ACTIVE_UNIFORMS)", "1");
+var activeUniform = gl.getActiveUniform(prog, 0);
+shouldBeNonNull("activeUniform");
+shouldBe("activeUniform.type", "gl.FLOAT");
+shouldBe("activeUniform.size", "2");
+shouldBe("activeUniform.name", "'color01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567[0]'");
+gl.uniform1f(redLoc, 1.0);
+gl.uniform1f(greenLoc, 0.0);
+drawAndCheckPixels(gl);
+shouldBe("gl.getError()", "gl.NO_ERROR");
+debug("");
+
+debug("Test long varying name");
+var gl = wtu.create3DContext("example");
+var program = wtu.setupProgram(gl, ["vshader_varying", "fshader_varying"], ["vPosition"]);
+shouldBeNonNull("gl");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+var prog = gl.getParameter(gl.CURRENT_PROGRAM);
+shouldBeNonNull("prog");
+drawAndCheckPixels(gl);
+shouldBe("gl.getError()", "gl.NO_ERROR");
+debug("");
+
+debug("Test long local variable name");
+var gl = wtu.create3DContext("example");
+var program = wtu.setupProgram(gl, ["vshader_varying", "fshader_varying"], ["vPosition"]);
+shouldBeNonNull("gl");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+var prog = gl.getParameter(gl.CURRENT_PROGRAM);
+shouldBeNonNull("prog");
+drawAndCheckPixels(gl);
+shouldBe("gl.getError()", "gl.NO_ERROR");
+debug("");
+
+debug("Test long attribute name");
+var gl = wtu.create3DContext("example");
+var program = wtu.setupProgram(gl, ["vshader_attrib", "fshader_attrib"], ["vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"]);
+shouldBeNonNull("gl");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+var prog = gl.getParameter(gl.CURRENT_PROGRAM);
+shouldBeNonNull("prog");
+shouldBe("gl.getProgramParameter(prog, gl.ACTIVE_ATTRIBUTES)", "1");
+var activeAttrib = gl.getActiveAttrib(prog, 0);
+shouldBeNonNull("activeAttrib");
+shouldBe("activeAttrib.size", "1");
+shouldBe("activeAttrib.type", "gl.FLOAT_VEC3");
+shouldBe("activeAttrib.name", "'vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456'");
+drawAndCheckPixels(gl);
+shouldBe("gl.getError()", "gl.NO_ERROR");
+debug("");
+
+function drawAndCheckPixels(gl)
+{
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(0);
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+
+ // Test several locations
+ // First line should be all black
+ wtu.checkCanvasRect(gl, 0, 0, 50, 1, [0, 0, 0, 0]);
+
+ // Line 15 should be magenta for at least 10 pixels starting 20 pixels in
+ wtu.checkCanvasRect(gl, 20, 15, 10, 1, [255, 0, 255, 255]);
+
+ // Last line should be all black
+ wtu.checkCanvasRect(gl, 0, 49, 50, 1, [0, 0, 0, 0]);
+}
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-vertex-branch.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-vertex-branch.html
new file mode 100644
index 0000000000..dee3597546
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/glsl-vertex-branch.html
@@ -0,0 +1,128 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL function nodes Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+
+<script id="vshaderNoBranch" type="x-shader/x-vertex">
+attribute vec3 aPosition;
+uniform float redIntensity;
+
+varying vec4 vColor;
+
+float MADBug(float paramValue) {
+ float localVar = 1.0;
+ return 0.25 * ceil(localVar) + paramValue;
+}
+
+void main(void) {
+ gl_Position = vec4(aPosition, 1.0);
+ vColor = vec4(MADBug(redIntensity), 0., 0., 1.);
+}
+</script>
+
+<script id="vshaderBranch" type="x-shader/x-vertex">
+attribute vec3 aPosition;
+uniform float redIntensity;
+
+varying vec4 vColor;
+
+float MADBug(float paramValue) {
+ float localVar = 1.0;
+ return 0.25 * ceil(localVar) + paramValue;
+}
+
+void main(void) {
+ float condition = 42.;
+ if (condition == 0.) {}
+ gl_Position = vec4(aPosition, 1.0);
+ vColor = vec4(MADBug(redIntensity), 0., 0., 1.);
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+
+varying vec4 vColor;
+void main()
+{
+ gl_FragColor = vColor;
+}
+</script>
+</head>
+<body>
+<canvas id="canvasNoBranch" width="50" height="50"></canvas>
+<canvas id="canvasBranch" width="50" height="50"></canvas>
+<div id="description">This tests against a Mac driver bug related to branches
+ inside of Vertex Shaders.</div>
+<div id="console"></div>
+<script>
+"use strict";
+var width = 50;
+var height = 50;
+var wtu = WebGLTestUtils;
+
+function drawAndRead(canvasID, vshaderID, buffer)
+{
+ var gl = wtu.create3DContext(canvasID);
+ var program = wtu.setupProgram(gl, [vshaderID, "fshader"], ["aPosition"]);
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -1,-1,0, 1,-1,0 ]), gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(0);
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+ var loc = gl.getUniformLocation(program, "redIntensity");
+ gl.uniform1f(loc, 0.75);
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buffer);
+ if (gl.getError() != gl.NO_ERROR)
+ return false;
+ return true;
+}
+
+function compareRendering(buffer1, buffer2, tol)
+{
+ for (var i = 0; i < width * height * 4; ++i) {
+ if (Math.abs(buffer1[i] - buffer2[i]) > tol)
+ return false;
+ }
+ return true;
+}
+
+function init()
+{
+ description("tests vertex shader with branch");
+
+ var bufBranch = new Uint8Array(width * height * 4);
+ var bufNoBranch = new Uint8Array(width * height * 4);
+
+ if (drawAndRead("canvasBranch", "vshaderBranch", bufBranch) == false ||
+ drawAndRead("canvasNoBranch", "vshaderNoBranch", bufNoBranch) == false) {
+ testFailed("Setup failed");
+ } else {
+ if (compareRendering(bufBranch, bufNoBranch, 4) == false)
+ testFailed("Rendering results are different");
+ else
+ testPassed("Rendering results are the same");
+ }
+}
+
+init();
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/include.vs b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/include.vs
new file mode 100644
index 0000000000..50970e6ccf
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/include.vs
@@ -0,0 +1,4 @@
+// Do not delete!
+// Needed to help glsl-conformance tests.
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/large-loop-compile.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/large-loop-compile.html
new file mode 100644
index 0000000000..1f096ec30f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/large-loop-compile.html
@@ -0,0 +1,172 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+attribute vec2 position;
+
+void main(){
+ gl_Position = vec4(position, 0.0, 1.0);
+}
+</script>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+uniform sampler2D source;
+
+mat3 front = mat3(
+ 1.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0,
+ 0.0, 0.0, 1.0
+);
+
+mat3 back = mat3(
+ -1.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0,
+ 0.0, 0.0, -1.0
+);
+
+mat3 left = mat3(
+ 0.0, 0.0, -1.0,
+ 0.0, 1.0, 0.0,
+ 1.0, 0.0, 0.0
+);
+
+mat3 right = mat3(
+ 0.0, 0.0, 1.0,
+ 0.0, 1.0, 0.0,
+ -1.0, 0.0, 0.0
+);
+
+mat3 up = mat3(
+ 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0,
+ 0.0, -1.0, 0.0
+);
+
+mat3 down = mat3(
+ 1.0, 0.0, 0.0,
+ 0.0, 0.0, -1.0,
+ 0.0, 1.0, 0.0
+);
+
+float coefficient(vec3 normal){
+ int index = int(gl_FragCoord.x);
+ float x = normal.x;
+ float y = normal.y;
+ float z = normal.z;
+
+ if(index==0){
+ return 1.0;
+ }
+ else if(index==1){
+ return y;
+ }
+ else if(index==2){
+ return z;
+ }
+ else if(index==3){
+ return x;
+ }
+ else if(index==4){
+ return x*y;
+ }
+ else if(index==5){
+ return y*z;
+ }
+ else if(index==6){
+ return 3.0*z*z - 1.0;
+ }
+ else if(index==7){
+ return x*z;
+ }
+ else{
+ return x*x - y*y;
+ }
+}
+
+vec3 sample(float cidx, mat3 side){
+ vec3 result = vec3(0.0);
+ float divider = 0.0;
+
+ for(int i=0; i<256; i++){
+ float x = mod(float(i), 16.0);
+ float y = float(i/16);
+ vec2 texcoord = (vec2(x+cidx*16.0, y+floor(gl_FragCoord.y)*16.0)+0.5)/6.0;
+ vec2 sidecoord = ((vec2(x,y)+vec2(0.5, 0.5))/vec2(16.0))*2.0-1.0;
+ vec3 normal = normalize(vec3(sidecoord, -1.0));
+ vec3 texel = texture2D(source, texcoord).rgb;
+ result += coefficient(side*normal) * texel * -normal.z;
+ divider += -normal.z;
+ }
+ return result/divider;
+}
+
+void main(){
+ vec3 result = (
+ //sample(0.0, front) +
+ //sample(1.0, back) +
+ sample(2.0, left) +
+ sample(3.0, right) +
+ sample(4.0, up) +
+ sample(5.0, down)
+ )/6.0;
+ gl_FragColor = vec4(result, 1.0);
+}
+</script>
+<script>
+"use strict";
+var receivedContextLost = false;
+description("Ensures that compilation of a large loop completes in a reasonable period of time and does not cause the WebGL context to be lost");
+var wtu = WebGLTestUtils;
+var canvas = document.createElement('canvas');
+canvas.width = 32;
+canvas.height = 32;
+canvas.addEventListener("webglcontextlost", function(e) {
+ testFailed("context was lost during shader compilation or linking");
+ receivedContextLost = true;
+});
+var gl = wtu.create3DContext(canvas);
+if (!gl) {
+ testFailed("context does not exist");
+ finishTest();
+} else {
+ var startTime = Date.now();
+ wtu.setupProgram(gl, ["vertexShader", "fragmentShader"], undefined, undefined, true);
+ gl.clearColor(0.0, 1.0, 0.0, 1.0);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green", 0);
+ var endTime = Date.now();
+
+ // Delay for some period to increase chances that context lost event will be delivered.
+ setTimeout(function() {
+ if (!receivedContextLost) {
+ testPassed("Large loop compiled and linked without terminating the WebGL context");
+ const timeString = `${endTime - startTime} ms`;
+ if (endTime - startTime < 7500) {
+ testPassed("Shader compilation completed in a reasonable amount of time: " + timeString);
+ } else {
+ testFailed("Shader compilation took an unreasonably long time: " + timeString);
+ }
+ }
+ finishTest();
+ }, 500);
+}
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/local-variable-shadowing-outer-function.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/local-variable-shadowing-outer-function.html
new file mode 100644
index 0000000000..4fb814c0d9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/local-variable-shadowing-outer-function.html
@@ -0,0 +1,59 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Test - Local Variable Shadowing Outer Function</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader must succeed
+attribute vec3 vertex;
+varying float interp;
+void main() {
+ interp = vertex.x;
+ gl_Position = vec4(vertex, 1.0);
+}
+</script>
+<script id="fragmentShader" type="text/something-not-javascript">
+// local variable shadowing outer function definition must succeed
+precision mediump float;
+
+varying float interp;
+
+float rsquared(float radius)
+{
+ return radius * radius;
+}
+
+void some_computation(float radius, out float bsdf) {
+ bsdf = 0.0;
+ float rsquared = rsquared(radius);
+ bsdf += rsquared;
+}
+
+void main() {
+ float comp;
+ some_computation(interp, comp);
+ gl_FragColor = vec4(comp, 0.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii-comments.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii-comments.vert.html
new file mode 100644
index 0000000000..14d807ed71
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii-comments.vert.html
@@ -0,0 +1,54 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/plain">
+Loading...
+</script>
+<script>
+"use strict";
+
+// Via `[].map.call(str, x => x.codePointAt(0));`
+let a = [12371,12428,12399,65313,65331,65315,65321,65321,12391,12399,12394,12356,12391,12377,12290];
+let b = [65332,65352,65353,65363,12288,65321,65363,12288,65326,65359,65364,12288,65313,65331,65315,65321,65321];
+a = String.fromCodePoint(...a);
+b = String.fromCodePoint(...b);
+
+// -
+
+vertexShader.textContent = `
+// Non ascii comments in source should succeed
+// ${a}
+// ${b}
+/*
+ * ${b}
+ */
+#define TEST 1 // ${b}
+void main() {
+ gl_Position = vec4(1,1,1,1); // ${b}
+} // ${b}
+`;
+
+// -
+
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii.vert.html
new file mode 100644
index 0000000000..7cc05b9354
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/non-ascii.vert.html
@@ -0,0 +1,54 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/plain">
+Loading...
+</script>
+<script>
+"use strict";
+
+// Via `[].map.call(str, x => x.codePointAt(0));`
+let a = [12371,12428,12399,65313,65331,65315,65321,65321,12391,12399,12394,12356,12391,12377,12290];
+let b = [65332,65352,65353,65363,12288,65321,65363,12288,65326,65359,65364,12288,65313,65331,65315,65321,65321];
+let c = [65326,65359,65364,65313,65331,65315,65321,65321];
+a = String.fromCodePoint(...a);
+b = String.fromCodePoint(...b);
+c = String.fromCodePoint(...c);
+
+// -
+
+vertexShader.textContent = `
+// Non ascii data in source should fail
+// See GLSL ES Spec 1.0.17 section 3.1 and 3.2
+// ${a}
+// ${b}
+uniform mat4 ${c};
+void main() {
+ gl_Position = vec4(1,1,1,1);
+}
+`;
+
+// -
+
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/re-compile-re-link.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/re-compile-re-link.html
new file mode 100644
index 0000000000..caed432120
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/re-compile-re-link.html
@@ -0,0 +1,150 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Re-Compile and Re-link Shader conformance test.</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+attribute float column;
+attribute float height;
+uniform float position;
+void main() {
+ gl_Position = vec4(mod(column - position, 1.0) * 2.0 - 1.0, height, 0, 1);
+}
+</script>
+
+<script id="fshader1" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ gl_FragColor = vec4(1,0,0,1);
+}
+</script>
+<script id="fshader2" type="x-shader/x-fragment">
+precision mediump float;
+uniform float foobar;
+void main() {
+ gl_FragColor = vec4(1,0,foobar,1);
+}
+</script>
+<script id="vshaderB" type="not-js">
+attribute vec2 position;
+varying vec2 v_texCoord;
+void main() {
+ gl_Position = vec4(position, 0, 1);
+ v_texCoord = vec2(position * 0.5 + 0.5);
+}
+</script>
+<script id="fshaderB" type="not-js">
+precision mediump float;
+varying vec2 v_texCoord;
+uniform sampler2D tex;
+void main() {
+ gl_FragColor = texture2D(tex, v_texCoord);
+}
+</script>
+
+<script>
+"use strict";
+description(document.title);
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+
+var vsSource = document.getElementById("vshader").text;
+var fs1Source = document.getElementById("fshader1").text;
+var fs2Source = document.getElementById("fshader2").text;
+
+var vsSourceB = document.getElementById("vshaderB").text;
+var fsSourceB = document.getElementById("fshaderB").text;
+
+var vShader = gl.createShader(gl.VERTEX_SHADER);
+var fShader = gl.createShader(gl.FRAGMENT_SHADER);
+
+var vShaderB = gl.createShader(gl.VERTEX_SHADER);
+var fShaderB = gl.createShader(gl.FRAGMENT_SHADER);
+
+var program = gl.createProgram();
+var programB = gl.createProgram();
+
+gl.attachShader(program, vShader);
+gl.attachShader(program, fShader);
+
+gl.attachShader(programB, vShaderB);
+gl.attachShader(programB, fShaderB);
+
+var success;
+var shader;
+
+function checkShaderStatus(s) {
+ shader = s;
+ shouldBeTrue("success = gl.getShaderParameter(shader, gl.COMPILE_STATUS)");
+ if (!success) {
+ debug("error: " + gl.getShaderInfoLog(shader));
+ }
+}
+
+var prg;
+function checkProgramStatus(p) {
+ prg = p;
+ shouldBeTrue("success = gl.getProgramParameter(prg, gl.LINK_STATUS)");
+ if (!success) {
+ debug("error: " + gl.getProgramInfoLog(prg));
+ }
+}
+
+for (var i = 0; i < 10; ++i) {
+ gl.shaderSource(vShader, vsSource);
+ gl.compileShader(vShader);
+ checkShaderStatus(vShader)
+ gl.shaderSource(fShader, fs1Source);
+ gl.compileShader(fShader);
+ checkShaderStatus(fShader)
+
+ gl.linkProgram(program);
+ checkProgramStatus(program)
+ gl.useProgram(program);
+
+ gl.shaderSource(vShaderB, vsSourceB);
+ gl.compileShader(vShaderB);
+ checkShaderStatus(vShaderB)
+ gl.shaderSource(fShaderB, fsSourceB);
+ gl.compileShader(fShaderB);
+ checkShaderStatus(fShaderB)
+
+ gl.linkProgram(programB);
+ checkProgramStatus(programB)
+
+ gl.useProgram(programB);
+}
+
+for (var i = 0; i < 10; ++i) {
+ // Now change the fragment shader
+ gl.shaderSource(fShader, fs2Source);
+ gl.compileShader(fShader);
+ checkShaderStatus(fShader)
+
+ // And re-link
+ gl.linkProgram(program);
+ checkProgramStatus(program)
+}
+
+wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors");
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sampler-operand.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sampler-operand.html
new file mode 100644
index 0000000000..4b6d6c0bad
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sampler-operand.html
@@ -0,0 +1,51 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - sampler operands</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+// ESSL(1.00, 3.00, 3.10) section 4.1.7
+// Except for array indexing, structure field selection, and
+// parentheses, samplers are not allowed to be operands in expressions.
+</script>
+
+<script id="samplerAdding" type="x-shader/x-fragment">
+// This covers an ANGLE bug.
+// See https://bugs.chromium.org/p/angleproject/issues/detail?id=2028.
+uniform sampler2D s1;
+uniform sampler2D s2;
+void main() {
+ s1 + s2;
+}
+</script>
+
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ { fShaderId: 'samplerAdding',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'Adding on samplers should fail'
+ },
+]);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sequence-operator-returns-constant.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sequence-operator-returns-constant.html
new file mode 100644
index 0000000000..8ea601f719
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/sequence-operator-returns-constant.html
@@ -0,0 +1,60 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Sequence operator returns constant test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fshader-const-expression" type="x-shader/x-fragment">
+precision mediump float;
+void main()
+{
+ // RHS should be a constant expression (a compile-time constants) stated in section 4.3.2 from GLESSL 1.0.17
+ const float a = (0.0, 1.0);
+}
+</script>
+<script id="fshader-non-const-expression" type="x-shader/x-fragment">
+precision mediump float;
+void main()
+{
+ float a[(2, 3)];
+}
+</script>
+<script>
+"use strict";
+description("Checks sequence operators returning constants and can be used as an array size.");
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext();
+
+GLSLConformanceTester.runTests([
+{ fShaderId: 'fshader-const-expression',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Sequence operator can return a constant expression",
+},
+{ fShaderId: 'fshader-non-const-expression',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Sequence operator return value can be used as array size",
+},
+]);
+
+debug("");
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-precision-format-obeyed.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-precision-format-obeyed.html
new file mode 100644
index 0000000000..4574846469
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-precision-format-obeyed.html
@@ -0,0 +1,83 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fshaderWithHighPrecision" type="text/something-not-javascript">
+precision highp float;
+uniform vec4 constantColor;
+
+void main()
+{
+ gl_FragColor = constantColor;
+}
+</script>
+<script id="fshaderWhichCompilesWithHighp" type="text/something-not-javascript">
+#ifdef GL_FRAGMENT_PRECISION_HIGH
+// Something which compiles
+#else
+somethingWhichDoesNotCompile();
+#endif
+
+void main()
+{
+ gl_FragColor = vec4(0, 0, 0, 1);
+}
+</script>
+<script id="fshaderWhichCompilesWithoutHighp" type="text/something-not-javascript">
+#ifndef GL_FRAGMENT_PRECISION_HIGH
+// Something which compiles
+#else
+somethingWhichDoesNotCompile();
+#endif
+
+void main()
+{
+ gl_FragColor = vec4(0, 0, 0, 1);
+}
+</script>
+<script>
+"use strict";
+description("Checks that getShaderPrecisionFormat's return value matches whether highp is supported in fragment shaders.");
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext();
+var precision = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
+var highpSupported = (precision.rangeMin >= 62 && precision.rangeMax >= 62 && precision.precision >= 16);
+debug("highp is" + (highpSupported ? "" : " not") + " supported in fragment shaders");
+
+GLSLConformanceTester.runTests([
+{
+ fShaderId: 'fshaderWithHighPrecision',
+ fShaderSuccess: highpSupported,
+ linkSuccess: highpSupported,
+ passMsg: "getShaderPrecisionFormat's results agree with highp support in fragment shaders",
+},
+{
+ fShaderId: highpSupported ? 'fshaderWhichCompilesWithHighp' : 'fshaderWhichCompilesWithoutHighp',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "getShaderPrecisionFormat's results agree with definition of GL_FRAGMENT_PRECISION_HIGH",
+},
+]);
+
+debug("");
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-struct-scope.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-struct-scope.html
new file mode 100644
index 0000000000..a04faf03b1
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-struct-scope.html
@@ -0,0 +1,231 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!-- author: Jamie Madill (jmadill at chromium) -->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Struct Scope Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script id="shader-vs-1" type="x-shader/x-vertex">
+void main(void) {
+
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+
+ {
+ struct T {
+ int v1;
+ };
+
+ T x;
+ gl_Position.x += float(x.v1);
+ }
+
+ {
+ struct T {
+ float v2;
+ };
+
+ T x;
+ gl_Position.x += x.v2;
+ }
+
+}
+</script>
+
+<script id="shader-vs-2" type="x-shader/x-vertex">
+void main(void) {
+
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+
+ struct T {
+ int v1;
+ };
+
+ T x;
+ gl_Position.x += float(x.v1);
+
+ {
+ struct T {
+ float v2;
+ };
+
+ T x;
+ gl_Position.x += x.v2;
+ }
+
+}
+</script>
+
+<script id="shader-vs-3" type="x-shader/x-vertex">
+void main(void) {
+
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+
+ {
+ struct T {
+ int v1;
+ };
+
+ T x;
+ gl_Position.x += float(x.v1);
+ }
+
+ struct T {
+ float v2;
+ };
+
+ T x;
+ gl_Position.x += x.v2;
+}
+</script>
+
+<script id="shader-vs-bad" type="x-shader/x-vertex">
+void main(void) {
+
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+
+ struct T {
+ int v1;
+ };
+
+ T x;
+ gl_Position.x += float(x.v1);
+
+ struct T {
+ float v2;
+ };
+
+ T y;
+ gl_Position.x += y.v2;
+}
+</script>
+
+<script id="shader-vs-anglebug" type="x-shader/x-vertex">
+
+struct T_0 {
+ int v1;
+};
+
+void main(void) {
+
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+
+ struct T {
+ float v2;
+ };
+
+ T_0 x;
+ gl_Position.x += float(x.v1);
+
+ T y;
+ gl_Position.x += y.v2;
+}
+</script>
+
+<script id="shader-vs-masked-struct-variable" type="x-shader/x-vertex">
+
+struct T {
+ float f;
+};
+
+void main(void) {
+
+ T a;
+
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+
+ struct T {
+ float q;
+ };
+
+ gl_Position.x += a.f;
+
+ T b;
+ gl_Position.x += b.q;
+}
+</script>
+
+<script id="shader-fs" type="x-shader/x-fragment">
+precision mediump float;
+void main(void) {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+</script>
+
+<script>
+"use strict";
+description("Testing struct definition scope");
+
+var wtu = WebGLTestUtils;
+GLSLConformanceTester.runTests([
+ {
+ vShaderId: "shader-vs-1",
+ vShaderSuccess: true,
+ fShaderId: "shader-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Two structs defined within non-overlapping scopes should be able to use the same name",
+ },
+ {
+ vShaderId: "shader-vs-2",
+ vShaderSuccess: true,
+ fShaderId: "shader-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "A struct defined inside a scope overrides a struct defined in a outer scope with the same name",
+ },
+ {
+ vShaderId: "shader-vs-3",
+ vShaderSuccess: true,
+ fShaderId: "shader-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "A struct can use the same name of another out-of-scope struct",
+ },
+ {
+ vShaderId: "shader-vs-bad",
+ vShaderSuccess: false,
+ fShaderId: "shader-fs",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "A struct can't be defined with the same name as another struct defined in the same scope",
+ },
+ {
+ vShaderId: "shader-vs-anglebug",
+ vShaderSuccess: true,
+ fShaderId: "shader-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Structs with appended underscored numbers don't cause link errors (ANGLE bug)",
+ },
+ {
+ vShaderId: "shader-vs-masked-struct-variable",
+ vShaderSuccess: true,
+ fShaderId: "shader-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Variables of masked outer scope struct work with inner scope struct",
+ },
+]);
+
+debug("");
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-uniform-packing-restrictions.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-uniform-packing-restrictions.html
new file mode 100644
index 0000000000..22a968470f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-uniform-packing-restrictions.html
@@ -0,0 +1,251 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL uniform packing restrctions Conformance Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="example" width="2" height="2"> </canvas>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main()
+{
+ gl_Position = a_position;
+}
+</script>
+<script id="fshader" type="x-shader/x-vertex">
+precision mediump float;
+varying vec4 v_varying;
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script id="vshaderArrayTest" type="x-shader/x-vertex">
+attribute vec4 a_position;
+varying vec4 v_varying;
+uniform $(type) u_uniform[$(numTestType)];
+void main()
+{
+ v_varying = $(result);
+ gl_Position = a_position;
+}
+</script>
+<script id="fshaderArrayTest" type="x-shader/x-fragment">
+precision mediump float;
+uniform $(type) u_uniform[$(numTestType)];
+void main()
+{
+ gl_FragColor = $(result);
+}
+</script>
+<script id="vshaderUniformTest" type="x-shader/x-fragment">
+attribute vec4 a_position;
+varying vec4 v_varying;
+$(uniforms)
+void main()
+{
+ $(code)
+ v_varying = $(result);
+ gl_Position = a_position;
+}
+</script>
+<script id="fshaderUniformTest" type="x-shader/x-fragment">
+precision mediump float;
+$(uniforms)
+void main()
+{
+ $(code)
+ gl_FragColor = $(result);
+}
+</script>
+<script>
+"use strict";
+description();
+debug("");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+
+var uniformTypes = [
+ { type: "bool", componentsPerRow: 1, rows: 1, fType: "float", uniToF: "float(u_uniform$(id)$(index))", fToVec4: "vec4($(f), 0, 0, 0)"},
+ { type: "float", componentsPerRow: 1, rows: 1, fType: "float", uniToF: "u_uniform$(id)$(index)", fToVec4: "vec4($(f), 0, 0, 0)"},
+ { type: "int", componentsPerRow: 1, rows: 1, fType: "float", uniToF: "float(u_uniform$(id)$(index))", fToVec4: "vec4($(f), 0, 0, 0)"},
+ { type: "vec2", componentsPerRow: 2, rows: 1, fType: "vec2", uniToF: "u_uniform$(id)$(index)", fToVec4: "vec4($(f), 0, 0)"},
+ { type: "ivec2", componentsPerRow: 2, rows: 1, fType: "vec2", uniToF: "vec2(u_uniform$(id)$(index))", fToVec4: "vec4($(f), 0, 0)"},
+ { type: "bvec2", componentsPerRow: 2, rows: 1, fType: "vec2", uniToF: "vec2(u_uniform$(id)$(index))", fToVec4: "vec4($(f), 0, 0)"},
+ { type: "vec3", componentsPerRow: 3, rows: 1, fType: "vec3", uniToF: "u_uniform$(id)$(index)", fToVec4: "vec4($(f), 0)"},
+ { type: "ivec3", componentsPerRow: 3, rows: 1, fType: "vec3", uniToF: "vec3(u_uniform$(id)$(index))", fToVec4: "vec4($(f), 0)"},
+ { type: "bvec3", componentsPerRow: 3, rows: 1, fType: "vec3", uniToF: "vec3(u_uniform$(id)$(index))", fToVec4: "vec4($(f), 0)"},
+ { type: "vec4", componentsPerRow: 4, rows: 1, fType: "vec4", uniToF: "u_uniform$(id)$(index)", fToVec4: "$(f)"},
+ { type: "ivec4", componentsPerRow: 4, rows: 1, fType: "vec4", uniToF: "vec4(u_uniform$(id)$(index))", fToVec4: "$(f)"},
+ { type: "bvec4", componentsPerRow: 4, rows: 1, fType: "vec4", uniToF: "vec4(u_uniform$(id)$(index))", fToVec4: "$(f)"},
+// Yes, the spec says mat2 takes 4 columns, 2 rows.
+ { type: "mat2", componentsPerRow: 4, rows: 2, fType: "vec2", uniToF: "vec2(u_uniform$(id)$(index)[0])", fToVec4: "vec4($(f), 0, 0)"},
+ { type: "mat3", componentsPerRow: 3, rows: 3, fType: "vec3", uniToF: "vec3(u_uniform$(id)$(index)[0])", fToVec4: "vec4($(f), 0)"},
+ { type: "mat4", componentsPerRow: 4, rows: 4, fType: "vec4", uniToF: "vec4(u_uniform$(id)$(index)[0])", fToVec4: "$(f)"},
+// Samplers generally have more restrictive limits.
+// { type: "sampler2D", componentsPerRow: 1, rows: 1, code: "vec4(texture2D(u_uniform[$(index)], vec2(0, 0)))", },
+// { type: "samplerCube", componentsPerRow: 1, rows: 1, code: "vec4(textureCube(u_uniform[$(index)], vec3(0, 0, 0)))", },
+];
+
+var vBaseSource = wtu.getScript("vshader");
+var fBaseSource = wtu.getScript("fshader");
+var vArrayTestSource = wtu.getScript("vshaderArrayTest");
+var fArrayTestSource = wtu.getScript("fshaderArrayTest");
+var vUniformTestSource = wtu.getScript("vshaderUniformTest");
+var fUniformTestSource = wtu.getScript("fshaderUniformTest");
+
+var tests = [];
+var shaderTypes = [
+ { type: "vertex",
+ // For tests that expect failure which shader might fail.
+ vertExpectation: false,
+ fragExpectation: true,
+ vertArrayTest: vArrayTestSource,
+ fragArrayTest: fBaseSource,
+ vertUniformTest: vUniformTestSource,
+ fragUniformTest: fBaseSource,
+ maxVectors: gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS),
+ minVectors: 127, // GLSL ES 1.0.17 Appendix A.7 and A.8. Reserve one row for constants in the code, hence 128 - 1.
+ },
+ { type: "fragment",
+ // For tests that expect failure which shader might fail.
+ vertExpectation: true,
+ fragExpectation: false,
+ vertArrayTest: vBaseSource,
+ fragArrayTest: fArrayTestSource,
+ vertUniformTest: vBaseSource,
+ fragUniformTest: fUniformTestSource,
+ maxVectors: gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS),
+ minVectors: 15, // GLSL ES 1.0.17 Appendix A.8 - minimum value of gl_maxFragmentUniformVectors is 16. Again, reserve a row for constants.
+ },
+];
+for (var ss = 0; ss < shaderTypes.length; ++ss) {
+ var shaderType = shaderTypes[ss];
+ debug("max " + shaderType.type + ": " + shaderType.maxVectors);
+ for (var ii = 0; ii < uniformTypes.length; ++ii) {
+ var info = uniformTypes[ii];
+ wtu.log("checking: " + info.type);
+ // Compute the maximum amount of this type allowed in a single array.
+ var maxInArray = Math.floor(shaderType.maxVectors / info.rows);
+ // Compute the minimum required to work in a single array.
+ var minVars = Math.floor(shaderType.minVectors / info.rows);
+ // Compute the maximum allowed as single elements
+ var maxPerRow = Math.floor(4 / info.componentsPerRow);
+ var maxPacked = Math.floor(shaderType.maxVectors * maxPerRow / info.rows);
+
+ // Test array[1] of the type
+ var uniToF = wtu.replaceParams(info.uniToF, {id: "", index: "[0]"});
+ var vec4 = wtu.replaceParams(info.fToVec4, {f: uniToF});
+ tests.push({
+ vShaderSource: wtu.replaceParams(shaderType.vertArrayTest, {numTestType: 1, result: vec4}, info),
+ vShaderSuccess: true,
+ fShaderSource: wtu.replaceParams(shaderType.fragArrayTest, {numTestType: 1, result: vec4}, info),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: shaderType.type + " shader with uniform array of " + info.type + " with 1 element should succeed",
+ });
+
+ // Note: We can't test an array filling all uniform space as actual GL drivers are
+ // only required to be able to do the minimum number. After that it can fail for
+ // multiple reasons, including uniform registers being reserved for the implementation's
+ // own use. Constants also take up uniform registers.
+
+ // Test required number of uniforms
+ var uniToF = wtu.replaceParams(info.uniToF, {id: "", index: "[" + (minVars - 1) + "]"});
+ var vec4 = wtu.replaceParams(info.fToVec4, {f: uniToF});
+ tests.push({
+ vShaderSource: wtu.replaceParams(shaderType.vertArrayTest, {numTestType: minVars, result: vec4}, info),
+ vShaderSuccess: true,
+ fShaderSource: wtu.replaceParams(shaderType.fragArrayTest, {numTestType: minVars, result: vec4}, info),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: shaderType.type + " shader with uniform array of " + info.type + " with " + minVars + " elements (the minimum required) should succeed",
+ });
+
+ // Test array[max + 1] accessing last element. WebGL requires this to fail.
+ var uniToF = wtu.replaceParams(info.uniToF, {id: "", index: "[" + maxInArray + "]"});
+ var vec4 = wtu.replaceParams(info.fToVec4, {f: uniToF});
+ tests.push({
+ vShaderSource: wtu.replaceParams(shaderType.vertArrayTest, {numTestType: maxInArray + 1, result: vec4}, info),
+ vShaderSuccess: shaderType.vertExpectation,
+ fShaderSource: wtu.replaceParams(shaderType.fragArrayTest, {numTestType: maxInArray + 1, result: vec4}, info),
+ fShaderSuccess: shaderType.fragExpectation,
+ linkSuccess: false,
+ passMsg: shaderType.type + " shader with uniform array of " + info.type + " with " + (maxInArray + 1) + " elements (one past maximum) accessing last element should fail",
+ });
+
+ // Test array[max + 1] accessing first element. WebGL requires this to fail but ES allows truncating array.
+ var uniToF = wtu.replaceParams(info.uniToF, {id: "", index: "[0]"});
+ var vec4 = wtu.replaceParams(info.fToVec4, {f: uniToF});
+ tests.push({
+ vShaderSource: wtu.replaceParams(shaderType.vertArrayTest, {numTestType: maxInArray + 1, result: vec4}, info),
+ vShaderSuccess: shaderType.vertExpectation,
+ fShaderSource: wtu.replaceParams(shaderType.fragArrayTest, {numTestType: maxInArray + 1, result: vec4}, info),
+ fShaderSuccess: shaderType.fragExpectation,
+ linkSuccess: false,
+ passMsg: shaderType.type + " shader with uniform array of " + info.type + " with " + (maxInArray + 1) + " elements (one past maximum) accessing first element should fail",
+ });
+
+ // Note: We can't test max uniforms as actual GL drivers are only required to be able
+ // to do the minimum number. After that it can fail for multiple reasons, including
+ // uniform registers being reserved for the implementation's own use or also instruction
+ // space limitations. Strictly speaking, guaranteed supported length of a shader
+ // executable is defined by the GLES2 conformance tests according to GLSL ES 1.0.17
+ // Appendix A.2. This does not give us an exact limit: this test only aims to fit within
+ // instruction space limits imposed by existing GLES2 compliant hardware.
+
+ var generateCode = function(numVars) {
+ var uniforms = [];
+ var sumTerms = [];
+ for (var uu = 0; uu < numVars; ++uu) {
+ uniforms.push(" uniform " + info.type + " u_uniform" + uu + ";");
+ sumTerms.push(wtu.replaceParams(info.uniToF, {id: uu, index: ""}));
+ }
+ return {
+ uniforms: uniforms.join("\n"),
+ code: info.fType + " sum = " + sumTerms.join(" + \n ") + ";",
+ result: wtu.replaceParams(info.fToVec4, {f: 'sum'})
+ };
+ };
+
+ // Test max+1 uniforms of type.
+ tests.push({
+ vShaderSource: wtu.replaceParams(shaderType.vertUniformTest, generateCode(maxPacked + 1), info),
+ vShaderSuccess: shaderType.vertExpectation,
+ fShaderSource: wtu.replaceParams(shaderType.fragUniformTest, generateCode(maxPacked + 1), info),
+ fShaderSuccess: shaderType.fragExpectation,
+ linkSuccess: false,
+ passMsg: shaderType.type + " shader with " + (maxPacked + 1) + " uniforms of " + info.type + " (one past maximum) should fail",
+ });
+
+ // Test required uniforms of type.
+ tests.push({
+ vShaderSource: wtu.replaceParams(shaderType.vertUniformTest, generateCode(minVars), info),
+ vShaderSuccess: true,
+ fShaderSource: wtu.replaceParams(shaderType.fragUniformTest, generateCode(minVars), info),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: shaderType.type + " shader with " + minVars + " uniforms of " + info.type + " (the minimum required) should succeed",
+ });
+ }
+}
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-varying-packing-restrictions.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-varying-packing-restrictions.html
new file mode 100644
index 0000000000..741ad7b63f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-varying-packing-restrictions.html
@@ -0,0 +1,188 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL varying packing restrictions Conformance Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="example" width="2" height="2"> </canvas>
+<script id="vshaderArrayTest" type="x-shader/x-vertex">
+attribute vec4 a_position;
+varying $(type) v_varying[$(numTestType)];
+void main()
+{
+ gl_Position = a_position;
+ $(vcode)
+}
+</script>
+<script id="fshaderArrayTest" type="x-shader/x-fragment">
+precision mediump float;
+varying $(type) v_varying[$(numTestType)];
+void main()
+{
+ gl_FragColor = $(fcode);
+}
+</script>
+<script id="vshaderVaryingTest" type="x-shader/x-fragment">
+attribute vec4 a_position;
+$(varyings)
+void main()
+{
+ gl_Position = a_position;
+ $(vcode)
+}
+</script>
+<script id="fshaderVaryingTest" type="x-shader/x-fragment">
+precision mediump float;
+$(varyings)
+void main()
+{
+ gl_FragColor = $(fcode);
+}
+</script>
+<script>
+"use strict";
+description();
+debug("");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+
+var varyingTypes = [
+ { type: "float", componentsPerRow: 1, rows: 1, vcode: "v_varying$(id)$(index) = 1.0;", fcode: "vec4(v_varying$(id)$(index), 0, 0, 0)", },
+ { type: "vec2", componentsPerRow: 2, rows: 1, vcode: "v_varying$(id)$(index) = vec2(0, 0);", fcode: "vec4(v_varying$(id)$(index), 0, 0)", },
+ { type: "vec3", componentsPerRow: 3, rows: 1, vcode: "v_varying$(id)$(index) = vec3(0, 0, 0);", fcode: "vec4(v_varying$(id)$(index), 0)", },
+ { type: "vec4", componentsPerRow: 4, rows: 1, vcode: "v_varying$(id)$(index) = vec4(0, 0, 0, 0);", fcode: "vec4(v_varying$(id)$(index))", },
+// Yes, the spec says mat2 takes 4 columns, 2 rows.
+ { type: "mat2", componentsPerRow: 4, rows: 2, vcode: "v_varying$(id)$(index) = mat2(1.0);", fcode: "vec4(v_varying$(id)$(index)[0], 0, 0)", },
+ { type: "mat3", componentsPerRow: 3, rows: 3, vcode: "v_varying$(id)$(index) = mat3(1.0);", fcode: "vec4(v_varying$(id)$(index)[0], 0)", },
+ { type: "mat4", componentsPerRow: 4, rows: 4, vcode: "v_varying$(id)$(index) = mat4(1.0);", fcode: "vec4(v_varying$(id)$(index)[0])", },
+];
+
+var vArrayTestSource = wtu.getScript("vshaderArrayTest");
+var fArrayTestSource = wtu.getScript("fshaderArrayTest");
+var vVaryingTestSource = wtu.getScript("vshaderVaryingTest");
+var fVaryingTestSource = wtu.getScript("fshaderVaryingTest");
+
+var minVaryingVectors = 8;
+var maxVaryingVectors = gl.getParameter(gl.MAX_VARYING_VECTORS);
+var tests = [];
+
+for (var ii = 0; ii < varyingTypes.length; ++ii) {
+ var info = varyingTypes[ii];
+ wtu.log("checking: " + info.type);
+ // Compute the maximum amount of this type allowed in a single array.
+ var numVars = Math.floor(maxVaryingVectors / info.rows);
+ // Compute the minimum required to work in a single array.
+ var minVars = Math.floor(minVaryingVectors / info.rows);
+ // Compute the maximum allowed as single elements
+ var numPerRow = Math.floor(4 / info.componentsPerRow);
+ var numMax = Math.floor(maxVaryingVectors * numPerRow / info.rows);
+
+ // Test array[1] of the type
+ var vcode = wtu.replaceParams(info.vcode, {id: "", index: "[0]"});
+ var fcode = wtu.replaceParams(info.fcode, {id: "", index: "[0]"});
+ tests.push({
+ vShaderSource: wtu.replaceParams(vArrayTestSource, {numTestType: 1, vcode: vcode}, info),
+ vShaderSuccess: true,
+ fShaderSource: wtu.replaceParams(fArrayTestSource, {numTestType: 1, fcode: fcode}, info),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "shaders with varying array of " + info.type + " with 1 element should succeed",
+ });
+
+ // Test required number of varyings
+ var vcode = wtu.replaceParams(info.vcode, {id: "", index: "[" + (minVars - 1) + "]"});
+ var fcode = wtu.replaceParams(info.fcode, {id: "", index: "[" + (minVars - 1) + "]"});
+ tests.push({
+ vShaderSource: wtu.replaceParams(vArrayTestSource, {numTestType: minVars, vcode: vcode}, info),
+ vShaderSuccess: true,
+ fShaderSource: wtu.replaceParams(fArrayTestSource, {numTestType: minVars, fcode: fcode}, info),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "shaders with varying array of " + info.type + " with " + minVars + " elements (the minimum required) should succeed",
+ });
+
+ // Test array[max + 1] accessing last element. WebGL requires this to fail.
+ var vcode = wtu.replaceParams(info.vcode, {id: "", index: "[" + numVars + "]"});
+ var fcode = wtu.replaceParams(info.fcode, {id: "", index: "[" + numVars + "]"});
+ tests.push({
+ vShaderSource: wtu.replaceParams(vArrayTestSource, {numTestType: numVars + 1, vcode: vcode}, info),
+ vShaderSuccess: false,
+ fShaderSource: wtu.replaceParams(fArrayTestSource, {numTestType: numVars + 1, fcode: fcode}, info),
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "shaders with varying array of " + info.type + " with " + (numVars + 1) + " elements (one past maximum) accessing last element should fail",
+ });
+
+ // Test array[max + 1] accessing first element. WebGL requires this to fail but ES allows truncating array.
+ var vcode = wtu.replaceParams(info.vcode, {id: "", index: "[0]"});
+ var fcode = wtu.replaceParams(info.fcode, {id: "", index: "[0]"});
+ tests.push({
+ vShaderSource: wtu.replaceParams(vArrayTestSource, {numTestType: numVars + 1, vcode: vcode}, info),
+ vShaderSuccess: false,
+ fShaderSource: wtu.replaceParams(fArrayTestSource, {numTestType: numVars + 1, fcode: fcode}, info),
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "shaders with varying array of " + info.type + " with " + (numVars + 1) + " elements (one past maximum) accessing first element should fail",
+ });
+
+ // Note: We can't test max varyings as actual GL drivers are only required to be able to
+ // do the minimum number. After that it can fail for any reason, for example running out of
+ // instruction space.
+
+ var generateCode = function(numVars) {
+ var varyings = [];
+ var vcodes = [];
+ var fcodes = [];
+ for (var uu = 0; uu < numVars; ++uu) {
+ varyings.push(" varying " + info.type + " v_varying" + uu + ";");
+ vcodes.push(wtu.replaceParams(info.vcode, {id: uu, index: ""}));
+ fcodes.push(wtu.replaceParams(info.fcode, {id: uu, index: ""}));
+ }
+ return {
+ varyings: varyings.join("\n"),
+ vcode: vcodes.join("\n "),
+ fcode: fcodes.join(" + \n "),
+ };
+ };
+
+ // Test max+1 varyings of type.
+ tests.push({
+ vShaderSource: wtu.replaceParams(vVaryingTestSource, generateCode(numMax + 1), info),
+ vShaderSuccess: false,
+ fShaderSource: wtu.replaceParams(fVaryingTestSource, generateCode(numMax + 1), info),
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "shaders with " + (numMax + 1) + " varyings of " + info.type + " (one past maximum) should fail",
+ });
+
+ // Test required varyings of type.
+ tests.push({
+ vShaderSource: wtu.replaceParams(vVaryingTestSource, generateCode(minVars), info),
+ vShaderSuccess: true,
+ fShaderSource: wtu.replaceParams(fVaryingTestSource, generateCode(minVars), info),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "shaders with " + minVars + " varyings of " + info.type + " (the minimum required) should succeed",
+ });
+}
+
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-define.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-define.html
new file mode 100644
index 0000000000..9ed15009b5
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-define.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses 256 character token in #define should succeed
+#define LEN_256_OK XxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX
+
+void main()
+{
+ gl_Position = vec4(1.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-identifier.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-identifier.frag.html
new file mode 100644
index 0000000000..66112ded1d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-256-character-identifier.frag.html
@@ -0,0 +1,105 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader256" type="text/something-not-javascript">
+// shader that uses 256 character identifier should succeed
+precision mediump float;
+uniform float a123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345;
+void main()
+{
+ gl_FragColor = vec4(a123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345,0.0,0.0,1.0);
+}
+</script>
+<script id="fragmentShader_before" type="text/something-not-javascript">
+// shader that uses 256 character identifier that starts with underscore should succeed
+precision mediump float;
+uniform float _a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234;
+void main()
+{
+ gl_FragColor = vec4(_a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234,0.0,0.0,1.0);
+}
+</script>
+<script id="fragmentShader_after" type="text/something-not-javascript">
+// shader that uses 256 character identifier that ends with underscore should succeed
+precision mediump float;
+uniform float a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234_;
+void main()
+{
+ gl_FragColor = vec4(a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234_,0.0,0.0,1.0);
+}
+</script>
+<script id="fragmentShader256_odd" type="text/something-not-javascript">
+// shader that uses 256 character identifier with odd characters as underscores should succeed
+precision mediump float;
+uniform float a_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_;
+void main()
+{
+ gl_FragColor = vec4(a_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_6_8_0_2_4_,0.0,0.0,1.0);
+}
+</script>
+<script id="fragmentShader256_even" type="text/something-not-javascript">
+// shader that uses 256 character identifier with even characters as underscores should succeed
+precision mediump float;
+uniform float a1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5;
+void main()
+{
+ gl_FragColor = vec4(a1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5_7_9_1_3_5,0.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ {
+ fShaderId: 'fragmentShader256',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shader with 256 character identifier should succeed'
+ },
+ {
+ fShaderId: 'fragmentShader_before',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shader with 256 character identifier that starts with underscore should succeed'
+ },
+ {
+ fShaderId: 'fragmentShader_after',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shader with 256 character identifier that ends with underscore should succeed'
+ },
+ {
+ fShaderId: 'fragmentShader256_odd',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shader with 256 character identifier with odd characters as underscores should succeed'
+ },
+ {
+ fShaderId: 'fragmentShader256_even',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shader with 256 character identifier with even characters as underscores should succeed'
+ }
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-define.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-define.html
new file mode 100644
index 0000000000..0d43c280e4
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-define.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses 257 character token in #define should fail
+#define LEN_257_BAD XxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX
+
+void main()
+{
+ gl_Position = vec4(1.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-identifier.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-identifier.frag.html
new file mode 100644
index 0000000000..e3b70e99e8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-257-character-identifier.frag.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// shader that uses 257 character identifier should fail
+precision mediump float;
+uniform float a1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
+void main()
+{
+ gl_FragColor = vec4(a1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456,0.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-_webgl-identifier.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-_webgl-identifier.vert.html
new file mode 100644
index 0000000000..cbd2191902
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-_webgl-identifier.vert.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses _webgl identifier should fail
+attribute vec4 _webgl_vPosition;
+void main()
+{
+ gl_Position = _webgl_vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.frag.html
new file mode 100644
index 0000000000..778375dc01
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.frag.html
@@ -0,0 +1,41 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with arbitrary indexing expression should fail
+// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
+precision mediump float;
+
+uniform vec4 u_colors[8];
+varying float a_index;
+
+void main()
+{
+ int index = int(floor(a_index));
+ gl_FragColor = u_colors[index];
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.vert.html
new file mode 100644
index 0000000000..eedbf67244
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-arbitrary-indexing.vert.html
@@ -0,0 +1,40 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader with arbitrary indexing expression should succeed
+// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
+uniform mat4 u_matrices[8];
+attribute vec4 a_vertex;
+attribute float a_index;
+
+void main()
+{
+ int index = int(floor(a_index));
+ gl_Position = u_matrices[index] * a_vertex;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html
new file mode 100644
index 0000000000..e4acce11fc
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html
@@ -0,0 +1,133 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL Array of Structs Containing Arrays</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="fshader0" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color[2];
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = u_colors[0].color[0];
+}
+</script>
+<script id="fshader1" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color[2];
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = u_colors[0].color[1];
+}
+</script>
+<script id="fshader-with-one-element-arrays" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color[1];
+};
+uniform my_struct u_colors[1];
+void main(void) {
+ gl_FragColor = u_colors[0].color[0];
+}
+</script>
+<script id="fshader3" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color1[2];
+ vec4 color2[2];
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = u_colors[0].color1[0] + u_colors[0].color2[0] + u_colors[1].color1[1] +u_colors[1].color2[1];
+}
+</script>
+</head>
+<body>
+<canvas id="canvas" width="50" height="50"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description();
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("canvas");
+wtu.setupUnitQuad(gl);
+
+for (var ii = 0; ii < 2; ++ii) {
+ var program = wtu.setupProgram(gl, ["vshader", "fshader" + ii], ["a_position"]);
+ var red_loc = gl.getUniformLocation(program, "u_colors[0].color[" + ii + "]");
+ var green_loc = gl.getUniformLocation(program, "u_colors[0].color[" + (1 - ii) + "]");
+ gl.uniform4fv(red_loc, [1, 0, 0, 1]);
+ gl.uniform4fv(green_loc, [0, 1, 0, 1]);
+ wtu.clearAndDrawUnitQuad(gl);
+ wtu.checkCanvas(gl, [255, 0, 0, 255], "Should be red");
+}
+
+var program = wtu.setupProgram(gl, ["vshader", "fshader-with-one-element-arrays"], ["a_position"]);
+var green_loc = gl.getUniformLocation(program, "u_colors[0].color[0]");
+gl.uniform4fv(green_loc, [0, 1, 0, 1]);
+wtu.clearAndDrawUnitQuad(gl);
+wtu.checkCanvas(gl, [0, 255, 0, 255], "Should be green");
+
+var program = wtu.setupProgram(gl, ["vshader", "fshader3"], ["a_position"]);
+var numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
+shouldBe("numUniforms", "4");
+var uniforms = []
+for (var ii = 0; ii < numUniforms; ++ii) {
+ uniforms.push(gl.getActiveUniform(program, ii).name);
+}
+uniforms.sort();
+shouldBe("uniforms[0]", '"u_colors[0].color1[0]"');
+shouldBe("uniforms[1]", '"u_colors[0].color2[0]"');
+shouldBe("uniforms[2]", '"u_colors[1].color1[0]"');
+shouldBe("uniforms[3]", '"u_colors[1].color2[0]"');
+var loc00 = gl.getUniformLocation(program, "u_colors[0].color1");
+var loc01 = gl.getUniformLocation(program, "u_colors[0].color2");
+var loc10 = gl.getUniformLocation(program, "u_colors[1].color1");
+var loc11 = gl.getUniformLocation(program, "u_colors[1].color2");
+shouldBeTrue("loc00 != undefined");
+shouldBeTrue("loc01 != undefined");
+shouldBeTrue("loc10 != undefined");
+shouldBeTrue("loc11 != undefined");
+gl.uniform4fv(loc00, [1, 0, 0, 0]);
+gl.uniform4fv(loc01, [0, 1, 0, 0]);
+gl.uniform4fv(loc10, [0, 0, 0, 0, 0, 0, 1, 0]);
+gl.uniform4fv(loc11, [0, 0, 0, 0, 0, 0, 0, 1]);
+var loc101 = gl.getUniformLocation(program, "u_colors[1].color1[1]");
+var loc111 = gl.getUniformLocation(program, "u_colors[1].color2[1]");
+shouldBeTrue("loc101 != undefined");
+shouldBeTrue("loc111 != undefined");
+wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 0]);
+gl.uniform4fv(loc101, [0, 0, 0, 0]);
+gl.uniform4fv(loc111, [0, 0, 0, 0]);
+wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 0]);
+wtu.checkCanvas(gl, [255, 255, 0, 0], "Should be yellow");
+
+wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-uniform.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-uniform.html
new file mode 100644
index 0000000000..87560e3e70
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-array-of-structs-uniform.html
@@ -0,0 +1,145 @@
+
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL Array of Structs Uniform</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="fshader0" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color;
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = u_colors[0].color;
+}
+</script>
+<script id="fshader1" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color;
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = u_colors[1].color;
+}
+</script>
+<script id="fshader2" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec4 color1;
+ vec4 color2;
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = u_colors[0].color1 + u_colors[0].color2 + u_colors[1].color1 +u_colors[1].color2;
+}
+</script>
+<script id="fshader3" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ float r;
+ float g;
+ float b;
+ float a;
+};
+uniform my_struct u_colors[2];
+void main(void) {
+ gl_FragColor = vec4(u_colors[0].r, u_colors[0].g, u_colors[1].b, u_colors[1].a);
+}
+</script>
+</head>
+<body>
+<canvas id="canvas" width="50" height="50"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description();
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("canvas");
+wtu.setupUnitQuad(gl);
+
+for (var ii = 0; ii < 2; ++ii) {
+ var program = wtu.setupProgram(gl, ["vshader", "fshader" + ii], ["a_position"]);
+ var red_loc = gl.getUniformLocation(program, "u_colors[" + ii + "].color");
+ var green_loc = gl.getUniformLocation(program, "u_colors[" + (1 - ii) + "].color");
+ gl.uniform4fv(red_loc, [1, 0, 0, 1]);
+ gl.uniform4fv(green_loc, [0, 1, 0, 1]);
+ wtu.clearAndDrawUnitQuad(gl);
+ wtu.checkCanvas(gl, [255, 0, 0, 255], "Should be red");
+}
+
+var program = wtu.setupProgram(gl, ["vshader", "fshader2"], ["a_position"]);
+var numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
+shouldBe("numUniforms", "4");
+var uniforms = []
+for (var ii = 0; ii < numUniforms; ++ii) {
+ uniforms.push(gl.getActiveUniform(program, ii).name);
+}
+uniforms.sort();
+shouldBe("uniforms[0]", '"u_colors[0].color1"');
+shouldBe("uniforms[1]", '"u_colors[0].color2"');
+shouldBe("uniforms[2]", '"u_colors[1].color1"');
+shouldBe("uniforms[3]", '"u_colors[1].color2"');
+var loc00 = gl.getUniformLocation(program, "u_colors[0].color1");
+var loc01 = gl.getUniformLocation(program, "u_colors[0].color2");
+var loc10 = gl.getUniformLocation(program, "u_colors[1].color1");
+var loc11 = gl.getUniformLocation(program, "u_colors[1].color2");
+shouldBeTrue("loc00 != undefined");
+shouldBeTrue("loc01 != undefined");
+shouldBeTrue("loc10 != undefined");
+shouldBeTrue("loc11 != undefined");
+gl.uniform4fv(loc00, [1, 0, 0, 0]);
+gl.uniform4fv(loc01, [0, 1, 0, 0]);
+gl.uniform4fv(loc10, [0, 0, 1, 0]);
+gl.uniform4fv(loc11, [0, 0, 0, 1]);
+wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 0]);
+wtu.checkCanvas(gl, [255, 255, 255, 255], "Should be white");
+
+program = wtu.setupProgram(gl, ["vshader", "fshader3"], ["a_position"]);
+var loc0r = gl.getUniformLocation(program, "u_colors[0].r");
+var loc0g = gl.getUniformLocation(program, "u_colors[0].g");
+var loc0b = gl.getUniformLocation(program, "u_colors[0].b");
+var loc0a = gl.getUniformLocation(program, "u_colors[0].a");
+var loc1r = gl.getUniformLocation(program, "u_colors[1].r");
+var loc1g = gl.getUniformLocation(program, "u_colors[1].g");
+var loc1b = gl.getUniformLocation(program, "u_colors[1].b");
+var loc1a = gl.getUniformLocation(program, "u_colors[1].a");
+shouldBeTrue("loc0r != undefined");
+shouldBeTrue("loc0g != undefined");
+shouldBeTrue("loc1b != undefined");
+shouldBeTrue("loc1a != undefined");
+gl.uniform1f(loc0r, 1);
+gl.uniform1f(loc0g, 1);
+gl.uniform1f(loc1b, 1);
+gl.uniform1f(loc1a, 1);
+wtu.clearAndDrawUnitQuad(gl, [0, 0, 0, 0]);
+wtu.checkCanvas(gl, [255, 255, 255, 255], "Should be white");
+
+wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-array.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-array.vert.html
new file mode 100644
index 0000000000..14b1ffb189
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-array.vert.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses attribute array should fail as per GLSL page 110, appendix A, section 5
+attribute vec4 vPosition[2];
+void main()
+{
+ gl_Position = vPosition[0] + vPosition[1];
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-struct.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-struct.vert.html
new file mode 100644
index 0000000000..f8069d11b2
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-attrib-struct.vert.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses attribute struct should fail per GLSL ES section 4.4.3, "Attribute", p. 30
+struct UserType {
+ attribute vec4 position;
+};
+
+attribute UserType userAttr;
+void main()
+{
+ gl_Position = userAttr.position;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-clipvertex.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-clipvertex.vert.html
new file mode 100644
index 0000000000..3c9d302854
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-clipvertex.vert.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses gl_ClipVertex should fail
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+ gl_ClipVertex = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-assignment.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-assignment.html
new file mode 100644
index 0000000000..70816d4173
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-assignment.html
@@ -0,0 +1,41 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with comma assignment should succeed
+precision mediump float;
+void main() {
+ float a = 0.0;
+ float b = 0.0;
+ float c = 0.0;
+ float d = 0.0;
+ a = 1.1, b = 3.1;
+ c = 2.1, d = 4.1;
+ // Output green if successful, red if not.
+ gl_FragColor = ((a + b + c + d > 10.0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runRenderTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-conditional-assignment.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-conditional-assignment.html
new file mode 100644
index 0000000000..ec672d569e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-conditional-assignment.html
@@ -0,0 +1,192 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShaderAGreaterThanBCheckR" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 3.0;
+ float b = 2.0;
+ float r = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (r = r0, a) : (r = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((r == r0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderAGreaterThanBCheckAB" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 3.0;
+ float b = 2.0;
+ float r = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (r = r0, a) : (r = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((ab == a) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderAGreaterThanBCheckT0" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 3.0;
+ float b = 2.0;
+ float t0 = 0.0;
+ float t1 = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((t0 == r0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderAGreaterThanBCheckT1" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 3.0;
+ float b = 2.0;
+ float t0 = 0.0;
+ float t1 = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((t1 == 0.0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderBGreaterThanACheckR" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 2.0;
+ float b = 3.0;
+ float r = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (r = r0, a) : (r = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((r == r1) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderBGreaterThanACheckAB" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 2.0;
+ float b = 3.0;
+ float r = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (r = r0, a) : (r = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((ab == b) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderBGreaterThanACheckT0" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 2.0;
+ float b = 3.0;
+ float t0 = 0.0;
+ float t1 = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((t0 == 0.0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script id="fragmentShaderBGreaterThanACheckT1" type="text/something-not-javascript">
+// fragment shader with for scoping should succeed
+precision mediump float;
+void main() {
+ float a = 2.0;
+ float b = 3.0;
+ float t0 = 0.0;
+ float t1 = 0.0;
+ float r0 = 0.5;
+ float r1 = 1.0;
+ float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
+ // Output green if successful, red if not.
+ gl_FragColor = ((t1 == r1) ? vec4(0,1,0,1) : vec4(1,0,0,1));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runRenderTests([
+{
+ fShaderId: 'fragmentShaderAGreaterThanBCheckR',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderAGreaterThanBCheckAB',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderAGreaterThanBCheckT0',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderAGreaterThanBCheckT1',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderBGreaterThanACheckR',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderBGreaterThanACheckAB',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderBGreaterThanACheckT0',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+},
+{
+ fShaderId: 'fragmentShaderBGreaterThanACheckT1',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "comma based conditional assignment works",
+}
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-separated-variable-declarations.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-separated-variable-declarations.html
new file mode 100644
index 0000000000..b63a10ae5d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-comma-separated-variable-declarations.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// shader with comma separated uniform variable declarations should succeed
+precision mediump float;
+
+uniform float x, y;
+
+void main() {
+ gl_FragColor = vec4(x, y, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping-negative.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping-negative.html
new file mode 100644
index 0000000000..7d5826cf9c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping-negative.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with illegal references to conditionally scoped variables should fail
+precision mediump float;
+void main() {
+ int k = 3;
+
+ if (true) int g = k = 4;
+ else int q = k = 5;
+
+ g = 3; // should error
+ q = 4; // should error
+
+ gl_FragColor = vec4(1.);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping.html
new file mode 100644
index 0000000000..31b705dfea
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-conditional-scoping.html
@@ -0,0 +1,45 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with conditional scoping should succeed
+precision mediump float;
+void main() {
+ int k = 3;
+
+ if (true) int g = k = 4;
+ else int q = k = 5;
+
+ if (true) int g = 4;
+ else int k = 10;
+
+ if (true) { int g = 10; }
+ else { int k = 20; }
+
+ gl_FragColor = vec4(1.);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.frag.html
new file mode 100644
index 0000000000..b03af46f4f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.frag.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with default precision should succeed
+precision mediump float;
+precision mediump int;
+precision lowp sampler2D;
+precision lowp samplerCube;
+void main()
+{
+ gl_FragColor = vec4(1.0,0.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.vert.html
new file mode 100644
index 0000000000..a8f43ec6f8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-default-precision.vert.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader with default precision should succeed
+precision mediump float;
+precision mediump int;
+precision lowp sampler2D;
+precision lowp samplerCube;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx-no-ext.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx-no-ext.frag.html
new file mode 100644
index 0000000000..50803c92ac
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx-no-ext.frag.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that uses dFdx without #extension should fail
+precision mediump float;
+void main()
+{
+ gl_FragColor = vec4(dFdx(0.5),0.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx.frag.html
new file mode 100644
index 0000000000..0636867932
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-dfdx.frag.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that uses dFdx should fail
+#extension GL_OES_standard_derivatives:enable
+precision mediump float;
+void main()
+{
+ gl_FragColor = vec4(dFdx(0.5),0.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-do-loop.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-do-loop.html
new file mode 100644
index 0000000000..76643dd3c0
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-do-loop.html
@@ -0,0 +1,40 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with do loop should fail
+precision mediump float;
+void main() {
+ int k = 0;
+ do {
+ k++;
+ } while (k < 5);
+ gl_FragColor = vec4(float(k));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-error-directive.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-error-directive.html
new file mode 100644
index 0000000000..fec151fc81
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-error-directive.html
@@ -0,0 +1,51 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fshaderWithErrorDirective" type="text/something-not-javascript">
+#error testing123 testing123
+void main()
+{
+ gl_FragColor = vec4(0,0,0,0);
+}
+</script>
+<script>
+"use strict";
+description("Checks shader with error directive");
+
+var wtu = WebGLTestUtils;
+GLSLConformanceTester.runTests([
+{ vShaderId: undefined,
+ vShaderSuccess: true,
+ fShaderId: 'fshaderWithErrorDirective',
+ fShaderSuccess: false,
+ // We can't test for the actual error message as
+ // GLSL 1.0.17 11 says the messages are implementation dependant.
+ //fShaderTest: (function() {
+ // return wtu.getLastError().indexOf("testing123 testing123") >= 0; }),
+ linkSuccess: false,
+ passMsg: "error directive causes error",
+},
+]);
+
+debug("");
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-explicit-int-cast.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-explicit-int-cast.vert.html
new file mode 100644
index 0000000000..908dc9fb03
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-explicit-int-cast.vert.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that explicit int to float cast should succeed
+attribute vec4 vPosition;
+void main()
+{
+ int k = 123;
+ gl_Position = vec4(vPosition.x, vPosition.y, vPosition.z, float(k));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-float-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-float-return-value.frag.html
new file mode 100644
index 0000000000..04362b86c1
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-float-return-value.frag.html
@@ -0,0 +1,46 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with float return value from function call should succeed
+precision mediump float;
+
+float functionResult();
+
+void main()
+{
+ float r = functionResult();
+ gl_FragColor = vec4(r, r, r, r);
+}
+
+float functionResult()
+{
+ return 1.0;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-loop.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-loop.html
new file mode 100644
index 0000000000..cf11a88d9f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-loop.html
@@ -0,0 +1,83 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with for loop should succeed
+
+// TODO(gman): trim to min size to test bug.
+precision mediump float;
+uniform float time;
+uniform vec2 resolution;
+
+// Saw-tooth function that is synced with the demo music (128bpm)
+float gBeat;
+
+// Calculate the surface color
+vec3 surfColor(vec2 p)
+{
+ vec2 q=vec2(sin(.08*p.x),4.*p.y);
+ vec3 c=vec3(0);
+ for(float i=0.;i<15.;i++)
+ c+=(1.+sin(i*sin(time)+vec3(0.,1.3,2.2)))*.2/length(q-vec2(sin(i),12.*sin(.3*time+i)));
+ return c+vec3(mix(mod(floor(p.x*.2)+floor(p.y*2.2),2.),.2,gBeat));
+}
+
+// Ray trace (cylinder)
+vec3 trace(vec3 o,vec3 d)
+{
+ d.y*=.65+.1*sin(.5*time);
+ float D=1./(d.y*d.y+d.z*d.z),
+ a=(o.y*d.y+o.z*d.z)*D,
+ b=(o.y*o.y+o.z*o.z-36.)*D,
+ t=-a-sqrt(a*a-b);
+ o+=t*d;
+ return surfColor(vec2(o.x,atan(o.y,o.z)))*(1.+.01*t);
+}
+
+void main()
+{
+ gBeat=fract(time*3.2/3.);
+ // Screen setup
+ vec2 p=(2.*gl_FragCoord.xy-resolution)/resolution.y,
+ q=2.*gl_FragCoord.xy/resolution-1.;
+
+ // Camera setup
+ vec3 cp=vec3(-time*20.+1.,1.6*sin(time*1.2),2.+2.*cos(time*.3)),
+ ct=cp+vec3(1.,.3*cos(time),-.2),
+ cd=normalize(ct-cp),
+ cr=normalize(cross(cd,vec3(.5*cos(.3*time),0.,1.))),
+ cu=cross(cr,cd),
+ rd=normalize(2.*cd+cr*p.x+cu*p.y);
+
+ // Trace! (+some funky lens/raster effects)
+ vec3 c=trace(cp,rd)*
+ min(1.,1.8-dot(q,q))*
+ (.9+.1*sin(3.*sin(gBeat)*gl_FragCoord.y));
+
+ gl_FragColor=vec4(c,1);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-scoping.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-scoping.html
new file mode 100644
index 0000000000..c4d9620fd5
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-for-scoping.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with illegal for scoping should fail
+precision mediump float;
+void main() {
+ int k = 0;
+ for (int i = 0; i < 10; i++) { int i = k+i; } // not a nested scope, in i's scope, nesting already happened
+ gl_FragColor = vec4(float(k));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-frag-depth.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-frag-depth.frag.html
new file mode 100644
index 0000000000..48454492c4
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-frag-depth.frag.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that uses gl_FragDepth should fail
+precision mediump float;
+void main()
+{
+ gl_FragColor = vec4(0.0,0.0,0.0,1.0);
+ gl_FragDepth = 1.0;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-recursion.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-recursion.frag.html
new file mode 100644
index 0000000000..dfa12e471a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-recursion.frag.html
@@ -0,0 +1,45 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// shader with recursive function calls should fail
+void a();
+void b();
+void main()
+{
+ a();
+ gl_FragColor = vec4(0,0,0,0);
+}
+void a()
+{
+ b();
+}
+void b()
+{
+ a();
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-scoped-struct.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-scoped-struct.html
new file mode 100644
index 0000000000..be694ae5ee
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-function-scoped-struct.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with private function scoped struct should fail.
+precision mediump float;
+int fun2(struct s { int m; } g) { return g.m; }
+
+s a;
+
+void main() {
+ int e = fun2(s(3));
+
+ gl_FragColor = vec4(1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-functional-scoping.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-functional-scoping.html
new file mode 100644
index 0000000000..c18f3cc495
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-functional-scoping.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with invalid functional scoping should fail
+precision mediump float;
+int f(int k) {
+ int k = k + 3;
+ return k;
+}
+
+void main() {
+ gl_FragColor = vec4(f(100));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glcolor.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glcolor.vert.html
new file mode 100644
index 0000000000..52cd783902
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glcolor.vert.html
@@ -0,0 +1,35 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses gl_Color should fail
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = gl_Color;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-1.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-1.frag.html
new file mode 100644
index 0000000000..bc8a7b3a8d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-1.frag.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that expects GL_ES == 1 should succeed
+#if GL_ES == 1
+ precision mediump float;
+ void main()
+ {
+ gl_FragColor = vec4(0.0,0.0,0.0,1.0);
+ }
+#else
+ foo
+#endif
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-symbol.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-symbol.frag.html
new file mode 100644
index 0000000000..b569958f5a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-gles-symbol.frag.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that uses GL_ES preprocessor symbol should succeed
+#if defined(GL_ES)
+ precision mediump float;
+ void main()
+ {
+ gl_FragColor = vec4(0.0,0.0,0.0,1.0);
+ }
+#else
+ foo
+#endif
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-global-variable-precision-mismatch.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-global-variable-precision-mismatch.html
new file mode 100644
index 0000000000..6303915f30
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-global-variable-precision-mismatch.html
@@ -0,0 +1,128 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fshaderWithMediumpGlobal" type="text/something-not-javascript">
+// There is no default float precision in fragment shaders, so specify mediump.
+precision mediump float;
+
+uniform vec4 foo;
+
+void main()
+{
+ gl_FragColor = foo;
+}
+</script>
+<script id="fshaderWithMediumpGlobalInt" type="text/something-not-javascript">
+// Default precision for int in fragment shaders is mediump.
+uniform int foo;
+
+void main()
+{
+ gl_FragColor = vec4(foo, 0, 0, 1);
+}
+</script>
+<script id="fshaderWithMediumpGlobalStruct" type="text/something-not-javascript">
+// There is no default float precision in fragment shaders, so specify mediump.
+precision mediump float;
+
+struct foo
+{
+ vec4 bar;
+};
+
+uniform foo baz;
+
+void main()
+{
+ gl_FragColor = baz.bar;
+}
+</script>
+<script id="vshaderWithHighpGlobal" type="x-shader/x-vertex">
+// Default precision for vertex shaders is highp.
+uniform vec4 foo;
+
+void main() {
+ gl_Position = foo;
+}
+</script>
+<script id="vshaderWithHighpGlobalInt" type="x-shader/x-vertex">
+// Default precision for int in vertex shaders is highp.
+uniform int foo;
+
+void main() {
+ gl_Position = vec4(foo, 0, 0, 1);
+}
+</script>
+<script id="vshaderWithHighpGlobalStruct" type="x-shader/x-vertex">
+// Default precision for vertex shaders is highp.
+struct foo
+{
+ vec4 bar;
+};
+
+uniform foo baz;
+
+void main()
+{
+ gl_Position = baz.bar;
+}
+</script>
+<script>
+"use strict";
+description("Checks shaders with global variables and precision qualifier mismatch.");
+
+var wtu = WebGLTestUtils;
+
+var glslTests = [];
+
+glslTests.push({
+ vShaderId: 'vshaderWithHighpGlobal',
+ vShaderSuccess: true,
+ fShaderId: 'fshaderWithMediumpGlobal',
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "mismatching precision for uniforms causes link error (as expected)",
+});
+
+glslTests.push({
+ vShaderId: 'vshaderWithHighpGlobalInt',
+ vShaderSuccess: true,
+ fShaderId: 'fshaderWithMediumpGlobalInt',
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "mismatching precision for int uniforms with default precision causes link error (as expected)",
+});
+
+glslTests.push({
+ vShaderId: 'vshaderWithHighpGlobalStruct',
+ vShaderSuccess: true,
+ fShaderId: 'fshaderWithMediumpGlobalStruct',
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "mismatching precision for structure uniforms causes link error (as expected)",
+});
+
+GLSLConformanceTester.runTests(glslTests);
+
+debug("");
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glprojectionmatrix.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glprojectionmatrix.vert.html
new file mode 100644
index 0000000000..9387918f1a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-glprojectionmatrix.vert.html
@@ -0,0 +1,35 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses gl_ProjectionMatrix should fail
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition * gl_ProjectionMatrix;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-hex-int-constant-macro.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-hex-int-constant-macro.html
new file mode 100644
index 0000000000..7a9ed875b2
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-hex-int-constant-macro.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader uses the long integer constant should succeed
+attribute vec4 vPosition;
+void main()
+{
+ #define TEST 0x1F
+ int a = TEST;
+
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.frag.html
new file mode 100644
index 0000000000..04902c50db
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.frag.html
@@ -0,0 +1,238 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShaderVoid" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump void;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderBool" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump bool;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderVec2" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump vec2;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderVec3" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump vec3;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderVec4" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump vec4;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderBvec2" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump bvec2;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderBvec3" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump bvec3;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderBvec4" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump bvec4;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderIvec2" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump ivec2;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderIvec3" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump ivec3;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderIvec4" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump ivec4;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderMat2" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump mat2;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderMat3" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump mat3;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script id="fragmentShaderMat4" type="text/something-not-javascript">
+// fragment shader with default precision for illegal type should fail
+precision mediump mat4;
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ {
+ fShaderId: 'fragmentShaderVoid',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for void should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderBool',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bool should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderVec2',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for vec2 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderVec3',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for vec3 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderVec4',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for vec4 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderBvec2',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bvec2 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderBvec3',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bvec3 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderBvec4',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bvec4 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderIvec2',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for ivec2 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderIvec3',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for ivec3 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderIvec4',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for ivec4 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderMat2',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for mat2 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderMat3',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for mat3 should fail'
+ },
+ {
+ fShaderId: 'fragmentShaderMat4',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for mat4 should fail'
+ }
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.vert.html
new file mode 100644
index 0000000000..5710fddfd5
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-illegal-default-precision.vert.html
@@ -0,0 +1,224 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShaderVoid" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump void;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderBool" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump bool;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderVec2" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump vec2;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderVec3" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump vec3;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderVec4" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump vec4;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderBvec2" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump bvec2;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderBvec3" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump bvec3;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderBvec4" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump bvec4;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderIvec2" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump ivec2;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderIvec3" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump ivec3;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderIvec4" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump ivec4;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderMat2" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump mat2;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderMat3" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump mat3;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script id="vertexShaderMat4" type="text/something-not-javascript">
+// vertex shader with default precision for illegal type should fail
+precision mediump mat4;
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ { vShaderId: 'vertexShaderVoid',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for void should fail'
+ },
+ { vShaderId: 'vertexShaderBool',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bool should fail'
+ },
+ { vShaderId: 'vertexShaderVec2',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for vec2 should fail'
+ },
+ { vShaderId: 'vertexShaderVec3',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for vec3 should fail'
+ },
+ { vShaderId: 'vertexShaderVec4',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for vec4 should fail'
+ },
+ { vShaderId: 'vertexShaderBvec2',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bvec2 should fail'
+ },
+ { vShaderId: 'vertexShaderBvec3',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bvec3 should fail'
+ },
+ { vShaderId: 'vertexShaderBvec4',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for bvec4 should fail'
+ },
+ { vShaderId: 'vertexShaderIvec2',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for ivec2 should fail'
+ },
+ { vShaderId: 'vertexShaderIvec3',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for ivec3 should fail'
+ },
+ { vShaderId: 'vertexShaderIvec4',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for ivec4 should fail'
+ },
+ { vShaderId: 'vertexShaderMat2',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for mat2 should fail'
+ },
+ { vShaderId: 'vertexShaderMat3',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for mat3 should fail'
+ },
+ { vShaderId: 'vertexShaderMat4',
+ vShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: 'shader with default precision for mat4 should fail'
+ }
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-implicit-vec3-to-vec4-cast.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-implicit-vec3-to-vec4-cast.vert.html
new file mode 100644
index 0000000000..c77a3e1915
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-implicit-vec3-to-vec4-cast.vert.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that implicit vec3 to vec4 cast should fail
+attribute vec4 vPosition;
+void main()
+{
+ mediump vec3 k = vec3(1, 2, 3);
+ gl_Position = k;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-include.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-include.vert.html
new file mode 100644
index 0000000000..bc0cf93cc2
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-include.vert.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader uses #include should fail
+
+// Sadly I can not force the current path so this could fail beacuse include.vs
+// does not exist, not because #include is disallowed.
+#include "include.vs"
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-int-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-int-return-value.frag.html
new file mode 100644
index 0000000000..7b4430c0f8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-int-return-value.frag.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with int return value from function call should succeed
+int functionResult();
+
+void main()
+{
+ int r = functionResult();
+ gl_FragColor = vec4(r, r, r, r);
+}
+
+int functionResult()
+{
+ return 1;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-invalid-identifier.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-invalid-identifier.frag.html
new file mode 100644
index 0000000000..af918519c6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-invalid-identifier.frag.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with gl_ identifier should fail
+precision mediump float;
+uniform float gl_foo;
+void main()
+{
+ gl_FragColor = vec4(gl_foo,0.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec2-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec2-return-value.frag.html
new file mode 100644
index 0000000000..2445e7d3c0
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec2-return-value.frag.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with ivec2 return value from function call should succeed
+ivec2 functionResult();
+
+void main()
+{
+ ivec2 r = functionResult();
+ gl_FragColor = vec4(r.x, r.y, r.x, r.y);
+}
+
+ivec2 functionResult()
+{
+ return ivec2(1, 1);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec3-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec3-return-value.frag.html
new file mode 100644
index 0000000000..c765ef9259
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec3-return-value.frag.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with ivec3 return value from function call should succeed
+ivec3 functionResult();
+
+void main()
+{
+ ivec3 r = functionResult();
+ gl_FragColor = vec4(r.x, r.y, r.z, r.x);
+}
+
+ivec3 functionResult()
+{
+ return ivec3(1, 1, 1);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec4-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec4-return-value.frag.html
new file mode 100644
index 0000000000..77317d22e8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-ivec4-return-value.frag.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with ivec4 return value from function call should succeed
+ivec4 functionResult();
+
+void main()
+{
+ ivec4 r = functionResult();
+ gl_FragColor = vec4(r.x, r.y, r.z, r.w);
+}
+
+ivec4 functionResult()
+{
+ return ivec4(1, 1, 1, 1);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-limited-indexing.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-limited-indexing.frag.html
new file mode 100644
index 0000000000..df7401ef3c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-limited-indexing.frag.html
@@ -0,0 +1,54 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader should succeed
+attribute vec4 a_weights;
+varying vec4 v_weights;
+
+void main() {
+ v_weights = a_weights;
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with appropriately limited indexing expression should succeed
+// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
+precision mediump float;
+
+uniform vec4 u_colors[8];
+varying vec4 v_weights;
+
+void main()
+{
+ vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
+ for (int i = 0; i < 4; i++) {
+ color += u_colors[i] * v_weights[i];
+ }
+ gl_FragColor = color;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-long-line.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-long-line.html
new file mode 100644
index 0000000000..4f22beb027
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-long-line.html
@@ -0,0 +1,67 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fshaderWithLongLine" type="text/something-not-javascript">
+precision mediump float;
+uniform float fooo;
+#if defined(someSymbolNotDefined)
+#error long
+#endif
+void main()
+{
+ gl_FragColor = vec4(fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, 1.0);
+}
+</script>
+<script>
+"use strict";
+description("checks shader with long line succeeds");
+
+var wtu = WebGLTestUtils;
+GLSLConformanceTester.runTests([
+ {
+ fShaderId: 'fshaderWithLongLine',
+ fShaderSuccess: true,
+ fShaderPrep: function(str) {
+ function expand(str, re, replacement, count) {
+ for (var ii = 0; ii < count; ++ii) {
+ str = str.replace(re, replacement);
+ }
+ return str;
+ }
+ str = expand(str, new RegExp(" ", 'g'), " ", 12);
+ var manyZeros = expand("0", new RegExp("0", 'g'), "00", 8).substring(2);
+ str = expand(str, new RegExp("0", 'g'), manyZeros, 1);
+ str = expand(str, new RegExp("fooo", 'g'), "fooofooo", 6);
+ str = expand(str, new RegExp("long", 'g'), "longlong", 6);
+ //debug("len:" + str.length);
+ //debug(str);
+ return str;
+ },
+ linkSuccess: true,
+ passMsg: 'shader that uses long lines should succeed',
+ }
+ ]);
+
+debug("");
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-ascii-error.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-ascii-error.frag.html
new file mode 100644
index 0000000000..b80cf3a995
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-ascii-error.frag.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// shader with error directive using characters outside of allowed set fails
+#error // will return INVALID_VALUE. See WebGL 6.18
+void main()
+{
+ gl_FragColor = vec4(0,0,0,0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-1-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-1-of-8.html
new file mode 100644
index 0000000000..f2f8bc674e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-1-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 1 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 1;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-2-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-2-of-8.html
new file mode 100644
index 0000000000..4be404a5d6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-2-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 2 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 2;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-3-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-3-of-8.html
new file mode 100644
index 0000000000..58b8ab21d6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-3-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 3 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 3;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-4-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-4-of-8.html
new file mode 100644
index 0000000000..4c2162970a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-4-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 4 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 4;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-5-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-5-of-8.html
new file mode 100644
index 0000000000..546cc04d84
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-5-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 5 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 5;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-6-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-6-of-8.html
new file mode 100644
index 0000000000..7fad96cedc
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-6-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 6 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 6;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-7-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-7-of-8.html
new file mode 100644
index 0000000000..b45abfe2bb
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-7-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 7 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 7;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-8-of-8.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-8-of-8.html
new file mode 100644
index 0000000000..f901cacc58
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-non-reserved-words-8-of-8.html
@@ -0,0 +1,31 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Non Reserved Words 8 of 8</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/tests/shader-with-non-reserved-words.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+const numParts = 8;
+const part = 8;
+testNonReservedWords(part, numParts);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-precision.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-precision.frag.html
new file mode 100644
index 0000000000..536b66ec0b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-precision.frag.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with precision should succeed
+void main()
+{
+ mediump vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
+ gl_FragColor = color;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-preprocessor-whitespace.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-preprocessor-whitespace.html
new file mode 100644
index 0000000000..c8e31d5927
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-preprocessor-whitespace.html
@@ -0,0 +1,62 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexWhitespace" type="text/something-not-javascript">
+// GLSL ES spec section 3.4
+ # ifdef GL_ES
+attribute vec4 v_Position;
+void main()
+{
+ gl_Position = v_Position;
+}
+#endif
+</script>
+<script id="fragmentWhitespace" type="text/something-not-javascript">
+// GLSL ES spec section 3.4
+ # ifdef GL_ES
+precision mediump float;
+void main()
+{
+ gl_FragColor = vec4(0.0,0.0,0.0,1.0);
+}
+#endif
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ {
+ vShaderId: 'vertexWhitespace',
+ vShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'Vertex shader using space and tab characters around # should succeed'
+ },
+ {
+ fShaderId: 'fragmentWhitespace',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'Fragment shader using space and tab characters around # should succeed'
+ }
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-quoted-error.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-quoted-error.frag.html
new file mode 100644
index 0000000000..c79315d3f9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-quoted-error.frag.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// shader with error directive using quotes will fail
+#error "testing123 testing123" // will return INVALID_VALUE. See WebGL 6.18
+void main()
+{
+ gl_FragColor = vec4(0,0,0,0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-reserved-words.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-reserved-words.html
new file mode 100644
index 0000000000..fd6953e0fe
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-reserved-words.html
@@ -0,0 +1,263 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Reserved Words</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader0" type="text/something-not-javascript">
+struct $replaceMe {
+ vec4 $replaceMe;
+};
+struct Foo {
+ $replaceMe $replaceMe;
+};
+attribute vec4 position;
+void main()
+{
+ Foo f;
+ f.$replaceMe.$replaceMe = position;
+ gl_Position = f.$replaceMe.$replaceMe;
+}
+</script>
+<script id="fragmentShader0" type="text/something-not-javascript">
+precision mediump float;
+vec4 $replaceMe() {
+ return vec4(0,1,0,1);
+}
+void main()
+{
+ gl_FragColor = $replaceMe();
+}
+</script>
+<script id="vertexShader1" type="text/something-not-javascript">
+attribute vec4 $replaceMe;
+void main()
+{
+ gl_Position = $replaceMe;
+}
+</script>
+<script id="fragmentShader1" type="text/something-not-javascript">
+precision mediump float;
+vec4 foo(vec4 $replaceMe) {
+ return $replaceMe;
+}
+void main()
+{
+ gl_FragColor = foo(vec4(1,0,1,1));
+}
+</script>
+<script id="vertexShader2" type="text/something-not-javascript">
+varying vec4 $replaceMe;
+attribute vec4 position;
+void main()
+{
+ gl_Position = position;
+ $replaceMe = position;
+}
+</script>
+<script id="fragmentShader2" type="text/something-not-javascript">
+precision mediump float;
+varying vec4 $replaceMe;
+void main()
+{
+ gl_FragColor = $replaceMe;
+}
+</script>
+<script id="vertexShader3" type="text/something-not-javascript">
+attribute vec4 position;
+void main()
+{
+ gl_Position = position;
+}
+</script>
+<script id="fragmentShader3" type="text/something-not-javascript">
+precision mediump float;
+uniform vec4 $replaceMe;
+void main()
+{
+ gl_FragColor = $replaceMe;
+}
+</script>
+<script>
+"use strict";
+var GLSL_1_0_17_words = [
+ "attribute",
+ "const",
+ "uniform",
+ "varying",
+ "break",
+ "continue",
+ "do",
+ "for",
+ "while",
+ "if",
+ "else",
+ "in",
+ "out",
+ "inout",
+ "float",
+ "int",
+ "void",
+ "bool",
+ "true",
+ "false",
+ "lowp",
+ "mediump",
+ "highp",
+ "precision",
+ "invariant",
+ "discard",
+ "return",
+ "mat2",
+ "mat3",
+ "mat4",
+ "vec2",
+ "vec3",
+ "vec4",
+ "ivec2",
+ "ivec3",
+ "ivec4",
+ "bvec2",
+ "bvec3",
+ "bvec4",
+ "sampler2D",
+ "samplerCube",
+ "struct"
+]
+
+var GLSL_1_0_17_FutureWords = [
+ "asm",
+ "class",
+ "union",
+ "enum",
+ "typedef",
+ "template",
+ "this",
+ "packed",
+ "goto",
+ "switch",
+ "default",
+ "inline",
+ "noinline",
+ "volatile",
+ "public",
+ "static",
+ "extern",
+ "external",
+ "interface",
+ "flat",
+ "long",
+ "short",
+ "double",
+ "half",
+ "fixed",
+ "unsigned",
+ "superp",
+ "input",
+ "output",
+ "hvec2",
+ "hvec3",
+ "hvec4",
+ "dvec2",
+ "dvec3",
+ "dvec4",
+ "fvec2",
+ "fvec3",
+ "fvec4",
+ "sampler1D",
+ "sampler3D",
+ "sampler1DShadow",
+ "sampler2DShadow",
+ "sampler2DRect",
+ "sampler3DRect",
+ "sampler2DRectShadow",
+ "sizeof",
+ "cast",
+ "namespace",
+ "using",
+ "__foo", // something that has 2 underscores
+ "foo__bar", // something that has 2 underscores
+ "gl_foo", // something that starts with gl_
+ "webgl_foo" // something that starts with webgl_
+];
+
+description();
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext();
+
+var reservedWordsLists = [
+ GLSL_1_0_17_words,
+ GLSL_1_0_17_FutureWords
+];
+
+var reservedWords = [];
+for (var ii = 0; ii < reservedWordsLists.length; ++ii) {
+ var list = reservedWordsLists[ii];
+ for (var jj = 0; jj < list.length; ++jj) {
+ reservedWords.push(list[jj]);
+ }
+}
+
+var src = [];
+for (var ii = 0; ii < 4; ++ii) {
+ var vsrc = document.getElementById("vertexShader" + ii).text;
+ var fsrc = document.getElementById("fragmentShader" + ii).text;
+ src.push({vsrc: vsrc, fsrc: fsrc});
+}
+
+var wordNdx = 0;
+
+function testNextWord() {
+ if (wordNdx >= reservedWords.length) {
+ finishTest();
+ return;
+ }
+ testWord(reservedWords[wordNdx]);
+ ++wordNdx;
+ setTimeout(testNextWord, 0);
+}
+testNextWord();
+
+function testWord(word) {
+ debug("");
+ debug("testing: " + word);
+
+ for (var ii = 0; ii < src.length; ++ii) {
+ var vs = src[ii].vsrc.replace(/\$replaceMe/g, word);
+ var fs = src[ii].fsrc.replace(/\$replaceMe/g, word);
+
+ var success = true;
+ var program = wtu.loadProgram(gl, vs, fs, function(msg) {
+ //debug(msg);
+ success = false;
+ }, true);
+ if (success) {
+ testFailed("shader with: '" + word + "' compiled even though it should not");
+ } else {
+ testPassed("shader with: '" + word + "' correctly failed to compile");
+ }
+ if (program) {
+ gl.deleteProgram(program);
+ }
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no GL errors");
+ }
+}
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-short-circuiting-operators.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-short-circuiting-operators.html
new file mode 100644
index 0000000000..c05649aa83
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-short-circuiting-operators.html
@@ -0,0 +1,156 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL short-circuit evaluation</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="example" width="2" height="2"> </canvas>
+
+<!-------------------------------------
+ WebGL Shaders
+---------------------------------------->
+<!-- Pass through Shaders -->
+<script id="vshader0" type="x-shader/x-vertex">
+/* PASS-THROUGH VERTEX SHADER */
+attribute vec4 vPosition;
+
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+
+<script id="fshader0" type="x-shader/x-fragment">
+/* PASS-THROUGH FRAGMENT SHADER */
+precision mediump float;
+varying vec4 vPassThrough;
+
+void main()
+{
+ gl_FragColor = vPassThrough;
+}
+</script>
+
+<!-- basic conditonal short circuit Shaders -->
+<script id="vshader1" type="x-shader/x-vertex">
+attribute vec4 vPosition;
+varying vec4 vPassThrough;
+
+void main()
+{
+ int x = 1;
+ $(variables)
+
+ if ($(condition))
+ { /*do nothing*/ }
+
+ /* if x was unmodified return green, else return red */
+ vPassThrough = (x == 1) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+ gl_Position = vPosition;
+}
+</script>
+
+<script id="fshader1" type="x-shader/x-fragment">
+precision mediump float;
+
+void main()
+{
+ int x = 1;
+ $(variables)
+
+ if ($(condition))
+ { /*do nothing*/ }
+
+ gl_FragColor = (x == 1) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+}
+</script>
+
+<!-- Main body of the Webgl program -->
+<script>
+"use strict";
+description();
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext();
+
+wtu.setupUnitQuad(gl, [0, 1]);
+
+var shaderTemplates = [
+ { vs: "vshader1", fs: "fshader0" }, // basic vertex short-circuit test
+ { vs: "vshader0", fs: "fshader1" }, // basic fragment short-circuit test
+];
+
+/* replace the names of the shaders in the tempate variables with
+ * the shaders themselves */
+for (var ii = 0; ii < shaderTemplates.length; ++ii) {
+ var template = shaderTemplates[ii];
+ template.vs = wtu.getScript(template.vs);
+ template.fs = wtu.getScript(template.fs);
+}
+
+/* define the conditon that will be used in the shaders. If additional
+ * variables are needed that are not present i the shader they my be
+ * defined in the variables variable */
+var tests = [
+ { condition: "true || (x = 0) == 1", variables: "" }, /* test basic 'or' short circuit */
+ { condition: "false && (x = 0) == 1", variables: "" }, /* test basic 'and' short circuit */
+ { condition: "(j == 3 && j == k) || (j > (x = 0))", variables: "int j = 3;\nint k = 3;" }, /* test basic 'or' short circuit with actual condition */
+ { condition: "(j == 3 && j == k) && (j > (x = 0))", variables: "int j = 3;\nint k = 4;" }, /* test basic 'and' short circuit with actual condition */
+ { condition: "(j + 3 > k && ((j < 10) || (x + 5 > j + (x = 0))) || ( x = 0 ) == 7)", variables: "int j = 5;\nint k = 3;" }, /* complex test */
+ { condition: "j + 1 == 6 ? x == 1 || j > (x = 0) : (x = 0) == 1 && (x = 0) <= 1", variables: "int j = 5;" }, /* nested with ternary operator */
+ { condition: "true && (true || (x = 0) == 1)", variables: "" }, /* test unfold short circuit update order correctness */
+];
+
+function testShortCircuit(test) {
+ debug("");
+ debug("testing short circuit condition: " + test.condition);
+
+ /* Setting clear color to blue */
+ gl.clearColor(0.0, 0.0, 1.0, 1.0);
+
+ for (var ii = 0; ii < shaderTemplates.length; ++ii) {
+
+ /* clear the screen so that subsequent tests don't conflict */
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ var template = shaderTemplates[ii];
+
+ var vs = wtu.replaceParams(template.vs, test);
+ var fs = wtu.replaceParams(template.fs, test);
+
+ var program = wtu.setupProgram(gl, [vs, fs], ['vPosition'], undefined, true);
+
+ wtu.clearAndDrawUnitQuad(gl);
+ wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green", 0);
+
+ gl.deleteProgram(program);
+
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no GL errors");
+ }
+}
+
+var testNdx = 0;
+function runNextTest() {
+ testShortCircuit(tests[testNdx++]);
+ if (testNdx >= tests.length) {
+ finishTest();
+ } else {
+ setTimeout(runNextTest, 0);
+ }
+}
+
+runNextTest();
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-similar-uniform-array-names.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-similar-uniform-array-names.html
new file mode 100644
index 0000000000..e96ab4055c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-similar-uniform-array-names.html
@@ -0,0 +1,109 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL similar names issue</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="fshader1" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_nameCollision[2];
+uniform vec4 u_nameCollision2[2];
+uniform vec4 u_name[2];
+void main(void) {
+ gl_FragColor = u_nameCollision[0] + u_nameCollision2[0] + u_name[0];
+}
+</script>
+<script id="fshader2" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_nameCollision2[2];
+uniform vec4 u_nameCollision[2];
+uniform vec4 u_name[2];
+void main(void) {
+ gl_FragColor = u_nameCollision2[0] + u_nameCollision[0] + u_name[0];
+}
+</script>
+<script id="fshader3" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_nameCollision[2];
+uniform vec4 u_name[2];
+uniform vec4 u_nameCollision2[2];
+void main(void) {
+ gl_FragColor = u_nameCollision[0] + u_name[0] + u_nameCollision2[0];
+}
+</script>
+<script id="fshader4" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_nameCollision2[2];
+uniform vec4 u_name[2];
+uniform vec4 u_nameCollision[2];
+void main(void) {
+ gl_FragColor = u_nameCollision2[0] + u_name[0] + u_nameCollision[0];
+}
+</script>
+<script id="fshader5" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_name[2];
+uniform vec4 u_nameCollision[2];
+uniform vec4 u_nameCollision2[2];
+void main(void) {
+ gl_FragColor = u_name[0] + u_nameCollision[0] + u_nameCollision2[0];
+}
+</script>
+<script id="fshader6" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_name[2];
+uniform vec4 u_nameCollision2[2];
+uniform vec4 u_nameCollision[2];
+void main(void) {
+ gl_FragColor = u_name[0] + u_nameCollision2[0] + u_nameCollision[0];
+}
+</script>
+</head>
+<body>
+<canvas id="canvas" width="50" height="50"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description();
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("canvas");
+wtu.setupUnitQuad(gl);
+
+for (var ii = 0; ii < 6; ++ii) {
+ var program = wtu.setupProgram(gl, ["vshader", "fshader" + (ii + 1)], ["a_position"]);
+ var loc1 = gl.getUniformLocation(program, "u_name[0]");
+ var loc2 = gl.getUniformLocation(program, "u_nameCollision[0]");
+ var loc3 = gl.getUniformLocation(program, "u_nameCollision2[0]");
+ gl.uniform4fv(loc1, [1, 0, 0, 0]);
+ gl.uniform4fv(loc2, [0, 1, 0, 0]);
+ gl.uniform4fv(loc3, [0, 0, 0, 1]);
+ wtu.clearAndDrawUnitQuad(gl);
+ wtu.checkCanvas(gl, [255, 255, 0, 255], "Should be yellow");
+}
+
+wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-too-many-uniforms.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-too-many-uniforms.html
new file mode 100644
index 0000000000..b5e87f9c85
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-too-many-uniforms.html
@@ -0,0 +1,123 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main()
+{
+ gl_Position = a_position;
+}
+</script>
+<script id="vshader-max" type="x-shader/x-vertex">
+attribute vec4 a_position;
+uniform vec4 u_color[$(maxUniformVectors)];
+void main()
+{
+ vec4 v = vec4(0, 0, 0, 0);
+ for (int i = 0; i < $(maxUniformVectors); ++i) {
+ v = v + vec4(u_color[i]);
+ }
+ gl_Position = a_position + v;
+}
+</script>
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+void main()
+{
+ gl_FragColor = vec4(0, 1, 0, 1);
+}
+</script>
+<script id="fshader-max" type="x-shader/x-fragment">
+precision mediump float;
+uniform vec4 u_color[$(maxUniformVectors)];
+void main()
+{
+ vec4 v = vec4(0, 0, 0, 0);
+ for (int i = 0; i < $(maxUniformVectors); ++i) {
+ v = v + vec4(u_color[i]);
+ }
+ gl_FragColor = v;
+}
+</script>
+<script>
+"use strict";
+description("checks shader with too many uniforms fails");
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext();
+var maxFragmentUniformVectors = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);
+var maxVertexUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);
+
+// Up to 2 uniform vector registers may be spent for literal constants in
+// vshader-max or fshader-max code. One vector row is used for the vec4, and
+// another may be used for integer constants that are allowed to be treated
+// internally as floats and are packable to the space of one row. This is
+// according to the GLSL ES variable packing algorithm detailed in Section 7 of
+// Appendix A of the GLSL ES Specification 10.0.17.
+var maxVectorStorageUsedForLiterals = 2;
+
+var tests = [
+ { desc: "using all uniforms in vertex shader should succeed",
+ maxUniformVectors: maxVertexUniformVectors - maxVectorStorageUsedForLiterals,
+ vShader: "vshader-max",
+ fShader: "fshader",
+ success: true,
+ },
+ { desc: "using too many uniforms in vertex shader should fail",
+ maxUniformVectors: maxVertexUniformVectors + 1,
+ vShader: "vshader-max",
+ fShader: "fshader",
+ color: [0, 1, 0, 1],
+ success: false,
+ },
+ { desc: "using all uniforms in fragment shader should succeed",
+ maxUniformVectors: maxFragmentUniformVectors - maxVectorStorageUsedForLiterals,
+ vShader: "vshader",
+ fShader: "fshader-max",
+ success: true,
+ },
+ { desc: "using too many uniforms in fragment shader should fail",
+ maxUniformVectors: maxFragmentUniformVectors + 1,
+ vShader: "vshader",
+ fShader: "fshader-max",
+ color: [0, 1, 0, 1],
+ success: false,
+ },
+];
+
+var glslTests = [];
+
+for (var ii = 0; ii < tests.length; ++ii) {
+ var test = tests[ii];
+ var vSrc = wtu.replaceParams(wtu.getScript(test.vShader), test);
+ var fSrc = wtu.replaceParams(wtu.getScript(test.fShader), test);
+ glslTests.push({
+ vShaderSource: vSrc,
+ fShaderSource: fSrc,
+ linkSuccess: test.success,
+ passMsg: 'shader ' + test.desc,
+ });
+}
+
+GLSLConformanceTester.runTests(glslTests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-two-initializer-types.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-two-initializer-types.html
new file mode 100644
index 0000000000..fac53b08d8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-two-initializer-types.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with different initializer types should succeed
+precision mediump float;
+
+void main() {
+ float test1[4], test2;
+ gl_FragColor = vec4(0.0,1.0,0.0,1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-undefined-preprocessor-symbol.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-undefined-preprocessor-symbol.frag.html
new file mode 100644
index 0000000000..06783bcfd8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-undefined-preprocessor-symbol.frag.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader (3.4) undefined preprocessor symbol should fail
+#if UNDEFINED_FOO
+ // according to ES GLSL spec 3.4 undefined symbols should fail.
+#else
+ precision mediump float;
+ void main()
+ {
+ gl_FragColor = vec4(0.0,0.0,0.0,1.0);
+ }
+#endif
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-uniform-in-loop-condition.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-uniform-in-loop-condition.vert.html
new file mode 100644
index 0000000000..be8d3067b7
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-uniform-in-loop-condition.vert.html
@@ -0,0 +1,42 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader with uniform variable in loop condition should fail
+// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
+uniform int u_numIterations;
+attribute vec4 a_position;
+
+void main()
+{
+ float count = 0.0;
+ for (int i = 0; i < u_numIterations; i++) {
+ count += 1.0;
+ }
+ gl_Position = a_position + vec4(count, count, count, count);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec2-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec2-return-value.frag.html
new file mode 100644
index 0000000000..c5f5860707
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec2-return-value.frag.html
@@ -0,0 +1,44 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with vec2 return value from function call should succeed
+precision mediump float;
+
+vec2 functionResult();
+
+void main()
+{
+ vec2 r = functionResult();
+ gl_FragColor = vec4(r.x, r.y, r.x, r.y);
+}
+
+vec2 functionResult()
+{
+ return vec2(1.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec3-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec3-return-value.frag.html
new file mode 100644
index 0000000000..fe5a60c6c4
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec3-return-value.frag.html
@@ -0,0 +1,44 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with vec3 return value from function call should succeed
+precision mediump float;
+
+vec3 functionResult();
+
+void main()
+{
+ vec3 r = functionResult();
+ gl_FragColor = vec4(r.x, r.y, r.z, r.x);
+}
+
+vec3 functionResult()
+{
+ return vec3(1.0, 1.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-return-value.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-return-value.frag.html
new file mode 100644
index 0000000000..69001a0f83
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-return-value.frag.html
@@ -0,0 +1,44 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shader with vec4 return value from function call should succeed
+precision mediump float;
+
+vec4 functionResult();
+
+void main()
+{
+ vec4 r = functionResult();
+ gl_FragColor = vec4(r.x, r.y, r.z, r.w);
+}
+
+vec4 functionResult()
+{
+ return vec4(1.0, 1.0, 1.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-vec3-vec4-conditional.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-vec3-vec4-conditional.html
new file mode 100644
index 0000000000..2cc0e8ea61
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-vec4-vec3-vec4-conditional.html
@@ -0,0 +1,36 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that vec4->vec3->vec4 conditional should succeed
+precision mediump float;
+uniform float x;
+void main()
+{
+ gl_FragColor = vec4((x > 0.0 ? vec4(1.0, 1.0, 1.0, 0.0) : vec4(0.1, 0.1, 0.1, 0.0)).xyz, 1.0);
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.frag.html
new file mode 100644
index 0000000000..0d88a7f689
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.frag.html
@@ -0,0 +1,41 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader that uses __VERSION__==100 should succeed
+#if __VERSION__ == 100
+ precision mediump float;
+ void main()
+ {
+ gl_FragColor = vec4(0.0,0.0,0.0,1.0);
+ }
+#else
+ foo
+#endif
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.vert.html
new file mode 100644
index 0000000000..9a0357971f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-100.vert.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader uses the #version 100 directive should succeed
+#version 100
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-120.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-120.vert.html
new file mode 100644
index 0000000000..c1bc6d7d07
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-120.vert.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader uses the #version not 100 directive should fail
+#version 120
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-130.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-130.vert.html
new file mode 100644
index 0000000000..6983c92f9d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-version-130.vert.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader uses the #version not 100 directive should fail
+#version 130
+attribute vec4 vPosition;
+void main()
+{
+ gl_Position = vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-webgl-identifier.vert.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-webgl-identifier.vert.html
new file mode 100644
index 0000000000..a1c0af9d9b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-webgl-identifier.vert.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader that uses webgl identifier should fail
+attribute vec4 webgl_vPosition;
+void main()
+{
+ gl_Position = webgl_vPosition;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-while-loop.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-while-loop.html
new file mode 100644
index 0000000000..592f55541e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-with-while-loop.html
@@ -0,0 +1,38 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader with while loop should fail
+precision mediump float;
+void main() {
+ int k = 0;
+ while (k < 5) {
+ k++;
+ }
+ gl_FragColor = vec4(float(k));
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-without-precision.frag.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-without-precision.frag.html
new file mode 100644
index 0000000000..c5543e2119
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shader-without-precision.frag.html
@@ -0,0 +1,37 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader without precision should fail
+uniform vec4 color;
+void main()
+{
+ gl_FragColor = color;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html
new file mode 100644
index 0000000000..c06de87ef8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html
@@ -0,0 +1,115 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShaderLiteralLoopCondition" type="text/something-not-javascript">
+attribute vec4 a_position;
+void main()
+{
+ for (int i = 0; i < 5 + 5; i++) { }
+ gl_Position = a_position;
+}
+</script>
+<script id="fragmentShaderLiteralLoopCondition" type="text/something-not-javascript">
+void main()
+{
+ for (int i = 0; i < 5 + 5; i++) { }
+ gl_FragColor = vec4(1.0);
+}
+</script>
+<script id="vertexShaderConstVarLoopCondition" type="text/something-not-javascript">
+attribute vec4 a_position;
+void main()
+{
+ // Explicitly constant variables can be part of a constant expression
+ const int constVar = 5;
+ for (int i = 0; i < 5 + constVar; i++) { }
+ gl_Position = a_position;
+}
+</script>
+<script id="fragmentShaderConstVarLoopCondition" type="text/something-not-javascript">
+void main()
+{
+ // Explicitly constant variables can be part of a constant expression
+ const int constVar = 5;
+ for (int i = 0; i < constVar + 5; i++) { }
+ gl_FragColor = vec4(1.0);
+}
+</script>
+<script id="vertexShaderNonConstVarLoopCondition" type="text/something-not-javascript">
+attribute vec4 a_position;
+void main()
+{
+ // Despite assigning a constant and not modifying it, nonConstVar is not semantically a constant expression
+ int nonConstVar = 10;
+ for (int i = 0; i < nonConstVar; i++) { }
+ gl_Position = a_position;
+}
+</script>
+<script id="fragmentShaderNonConstVarLoopCondition" type="text/something-not-javascript">
+void main()
+{
+ // Despite assigning a constant and not modifying it, nonConstVar is not semantically a constant expression
+ int nonConstVar = 10;
+ for (int i = 0; i < nonConstVar; i++) { }
+ gl_FragColor = vec4(1.0);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+
+var tests = [];
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderLiteralLoopCondition"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderLiteralLoopCondition"),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Shaders with literals in the loop condition should compile and link.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderConstVarLoopCondition"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderConstVarLoopCondition"),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Shaders with constant variables in the loop condition should compile and link.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderNonConstVarLoopCondition"),
+ vShaderSuccess: false,
+ fShaderSource: wtu.getScript("fragmentShaderLiteralLoopCondition"),
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "Vertex shader with non-const variable in the loop condition should fail.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderLiteralLoopCondition"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderNonConstVarLoopCondition"),
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Fragment shader with non-const variable in the loop condition should fail.",
+});
+
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-invariance.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-invariance.html
new file mode 100644
index 0000000000..205d78cee4
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-invariance.html
@@ -0,0 +1,332 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShaderVariant" type="text/something-not-javascript">
+varying vec4 v_varying;
+
+void main()
+{
+ gl_PointSize = 1.0;
+ gl_Position = v_varying;
+}
+</script>
+<script id="vertexShaderInvariant" type="text/something-not-javascript">
+invariant varying vec4 v_varying;
+
+void main()
+{
+ gl_Position = v_varying;
+}
+</script>
+<script id="vertexShaderSeparateInvariant" type="text/something-not-javascript">
+varying vec4 v_varying;
+invariant v_varying;
+
+void main()
+{
+ gl_Position = v_varying;
+}
+</script>
+<script id="vertexShaderSeparateInvariantWrongOrder" type="text/something-not-javascript">
+invariant v_varying;
+varying vec4 v_varying;
+
+void main()
+{
+ gl_Position = v_varying;
+}
+</script>
+<script id="vertexShaderGlobalInvariant" type="text/something-not-javascript">
+#pragma STDGL invariant(all)
+varying vec4 v_varying;
+
+void main()
+{
+ gl_Position = v_varying;
+}
+</script>
+<script id="vertexShaderInvariantGlPosition" type="text/something-not-javascript">
+invariant gl_Position;
+
+void main()
+{
+ gl_Position = vec4(0, 0, 0, 0);
+}
+</script>
+<script id="vertexShaderInvariantGlPointSize" type="text/something-not-javascript">
+invariant gl_PointSize;
+
+void main()
+{
+ gl_PointSize = 1.0;
+ gl_Position = vec4(0, 0, 0, 0);
+}
+</script>
+<script id="fragmentShaderVariant" type="text/something-not-javascript">
+precision mediump float;
+
+varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script id="fragmentShaderInvariant" type="text/something-not-javascript">
+precision mediump float;
+
+invariant varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script id="fragmentShaderSeparateInvariant" type="text/something-not-javascript">
+precision mediump float;
+
+varying vec4 v_varying;
+invariant v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script id="fragmentShaderSeparateInvariantWrongOrder" type="text/something-not-javascript">
+precision mediump float;
+
+invariant v_varying;
+varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script id="fragmentShaderGlobalInvariant" type="text/something-not-javascript">
+#pragma STDGL invariant(all)
+precision mediump float;
+
+varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script id="fragmentShaderInvariantGlFragCoord" type="text/something-not-javascript">
+invariant gl_FragCoord;
+
+void main()
+{
+ gl_FragColor = gl_FragCoord;
+}
+</script>
+<script id="fragmentShaderVariantGlFragCoord" type="text/something-not-javascript">
+void main()
+{
+ gl_FragColor = gl_FragCoord;
+}
+</script>
+<script id="fragmentShaderInvariantGlPointCoord" type="text/something-not-javascript">
+invariant gl_PointCoord;
+
+void main()
+{
+ gl_FragColor = vec4(gl_PointCoord, 0.0, 0.0);
+}
+</script>
+<script id="fragmentShaderVariantGlPointCoord" type="text/something-not-javascript">
+void main()
+{
+ gl_FragColor = vec4(gl_PointCoord, 0.0, 0.0);
+}
+</script>
+<script id="fragmentShaderInvariantGlFrontFacing" type="text/something-not-javascript">
+invariant gl_FrontFacing;
+
+void main()
+{
+ gl_FragColor = gl_FrontFacing ? vec4(1, 1, 1, 1) : vec4(0, 0, 0, 1);
+}
+</script>
+<script id="fragmentShaderVariantGlFrontFacing" type="text/something-not-javascript">
+void main()
+{
+ gl_FragColor = gl_FrontFacing ? vec4(1, 1, 1, 1) : vec4(0, 0, 0, 1);
+}
+</script>
+<script>
+// GLSL 1.0.17 4.3.5
+"use strict";
+// See GLSL ES spec 1.0.17 section 4.6.4 "Invariance and linkage".
+var cases = [
+ {
+ vShaderId: "vertexShaderVariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariant",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with variant varying and fragment shader with invariant varying must fail",
+ },
+ {
+ vShaderId: "vertexShaderInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderVariant",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with invariant varying and fragment shader with variant varying must fail",
+ },
+ {
+ vShaderId: "vertexShaderGlobalInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderVariant",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with invariant (global setting) varying and fragment shader with variant varying must fail",
+ },
+ {
+ vShaderId: "vertexShaderGlobalInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariant",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant (global setting) varying and fragment shader with invariant varying must succeed",
+ },
+ {
+ vShaderId: "vertexShaderSeparateInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariant",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant (separately set) varying and fragment shader with invariant varying must succeed",
+ },
+ {
+ vShaderId: "vertexShaderInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderSeparateInvariant",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant varying and fragment shader with invariant (separately set) varying must succeed",
+ },
+ {
+ vShaderId: "vertexShaderSeparateInvariantWrongOrder",
+ vShaderSuccess: false,
+ fShaderId: "fragmentShaderInvariant",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with invariant (separately set in wrong order) varying must fail",
+ },
+ {
+ vShaderId: "vertexShaderInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderSeparateInvariantWrongOrder",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "fragment shader with invariant (separately set in wrong order) varying must fail",
+ },
+ {
+ vShaderId: "vertexShaderInvariantGlPosition",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariantGlFragCoord",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant gl_Position and fragment shader with invariant gl_FragCoord must succeed",
+ },
+ {
+ vShaderId: "vertexShaderVariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariantGlFragCoord",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with variant gl_Position and fragment shader with invariant gl_FragCoord must fail",
+ },
+ {
+ vShaderId: "vertexShaderInvariantGlPosition",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderVariantGlFragCoord",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant gl_Position and fragment shader with variant gl_FragCoord must succeed",
+ },
+ {
+ vShaderId: "vertexShaderInvariantGlPointSize",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariantGlPointCoord",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant gl_PointSize and fragment shader with invariant gl_PointCoord must succeed",
+ },
+ {
+ vShaderId: "vertexShaderVariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariantGlPointCoord",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with variant gl_PointSize and fragment shader with invariant gl_PointCoord must fail",
+ },
+ {
+ vShaderId: "vertexShaderInvariantGlPointSize",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderVariantGlPointCoord",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with invariant gl_PointSize and fragment shader with variant gl_PointCoord must succeed",
+ },
+ {
+ vShaderId: "vertexShaderVariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderVariantGlFrontFacing",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "fragment shader with variant gl_FrontFacing must succeed compilation",
+ },
+ {
+ vShaderId: "vertexShaderVariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderInvariantGlFrontFacing",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "fragment shader with invariant gl_FrontFacing must fail compilation",
+ },
+ {
+ vShaderId: "vertexShaderVariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderGlobalInvariant",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with variant varying and fragment shader with invariant (global setting) varying must succeed",
+ },
+ {
+ vShaderId: "vertexShaderInvariant",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderGlobalInvariant",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with invariant varying and fragment shader with invariant (global setting) varying must fail",
+ }
+];
+
+GLSLConformanceTester.runTests(cases);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-uniforms.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-uniforms.html
new file mode 100644
index 0000000000..73a032278f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-uniforms.html
@@ -0,0 +1,87 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// Shaders with mis-matching uniform types should fail
+// GLSL 1.017 4.3.4
+uniform $(type) u_uniform;
+
+void main()
+{
+ gl_Position = $(code);
+}
+</script>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shaders with mis-matching uniform types should fail
+// GLSL 1.017 4.3.4
+precision mediump float;
+
+uniform $(type) u_uniform;
+
+void main()
+{
+ gl_FragColor = $(code);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+var uniformTypes = [
+ { type: "bool", code: "vec4(u_uniform, 0, 0, 0)", },
+ { type: "float", code: "vec4(u_uniform, 0, 0, 0)", },
+ { type: "int", code: "vec4(u_uniform, 0, 0, 0)", },
+ { type: "vec2", code: "vec4(u_uniform, 0, 0)", },
+ { type: "ivec2", code: "vec4(u_uniform, 0, 0)", },
+ { type: "bvec2", code: "vec4(u_uniform, 0, 0)", },
+ { type: "vec3", code: "vec4(u_uniform, 0)", },
+ { type: "ivec3", code: "vec4(u_uniform, 0)", },
+ { type: "bvec3", code: "vec4(u_uniform, 0)", },
+ { type: "vec4", code: "vec4(u_uniform)", },
+ { type: "ivec4", code: "vec4(u_uniform)", },
+ { type: "bvec4", code: "vec4(u_uniform)", },
+ { type: "mat2", code: "vec4(u_uniform[0][0], 0, 0, 0)", },
+ { type: "mat3", code: "vec4(u_uniform[0][0], 0, 0, 0)", },
+ { type: "mat4", code: "vec4(u_uniform[0][0], 0, 0, 0)", },
+];
+var vSource = wtu.getScript("vertexShader");
+var fSource = wtu.getScript("fragmentShader");
+var tests = [];
+for (var ii = 0; ii < uniformTypes.length; ++ii) {
+ var u1 = uniformTypes[ii];
+ var vs = wtu.replaceParams(vSource, u1);
+ for (var jj = ii + 1; jj < uniformTypes.length; ++jj) {
+ var u2 = uniformTypes[jj];
+ var fs = wtu.replaceParams(fSource, u2);
+ tests.push({
+ vShaderSource: vs,
+ vShaderSuccess: true,
+ fShaderSource: fs,
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with uniform " + u1.type + " and fragment shader with uniform " + u2.type + " with the same name should fail to link",
+ });
+ }
+}
+
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-varyings.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-varyings.html
new file mode 100644
index 0000000000..342bbc0199
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-mis-matching-varyings.html
@@ -0,0 +1,80 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// Shaders with mis-matching varying types should fail
+// GLSL 1.0.17 4.3.5
+attribute $(type) a_attribute;
+varying $(type) v_varying;
+
+void main()
+{
+ v_varying = a_attribute;
+ gl_Position = vec4(0,0,0,0);
+}
+</script>
+<script id="fragmentShader" type="text/something-not-javascript">
+// Shaders with mis-matching varyings types should fail
+// GLSL 1.0.17 4.3.5
+precision mediump float;
+
+varying $(type) v_varying;
+
+void main()
+{
+ gl_FragColor = $(code);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+var varyingTypes = [
+ { type: "float", code: "vec4(v_varying, 0, 0, 0)", },
+ { type: "vec2", code: "vec4(v_varying, 0, 0)", },
+ { type: "vec3", code: "vec4(v_varying, 0)", },
+ { type: "vec4", code: "vec4(v_varying)", },
+ { type: "mat2", code: "vec4(v_varying[0][0], 0, 0, 0)", },
+ { type: "mat3", code: "vec4(v_varying[0][0], 0, 0, 0)", },
+ { type: "mat4", code: "vec4(v_varying[0][0], 0, 0, 0)", },
+];
+var vSource = wtu.getScript("vertexShader");
+var fSource = wtu.getScript("fragmentShader");
+var tests = [];
+for (var ii = 0; ii < varyingTypes.length; ++ii) {
+ var u1 = varyingTypes[ii];
+ var vs = wtu.replaceParams(vSource, u1);
+ for (var jj = ii + 1; jj < varyingTypes.length; ++jj) {
+ var u2 = varyingTypes[jj];
+ var fs = wtu.replaceParams(fSource, u2);
+ tests.push({
+ vShaderSource: vs,
+ vShaderSuccess: true,
+ fShaderSource: fs,
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with varying " + u1.type + " and fragment shader with varying " + u2.type + " with the same name should fail to link",
+ });
+ }
+}
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-missing-varyings.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-missing-varyings.html
new file mode 100644
index 0000000000..4dab279f60
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-missing-varyings.html
@@ -0,0 +1,74 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// GLSL 1.0.17 4.3.5
+void main()
+{
+ gl_Position = vec4(0,0,0,0);
+}
+</script>
+<script id="fragmentShader" type="text/something-not-javascript">
+// GLSL 1.0.17 4.3.5
+precision mediump float;
+
+varying $(type) v_varying;
+
+void main()
+{
+ gl_FragColor = $(code);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+var varyingTypes = [
+ { type: "float", code: "vec4(v_varying, 0, 0, 0)", },
+ { type: "vec2", code: "vec4(v_varying, 0, 0)", },
+ { type: "vec3", code: "vec4(v_varying, 0)", },
+ { type: "vec4", code: "vec4(v_varying)", },
+ { type: "mat2", code: "vec4(v_varying[0][0], 0, 0, 0)", },
+ { type: "mat3", code: "vec4(v_varying[0][0], 0, 0, 0)", },
+ { type: "mat4", code: "vec4(v_varying[0][0], 0, 0, 0)", },
+];
+var vSource = wtu.getScript("vertexShader");
+var fSource = wtu.getScript("fragmentShader");
+var tests = [];
+for (var ii = 0; ii < varyingTypes.length; ++ii) {
+ var u1 = varyingTypes[ii];
+ var vs = wtu.replaceParams(vSource, u1);
+ for (var jj = ii + 1; jj < varyingTypes.length; ++jj) {
+ var u2 = varyingTypes[jj];
+ var fs = wtu.replaceParams(fSource, u2);
+ tests.push({
+ vShaderSource: vs,
+ vShaderSuccess: true,
+ fShaderSource: fs,
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader no varyings and fragment shader with varying " + u2.type + " should fail to link",
+ });
+ }
+}
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-name-conflicts.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-name-conflicts.html
new file mode 100644
index 0000000000..e4c9af8b8f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-name-conflicts.html
@@ -0,0 +1,88 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+// fragment shader should succeed
+precision mediump float;
+uniform vec4 foo;
+void main()
+{
+ gl_FragColor = foo;
+}
+</script>
+<script id="vertexShader" type="text/something-not-javascript">
+// vertex shader should succeed
+attribute vec4 foo;
+void main()
+{
+ gl_Position = foo;
+}
+</script>
+<script>
+"use strict";
+
+/*
+This test previously concluded that an attribute in a vertex shader
+would conflict across shaders with a uniform of the same name in the
+fragment shader, based on the following sections of the GLSL ES 1.0.17
+specification:
+
+---
+Section 4.2.6
+
+...
+
+With the exception of uniform declarations, vertex and fragment shaders
+have separate name spaces. Functions and global variables declared in a
+vertex shader cannot be referenced by a fragment shader and vice versa.
+Uniforms have a single name space. Uniforms declared with the same name
+must have matching types and precisions.
+
+Section 4.3.3
+
+Attribute variables are required to have global scope
+
+Section 4.3.4
+
+The uniform qualifier is used to declare global variables
+---
+
+GLSL ES 3.00 later confirmed that pipeline stages have distinct
+namespaces. The OpenGL ES working group confirmed in discussions
+https://github.com/KhronosGroup/WebGL/issues/3201 that this was the
+intended behavior for GLSL ES 1.00.
+
+For this reason, this test asserts that such usage does not generate a
+conflict.
+*/
+
+GLSLConformanceTester.runTests([
+ { vShaderId: 'vertexShader',
+ vShaderSuccess: true,
+ fShaderId: 'fragmentShader',
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'using the same name for a vertex shader attribute and fragment shader uniform should succeed'
+ },
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-uniform-structs.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-uniform-structs.html
new file mode 100644
index 0000000000..8713bd0cbe
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-uniform-structs.html
@@ -0,0 +1,289 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShaderStructSequence" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_Position = uni.pos;
+}
+</script>
+<script id="fragmentShaderStructSequence" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 color;
+ vec4 pos;
+};
+
+uniform info uni;
+void main()
+{
+ gl_FragColor = uni.color;
+}
+</script>
+<script id="vertexShaderStructName" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_Position = uni.pos;
+}
+</script>
+<script id="fragmentShaderStructNameFailure" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info1 {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info1 uni;
+void main()
+{
+ gl_FragColor = uni.color;
+}
+</script>
+<script id="fragmentShaderStructNameSuccess" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+
+// Add a struct before info to make sure the struct info here is assigned
+// a different internal unique ID from the struct info in vertex shader.
+struct extra {
+ vec4 p;
+};
+
+struct info {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ extra my;
+ my.p = uni.color;
+ gl_FragColor = my.p;
+}
+</script>
+<script id="vertexShaderStructFieldName" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_Position = uni.pos;
+}
+</script>
+<script id="fragmentShaderStructFieldName" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 pos1;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_FragColor = uni.color;
+}
+</script>
+<script id="vertexShaderStructFieldType" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_Position = uni.pos;
+}
+</script>
+<script id="fragmentShaderStructFieldType" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec3 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_FragColor = uni.color;
+}
+</script>
+<script id="vertexShaderStructFieldPrecision" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+struct info {
+ mediump vec4 pos;
+ highp vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_Position = uni.pos;
+}
+</script>
+<script id="fragmentShaderStructFieldPrecision" type="text/something-not-javascript">
+// Structures must have the same name, sequence of type names, and
+// type definitions, and field names to be considered the same type.
+// GLSL 1.017 4.2.4
+precision mediump float;
+struct info {
+ vec4 pos;
+ vec4 color;
+};
+
+uniform info uni;
+void main()
+{
+ gl_FragColor = uni.color;
+}
+</script>
+<script id="vertexShaderUnnamedStruct" type="text/something-not-javascript">
+// ANGLE regression on Windows, crbug.com/401296
+uniform struct {
+ float f;
+ vec4 v;
+} u_struct;
+
+void main()
+{
+ gl_Position = u_struct.f * u_struct.v;
+}
+</script>
+<script id="fragmentShaderSimple" type="text/something-not-javascript">
+void main()
+{
+ gl_FragColor = vec4(1.0);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+
+var tests = [];
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderStructName"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderStructNameSuccess"),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Structures with the same defination must be considered the same type.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderStructName"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderStructNameFailure"),
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "Structures must have the same name to be considered the same type.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderStructSequence"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderStructSequence"),
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "Structures must have the same sequence of type names to be considered the same type.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderStructFieldName"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderStructFieldName"),
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "Structures must have the same field names to be considered the same type.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderStructFieldType"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderStructFieldType"),
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "Structures must have the same type definitions to be considered the same type.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderStructFieldPrecision"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderStructFieldPrecision"),
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "Structures must have the same type definitions (including precision) to be considered the same type.",
+});
+tests.push({
+ vShaderSource: wtu.getScript("vertexShaderUnnamedStruct"),
+ vShaderSuccess: true,
+ fShaderSource: wtu.getScript("fragmentShaderSimple"),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Shaders with uniforms of unnamed struct type should compile and link successfully.",
+});
+
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-varyings.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-varyings.html
new file mode 100644
index 0000000000..87baaa2bdc
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shaders-with-varyings.html
@@ -0,0 +1,103 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShaderNoVarying" type="text/something-not-javascript">
+void main()
+{
+ gl_Position = vec4(0,0,0,0);
+}
+</script>
+<script id="vertexShaderUnusedVarying" type="text/something-not-javascript">
+varying vec4 v_varying;
+
+void main()
+{
+ gl_Position = vec4(0,0,0,0);
+}
+</script>
+<script id="vertexShaderUsedVarying" type="text/something-not-javascript">
+varying vec4 v_varying;
+
+void main()
+{
+ gl_Position = v_varying;
+}
+</script>
+<script id="fragmentShaderUnusedVarying" type="text/something-not-javascript">
+precision mediump float;
+
+varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = vec4(0,0,0,0);
+}
+</script>
+<script id="fragmentShaderUsedVarying" type="text/something-not-javascript">
+precision mediump float;
+
+varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
+<script>
+// GLSL 1.0.17 4.3.5
+"use strict";
+GLSLConformanceTester.runTests([
+ {
+ vShaderId: "vertexShaderNoVarying",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderUnusedVarying",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with no varying and fragment shader with unused varying must succeed",
+ },
+ {
+ vShaderId: "vertexShaderNoVarying",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderUsedVarying",
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: "vertex shader with no varying and fragment shader with used varying must fail",
+ },
+ {
+ vShaderId: "vertexShaderUnusedVarying",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderUnusedVarying",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with unused varying and fragment shader with unused varying must succeed",
+ },
+ {
+ vShaderId: "vertexShaderUnusedVarying",
+ vShaderSuccess: true,
+ fShaderId: "fragmentShaderUsedVarying",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "vertex shader with unused varying and fragment shader with used varying must succeed",
+ },
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shared.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shared.html
new file mode 100644
index 0000000000..77786bb385
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/shared.html
@@ -0,0 +1,151 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="sharedVertexShader" type="text/something-not-javascript">
+// shared vertex shader should succeed.
+uniform mat4 viewProjection;
+uniform vec3 worldPosition;
+uniform vec3 nextPosition;
+uniform float fishLength;
+uniform float fishWaveLength;
+uniform float fishBendAmount;
+attribute vec4 position;
+attribute vec2 texCoord;
+varying vec4 v_position;
+varying vec2 v_texCoord;
+varying vec3 v_surfaceToLight;
+void main() {
+ vec3 vz = normalize(worldPosition - nextPosition);
+ vec3 vx = normalize(cross(vec3(0,1,0), vz));
+ vec3 vy = cross(vz, vx);
+ mat4 orientMat = mat4(
+ vec4(vx, 0),
+ vec4(vy, 0),
+ vec4(vz, 0),
+ vec4(worldPosition, 1));
+ mat4 world = orientMat;
+ mat4 worldViewProjection = viewProjection * world;
+ mat4 worldInverseTranspose = world;
+
+ v_texCoord = texCoord;
+ // NOTE:If you change this you need to change the laser code to match!
+ float mult = position.z > 0.0 ?
+ (position.z / fishLength) :
+ (-position.z / fishLength * 2.0);
+ float s = sin(mult * fishWaveLength);
+ float a = sign(s);
+ float offset = pow(mult, 2.0) * s * fishBendAmount;
+ v_position = (
+ worldViewProjection *
+ (position +
+ vec4(offset, 0, 0, 0)));
+ v_surfaceToLight = (world * position).xyz;
+ gl_Position = v_position;
+}
+</script>
+<script id="fragmentShaderA" type="text/something-not-javascript">
+// shared fragment shader should succeed.
+precision mediump float;
+uniform vec4 lightColor;
+varying vec4 v_position;
+varying vec2 v_texCoord;
+varying vec3 v_surfaceToLight;
+
+uniform vec4 ambient;
+uniform sampler2D diffuse;
+uniform vec4 specular;
+uniform float shininess;
+uniform float specularFactor;
+// #fogUniforms
+
+vec4 lit(float l ,float h, float m) {
+ return vec4(1.0,
+ max(l, 0.0),
+ (l > 0.0) ? pow(max(0.0, h), m) : 0.0,
+ 1.0);
+}
+void main() {
+ vec4 diffuseColor = texture2D(diffuse, v_texCoord);
+ vec4 normalSpec = vec4(0,0,0,0); // #noNormalMap
+ vec3 surfaceToLight = normalize(v_surfaceToLight);
+ vec3 halfVector = normalize(surfaceToLight);
+ vec4 litR = lit(1.0, 1.0, shininess);
+ vec4 outColor = vec4(
+ (lightColor * (diffuseColor * litR.y + diffuseColor * ambient +
+ specular * litR.z * specularFactor * normalSpec.a)).rgb,
+ diffuseColor.a);
+ // #fogCode
+ gl_FragColor = outColor;
+}
+</script>
+<script id="fragmentShaderB" type="text/something-not-javascript">
+// shared fragment shader should succeed.
+precision mediump float;
+varying vec4 v_position;
+varying vec2 v_texCoord;
+varying vec3 v_surfaceToLight;
+
+// #fogUniforms
+
+vec4 lit(float l ,float h, float m) {
+ return vec4(1.0,
+ max(l, 0.0),
+ (l > 0.0) ? pow(max(0.0, h), m) : 0.0,
+ 1.0);
+}
+void main() {
+ vec4 normalSpec = vec4(0,0,0,0); // #noNormalMap
+ vec4 reflection = vec4(0,0,0,0); // #noReflection
+ vec3 surfaceToLight = normalize(v_surfaceToLight);
+ vec4 skyColor = vec4(0.5,0.5,1,1); // #noReflection
+
+ vec3 halfVector = normalize(surfaceToLight);
+ vec4 litR = lit(1.0, 1.0, 10.0);
+ vec4 outColor = vec4(mix(
+ skyColor,
+ vec4(1,2,3,4) * (litR.y + litR.z * normalSpec.a),
+ 1.0 - reflection.r).rgb,
+ 1.0);
+ // #fogCode
+ gl_FragColor = outColor;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTests([
+ { vShaderSource: document.getElementById("sharedVertexShader").text,
+ vShaderSuccess: true,
+ fShaderSource: document.getElementById("fragmentShaderA").text,
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shared fragment shader should succeed',
+ },
+ { vShaderSource: document.getElementById("sharedVertexShader").text,
+ vShaderSuccess: true,
+ fShaderSource: document.getElementById("fragmentShaderB").text,
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: 'shared fragment shader should succeed',
+ }
+]);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-inout-parameter.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-inout-parameter.html
new file mode 100644
index 0000000000..e041661477
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-inout-parameter.html
@@ -0,0 +1,117 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL Structure as Inout Parameter Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+
+<script id="simple-vs" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="struct-inout-parameter-fs" type="x-shader/x-fragment">
+struct ColorData {
+ vec3 red;
+ vec3 blue;
+};
+
+void modify(inout ColorData colorData) {
+ colorData.red += vec3(0.5, 0.0, 0.0);
+ colorData.blue += vec3(0.0, 0.0, 0.5);
+}
+
+void main() {
+ ColorData colorData;
+ colorData.red = vec3(0.5, 0.0, 0.0);
+ colorData.blue = vec3(0.0, 0.0, 0.5);
+
+ vec3 red = vec3(1.0, 0.0, 0.0);
+ vec3 green = vec3(0.0, 1.0, 0.0);
+ vec3 blue = vec3(0.0, 0.0, 1.0);
+ vec3 finalColor;
+
+ modify(colorData);
+
+ if (colorData.red == red && colorData.blue == blue)
+ finalColor = green;
+ else
+ finalColor = red;
+
+ gl_FragColor = vec4(finalColor, 1.0);
+}
+</script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("Testing structs as inout parameter");
+
+debug('Regression test for <a href="http://crbug.com/851870">http://crbug.com/851870</a> / <a href="https://github.com/mrdoob/three.js/issues/14137">https://github.com/mrdoob/three.js/issues/14137</a>');
+
+function prepend(floatPrecision) {
+ let source = document.getElementById('struct-inout-parameter-fs').text;
+ return 'precision ' + floatPrecision + ' float;\n' + source;
+}
+
+let tests = [
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderSource: prepend('lowp'),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "lowp struct used as inout parameter",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderSource: prepend('mediump'),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "mediump struct used as inout parameter",
+ },
+];
+
+let wtu = WebGLTestUtils;
+let gl = wtu.create3DContext();
+let precision = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
+let highpSupported = (precision.rangeMin >= 62 && precision.rangeMax >= 62 && precision.precision >= 16);
+debug("highp is" + (highpSupported ? "" : " not") + " supported in fragment shaders");
+
+if (highpSupported) {
+ tests.push(
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderSource: prepend('highp'),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "highp struct used as inout parameter",
+ }
+ );
+}
+
+GLSLConformanceTester.runTests(tests);
+debug("");
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-out-parameter.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-out-parameter.html
new file mode 100644
index 0000000000..4190c691e8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-as-out-parameter.html
@@ -0,0 +1,115 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL Structure as Out Parameter Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+
+<script id="simple-vs" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="struct-out-parameter-fs" type="x-shader/x-fragment">
+struct ColorData {
+ vec3 red;
+ vec3 blue;
+};
+
+void modify(out ColorData colorData) {
+ colorData.red = vec3(1.0, 0.0, 0.0);
+ colorData.blue = vec3(0.0, 0.0, 1.0);
+}
+
+void main() {
+ ColorData colorData;
+
+ vec3 red = vec3(1.0, 0.0, 0.0);
+ vec3 green = vec3(0.0, 1.0, 0.0);
+ vec3 blue = vec3(0.0, 0.0, 1.0);
+ vec3 finalColor;
+
+ modify(colorData);
+
+ if (colorData.red == red && colorData.blue == blue)
+ finalColor = green;
+ else
+ finalColor = red;
+
+ gl_FragColor = vec4(finalColor, 1.0);
+}
+</script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("Testing structs as out parameter");
+
+debug('Regression test for <a href="http://crbug.com/851873">http://crbug.com/851873</a> / <a href="https://github.com/mrdoob/three.js/issues/14137">https://github.com/mrdoob/three.js/issues/14137</a>');
+
+function prepend(floatPrecision) {
+ let source = document.getElementById('struct-out-parameter-fs').text;
+ return 'precision ' + floatPrecision + ' float;\n' + source;
+}
+
+let tests = [
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderSource: prepend('lowp'),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "lowp struct used as out parameter",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderSource: prepend('mediump'),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "mediump struct used as out parameter",
+ },
+];
+
+let wtu = WebGLTestUtils;
+let gl = wtu.create3DContext();
+let precision = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
+let highpSupported = (precision.rangeMin >= 62 && precision.rangeMax >= 62 && precision.precision >= 16);
+debug("highp is" + (highpSupported ? "" : " not") + " supported in fragment shaders");
+
+if (highpSupported) {
+ tests.push(
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderSource: prepend('highp'),
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "highp struct used as out parameter",
+ }
+ );
+}
+
+GLSLConformanceTester.runTests(tests);
+debug("");
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-assign.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-assign.html
new file mode 100644
index 0000000000..9d1d77d068
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-assign.html
@@ -0,0 +1,214 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL Structure Assignment Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+
+<script id="simple-vs" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="simple-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ float f;
+};
+
+my_struct a = my_struct(0.0);
+my_struct b = my_struct(1.0);
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ a = b;
+ if (a.f == 1.0) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="vec-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec3 v;
+};
+
+my_struct a = my_struct(vec3(0.0, 0.0, 0.0));
+my_struct b = my_struct(vec3(1.0, 2.0, 3.0));
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ a = b;
+ if (a.v.x == 1.0) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="nested-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct s1
+{
+ float f;
+};
+
+struct s2
+{
+ s1 s;
+};
+
+s2 a = s2(s1(0.0));
+s2 b = s2(s1(1.0));
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ a = b;
+ if (a.s.f == 1.0) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="nested-vec-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct s1
+{
+ vec3 v;
+};
+
+struct s2
+{
+ s1 s;
+};
+
+s2 a = s2(s1(vec3(0.0, 0.0, 0.0)));
+s2 b = s2(s1(vec3(1.0, 2.0, 3.0)));
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ a = b;
+ if (a.s.v.x == 1.0) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="array-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct my_struct
+{
+ float f[3];
+};
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ my_struct a;
+ my_struct b;
+ for (int i = 0; i < 3; ++i) {
+ a.f[i] = 0.0;
+ b.f[i] = float(i);
+ }
+
+ a = b;
+ if (a.f[1] == 1.0 && a.f[2] == 2.0) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="sampler-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct my_struct
+{
+ sampler2D s;
+};
+
+uniform my_struct a;
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ my_struct b;
+ b = a;
+}
+</script>
+</head>
+<body>
+<canvas id="canvas" width="50" height="50"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("Testing struct assignment");
+
+var wtu = WebGLTestUtils;
+GLSLConformanceTester.runTests([
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "simple-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Simple struct with one float",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "vec-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Simple struct with a vector",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "nested-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Nested struct with a float",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "nested-vec-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Nested struct with a vector",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "array-struct-fs",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Assigning a struct containing an array should not compile",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "sampler-struct-fs",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Assigning a struct containing a sampler should not compile",
+ }
+]);
+debug("");
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-equals.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-equals.html
new file mode 100644
index 0000000000..50ac40e5c6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-equals.html
@@ -0,0 +1,217 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL Structure Equals Test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+
+<script id="simple-vs" type="x-shader/x-vertex">
+attribute vec4 a_position;
+void main(void) {
+ gl_Position = a_position;
+}
+</script>
+<script id="simple-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ float f;
+};
+
+my_struct a = my_struct(1.0);
+my_struct b = my_struct(1.0);
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+
+ if (a == b) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="vec-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+struct my_struct {
+ vec3 v;
+};
+
+my_struct a = my_struct(vec3(1.0, 2.0, 3.0));
+my_struct b = my_struct(vec3(1.0, 2.0, 3.0));
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+
+ if (a == b) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="nested-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct s1
+{
+ float f;
+};
+
+struct s2
+{
+ s1 s;
+};
+
+s2 a = s2(s1(1.0));
+s2 b = s2(s1(1.0));
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+
+ if (a == b) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="nested-vec-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct s1
+{
+ vec3 v;
+};
+
+struct s2
+{
+ s1 s;
+};
+
+s2 a = s2(s1(vec3(1.0, 2.0, 3.0)));
+s2 b = s2(s1(vec3(1.0, 2.0, 3.0)));
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+
+ if (a == b) {
+ gl_FragColor.y = 1.0;
+ }
+}
+</script>
+<script id="array-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct my_struct
+{
+ float f[3];
+};
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+ my_struct a;
+ my_struct b;
+ for (int i = 0; i < 3; ++i) {
+ a.f[i] = 0.0;
+ b.f[i] = 1.0;
+ }
+
+ if (a == b) {
+ gl_FragColor.x = 1.0;
+ }
+}
+</script>
+<script id="sampler-struct-fs" type="x-shader/x-fragment">
+precision mediump float;
+
+struct my_struct
+{
+ sampler2D s;
+};
+
+uniform my_struct a;
+uniform my_struct b;
+
+void main(void) {
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+
+ if (a == b) {
+ gl_FragColor.x = 1.0;
+ }
+}
+</script>
+</head>
+<body>
+<canvas id="canvas" width="50" height="50"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("Testing struct equals");
+
+var wtu = WebGLTestUtils;
+GLSLConformanceTester.runTests([
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "simple-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Simple struct with one float",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "vec-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Simple struct with a vector",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "nested-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Nested struct with a float",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "nested-vec-struct-fs",
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true,
+ passMsg: "Nested struct with a vector",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "array-struct-fs",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Comparing a struct containing an array should not compile",
+ },
+ {
+ vShaderId: "simple-vs",
+ vShaderSuccess: true,
+ fShaderId: "sampler-struct-fs",
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Comparing a struct containing a sampler should not compile",
+ }
+]);
+debug("");
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-mixed-array-declarators.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-mixed-array-declarators.html
new file mode 100644
index 0000000000..108cee9d0f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-mixed-array-declarators.html
@@ -0,0 +1,71 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title></title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+void main() {
+ struct S {
+ $(type) field;
+ };
+ S s1[2], s2;
+ $(var).field = $(initializer);
+ gl_FragColor = $(asVec4);
+}
+</script>
+<script>
+"use strict";
+description("Verifies that mixed (array vs. not array) struct declarators work correctly.");
+var tests = [];
+var wtu = WebGLTestUtils;
+var typeInfos = [
+ { type: 'float', initializer: '1.0', asVec4: 'vec4(0.0,$(var).field,0.0,1.0)' },
+ { type: 'vec2', initializer: 'vec2(0.0, 1.0)', asVec4: 'vec4($(var).field,0.0,1.0)' },
+ { type: 'vec3', initializer: 'vec3(0.0, 1.0, 0.0)', asVec4: 'vec4($(var).field,1.0)' },
+ { type: 'vec4', initializer: 'vec4(0.0, 1.0, 0.0, 1.0)', asVec4: '$(var).field' },
+ { type: 'int', initializer: '1', asVec4: 'vec4(0.0,$(var).field,0.0,1.0)' },
+ { type: 'ivec2', initializer: 'ivec2(0, 1)', asVec4: 'vec4($(var).field,0.0,1.0)' },
+ { type: 'ivec3', initializer: 'ivec3(0, 1, 0)', asVec4: 'vec4($(var).field,1.0)' },
+ { type: 'ivec4', initializer: 'ivec4(0, 1, 0, 1)', asVec4: 'vec4($(var).field)' },
+ { type: 'bool', initializer: 'true', asVec4: 'vec4(0.0,$(var).field,0.0,1.0)' },
+ { type: 'bvec2', initializer: 'bvec2(false, true)', asVec4: 'vec4($(var).field,0.0,1.0)' },
+ { type: 'bvec3', initializer: 'bvec3(false, true, false)', asVec4: 'vec4($(var).field,1.0)' },
+ { type: 'bvec4', initializer: 'bvec4(false,true,false,true)',asVec4: 'vec4($(var).field)' },
+];
+['s1[0]', 's1[1]', 's2'].forEach(function(varName) {
+ typeInfos.forEach(function (typeInfo) {
+ var replaceParams = {
+ type: typeInfo.type,
+ initializer: typeInfo.initializer,
+ var: varName,
+ asVec4: wtu.replaceParams(typeInfo.asVec4, {var: varName})
+ };
+ tests.push({
+ fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
+ passMsg: typeInfo.type,
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render:true
+ });
+ });
+});
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-exceeds-maximum.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-exceeds-maximum.html
new file mode 100644
index 0000000000..772e47d70d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-exceeds-maximum.html
@@ -0,0 +1,55 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// shader with too-deep struct nesting should fail per WebGL spec
+struct nesting5 {
+ vec4 vecfield;
+};
+
+struct nesting4 {
+ nesting5 field5;
+};
+
+struct nesting3 {
+ nesting4 field4;
+};
+
+struct nesting2 {
+ nesting3 field3;
+};
+
+struct nesting1 {
+ nesting2 field2;
+};
+
+uniform nesting1 uniform1;
+void main()
+{
+ gl_Position = uniform1.field2.field3.field4.field5.vecfield;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-of-variable-names.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-of-variable-names.html
new file mode 100644
index 0000000000..0762628141
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-of-variable-names.html
@@ -0,0 +1,74 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title></title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+struct S { $(outer_type) u; };
+void main() {
+ S S; // This is legal, 'S' as a typename is defined in another scope.
+ {
+ struct S { $(inner_type) a; }; // This is legal as well, 'S' is now defined as a variable name in an ancestor scope
+ S newvar;
+ newvar.a = $(initializer);
+ gl_FragColor = $(fragColor);
+ }
+}
+</script>
+<script>
+"use strict";
+description("This test verifies that defining a typename in a new scope when the typename is the name of a variable that hides a typename declaration succeeds for all combinations of GLSL types.");
+var tests = [];
+var wtu = WebGLTestUtils;
+var typeInfo = [
+ { Type: 'float', initializer: '1.0', fragColor: 'vec4(0.0, newvar.a, 0.0, 1.0)' },
+ { Type: 'vec2', initializer: 'vec2(0.0, 1.0)', fragColor: 'vec4(newvar.a, 0.0, 1.0)' },
+ { Type: 'vec3', initializer: 'vec3(0.0, 1.0, 0.0)', fragColor: 'vec4(newvar.a, 1.0)' },
+ { Type: 'vec4', initializer: 'vec4(0.0, 1.0, 0.0, 1.0)', fragColor: 'newvar.a' },
+ { Type: 'int', initializer: '1', fragColor: 'vec4(0.0, newvar.a, 0.0, 1.0)' },
+ { Type: 'ivec2', initializer: 'ivec2(0, 1)', fragColor: 'vec4(newvar.a, 0.0, 1.0)' },
+ { Type: 'ivec3', initializer: 'ivec3(0, 1, 0)', fragColor: 'vec4(newvar.a, 1.0)' },
+ { Type: 'ivec4', initializer: 'ivec4(0, 1, 0, 1)', fragColor: 'vec4(newvar.a)' },
+ { Type: 'bool', initializer: 'true', fragColor: 'vec4(0.0, newvar.a, 0.0, 1.0)' },
+ { Type: 'bvec2', initializer: 'bvec2(false, true)', fragColor: 'vec4(newvar.a, 0.0, 1.0)' },
+ { Type: 'bvec3', initializer: 'bvec3(false, true, false)', fragColor: 'vec4(newvar.a, 1.0)' },
+ { Type: 'bvec4', initializer: 'bvec4(false,true,false,true)',fragColor: 'vec4(newvar.a)' },
+];
+typeInfo.forEach(function (outerType) {
+ typeInfo.forEach(function (innerType) {
+ var replaceParams = {
+ outer_type: outerType.Type,
+ inner_type: innerType.Type,
+ // use the initializer and fragColor for the inner type. Its definition should override the variable name in the outerscope.
+ initializer: innerType.initializer,
+ fragColor: innerType.fragColor
+ };
+ tests.push({
+ fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
+ passMsg: 'Outer struct type: ' + outerType.Type + ' inner struct type: ' + innerType.Type,
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true
+ });
+ })
+})
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-under-maximum.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-under-maximum.html
new file mode 100644
index 0000000000..1707e57007
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-nesting-under-maximum.html
@@ -0,0 +1,51 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vertexShader" type="text/something-not-javascript">
+// shader with struct nesting less than maximum in WebGL spec should succeed
+struct nesting4 {
+ vec4 vecfield;
+};
+
+struct nesting3 {
+ nesting4 field4;
+};
+
+struct nesting2 {
+ nesting3 field3;
+};
+
+struct nesting1 {
+ nesting2 field2;
+};
+
+uniform nesting1 uniform1;
+void main()
+{
+ gl_Position = uniform1.field2.field3.field4.vecfield;
+}
+</script>
+<script>
+"use strict";
+GLSLConformanceTester.runTest();
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-specifiers-in-uniforms.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-specifiers-in-uniforms.html
new file mode 100644
index 0000000000..3c0c704a29
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-specifiers-in-uniforms.html
@@ -0,0 +1,65 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title></title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+uniform struct S { $(type) field;} s;
+void main() {
+ // All uniforms are required to be zero initialized. Add the color green
+ // to make the rendering test pass.
+ gl_FragColor = $(asVec4) + vec4(0.0, 1.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+description("Verifies that structure specifiers work with uniforms.");
+var tests = [];
+var wtu = WebGLTestUtils;
+var typeInfos = [
+ { type: 'float', asVec4: 'vec4(0.0,s.field,0.0,0.0)' },
+ { type: 'vec2', asVec4: 'vec4(s.field,0.0,0.0)' },
+ { type: 'vec3', asVec4: 'vec4(s.field,0.0)' },
+ { type: 'vec4', asVec4: 's.field' },
+ { type: 'int', asVec4: 'vec4(0.0,s.field,0.0,0.0)' },
+ { type: 'ivec2', asVec4: 'vec4(s.field,0.0,0.0)' },
+ { type: 'ivec3', asVec4: 'vec4(s.field,0.0)' },
+ { type: 'ivec4', asVec4: 'vec4(s.field)' },
+ { type: 'bool', asVec4: 'vec4(0.0,s.field,0.0,0.0)' },
+ { type: 'bvec2', asVec4: 'vec4(s.field,0.0,0.0)' },
+ { type: 'bvec3', asVec4: 'vec4(s.field,0.0)' },
+ { type: 'bvec4', asVec4: 'vec4(s.field)' },
+];
+typeInfos.forEach(function (typeInfo) {
+ var replaceParams = {
+ type: typeInfo.type,
+ asVec4: typeInfo.asVec4
+ };
+ tests.push({
+ fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
+ passMsg: typeInfo.type,
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render:true
+ });
+});
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-unary-operators.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-unary-operators.html
new file mode 100644
index 0000000000..d14a860fd8
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/struct-unary-operators.html
@@ -0,0 +1,70 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title></title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+struct S { $(type) t; };
+void main() {
+ S a;
+ a.t = $(initializer);
+ S b = $(operator)a; // Unary operators not allowed
+ gl_FragColor = $(fragColor);
+}
+</script>
+<script>
+"use strict";
+description("This test verifies that unary operators +, ++, -, --, !, and ~ do not work on structures. Per the spec, field selectors, equality and assignment are the only operators allowed on structures.");
+var tests = [];
+var wtu = WebGLTestUtils;
+var operators = ['+', '++', '-', '--', '!', '~']
+var typeInfos = [
+ { type: 'float', initializer: '1.0', fragColor: 'vec4(0.0, b.t, 0.0, 1.0)' },
+ { type: 'vec2', initializer: 'vec2(0.0, 1.0)', fragColor: 'vec4(b.t, 0.0, 1.0)' },
+ { type: 'vec3', initializer: 'vec3(0.0, 1.0, 0.0)', fragColor: 'vec4(b.t, 1.0)' },
+ { type: 'vec4', initializer: 'vec4(0.0, 1.0, 0.0, 1.0)', fragColor: 'b.t' },
+ { type: 'int', initializer: '1', fragColor: 'vec4(0.0, b.t, 0.0, 1.0)' },
+ { type: 'ivec2', initializer: 'ivec2(0, 1)', fragColor: 'vec4(b.t, 0.0, 1.0)' },
+ { type: 'ivec3', initializer: 'ivec3(0, 1, 0)', fragColor: 'vec4(b.t, 1.0)' },
+ { type: 'ivec4', initializer: 'ivec4(0, 1, 0, 1)', fragColor: 'vec4(b.t)' },
+ { type: 'bool', initializer: 'true', fragColor: 'vec4(0.0, b.t, 0.0, 1.0)' },
+ { type: 'bvec2', initializer: 'bvec2(false, true)', fragColor: 'vec4(b.t, 0.0, 1.0)' },
+ { type: 'bvec3', initializer: 'bvec3(false, true, false)', fragColor: 'vec4(b.t, 1.0)' },
+ { type: 'bvec4', initializer: 'bvec4(false,true,false,true)',fragColor: 'vec4(b.t)' },
+];
+operators.forEach(function (operator) {
+ typeInfos.forEach(function (typeInfo) {
+ var replaceParams = {
+ initializer: typeInfo.initializer,
+ type: typeInfo.type,
+ fragColor: typeInfo.fragColor,
+ operator: operator,
+ };
+ tests.push({
+ fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
+ passMsg: 'Unary operator ' + operator + ' cannot be used on a struct with a ' + typeInfo.type,
+ fShaderSuccess: false,
+ linkSuccess: false
+ });
+ });
+});
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operator-on-arrays.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operator-on-arrays.html
new file mode 100644
index 0000000000..adeddc5e33
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operator-on-arrays.html
@@ -0,0 +1,64 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL Conformance Tests - Ternary operator on arrays</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fshader-array-ternary-operator" type="x-shader/x-fragment">
+precision mediump float;
+void main()
+{
+ float a[3];
+ float b[3];
+ float c[3] = true ? a : b;
+}
+</script>
+<script id="fshader-struct-array-ternary-operator" type="x-shader/x-fragment">
+precision mediump float;
+struct MyStruct {
+ bool a[3];
+};
+
+void main()
+{
+ MyStruct b;
+ MyStruct c;
+ MyStruct d = true ? b : c;
+}
+</script>
+<script>
+"use strict";
+description("Checks ternary operators for structs and arrays.");
+
+GLSLConformanceTester.runTests([
+{ fShaderId: 'fshader-array-ternary-operator',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "Using ternary operators with arrays is not allowed",
+},
+{ fShaderId: 'fshader-struct-array-ternary-operator',
+ fShaderSuccess: false,
+ linkSuccess: false,
+ passMsg: "By implication, using ternary operators with structs containing arrays is not allowed",
+},
+]);
+
+debug("");
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-global-initializers.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-global-initializers.html
new file mode 100644
index 0000000000..a8fe592ad0
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-global-initializers.html
@@ -0,0 +1,67 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title>Ternary Operators in Global Initializers</title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="fragmentShader" type="text/something-not-javascript">
+precision mediump float;
+const $(type) green = $(green);
+const $(type) black = $(black);
+$(type) var = (true) ? green : black;
+void main() {
+ gl_FragColor = $(asVec4);
+}
+</script>
+<script>
+"use strict";
+description("This test verifies that ternary operators can be used in global initializers.");
+var tests = [];
+var wtu = WebGLTestUtils;
+var typeInfos = [
+ { type: 'float', green: '1.0', black: '0.0', asVec4: 'vec4(0.0,var,0.0,1.0)' },
+ { type: 'vec2', green: 'vec2(0.0,1.0)', black: 'vec2(0.0,0.0)', asVec4: 'vec4(var,0.0,1.0)' },
+ { type: 'vec3', green: 'vec3(0.0,1.0,0.0)', black: 'vec3(0.0,0.0,0.0)', asVec4: 'vec4(var,1.0)' },
+ { type: 'vec4', green: 'vec4(0.0,1.0,0.0,1.0)', black: 'vec4(0.0,0.0,0.0,0.0)', asVec4: 'var' },
+ { type: 'int', green: '1', black: '0', asVec4: 'vec4(0.0,var,0.0,1.0)' },
+ { type: 'ivec2', green: 'ivec2(0,1)', black: 'ivec2(0,0)', asVec4: 'vec4(var,0.0,1.0)' },
+ { type: 'ivec3', green: 'ivec3(0,1,0)', black: 'ivec3(0,0,0)', asVec4: 'vec4(var,1.0)' },
+ { type: 'ivec4', green: 'ivec4(0,1,0,1)', black: 'ivec4(0,0,0,0)', asVec4: 'vec4(var)' },
+ { type: 'bool', green: 'true', black: 'false', asVec4: 'vec4(0.0,var,0.0,1.0)' },
+ { type: 'bvec2', green: 'bvec2(false,true)', black: 'bvec2(false,false)', asVec4: 'vec4(var,0.0,1.0)' },
+ { type: 'bvec3', green: 'bvec3(false,true,false)', black: 'bvec3(false,false,false)', asVec4: 'vec4(var,1.0)' },
+ { type: 'bvec4', green: 'bvec4(false,true,false,true)',black: 'bvec4(false,false,false,false)', asVec4: 'vec4(var)' },
+];
+typeInfos.forEach(function (typeInfo) {
+ var replaceParams = {
+ type: typeInfo.type,
+ green: typeInfo.green,
+ black: typeInfo.black,
+ asVec4: typeInfo.asVec4,
+ };
+ tests.push({
+ fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
+ passMsg: typeInfo.type,
+ fShaderSuccess: true,
+ linkSuccess: true,
+ render: true
+ });
+});
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-initializers.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-initializers.html
new file mode 100644
index 0000000000..cdbc59a5c9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/ternary-operators-in-initializers.html
@@ -0,0 +1,124 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"></script>
+<script src="../../../js/glsl-conformance-test.js"></script>
+<title></title>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script id="intFragShader" type="text/something-not-javascript">
+void main() {
+ int i = 2, j = (i > 1) ? 1 : 0;
+ gl_FragColor = vec4(0.0, j, 0.0, 1.0);
+}
+</script>
+<script id="ivec2FragShader" type="text/something-not-javascript">
+void main() {
+ ivec2 i = ivec2(2, 0), j = (i.x > 1) ? ivec2(0, 1) : ivec2(0, 0);
+ gl_FragColor = vec4(j, 0.0, 1.0);
+}
+</script>
+<script id="ivec3FragShader" type="text/something-not-javascript">
+void main() {
+ ivec3 i = ivec3(0, 2, 0), j = (i.y > 1) ? ivec3(0, 1, 0) : ivec3(0, 0, 0);
+ gl_FragColor = vec4(j, 1.0);
+}
+</script>
+<script id="ivec4FragShader" type="text/something-not-javascript">
+void main() {
+ ivec4 i = ivec4(0.0, 0.0, 2.0, 0.0), j = (i.z > 1) ? ivec4(0, 1, 0, 1) : ivec4(0, 0, 0, 1);
+ gl_FragColor = vec4(j);
+}
+</script>
+<script id="floatFragShader" type="text/something-not-javascript">
+void main() {
+ precision mediump float;
+ float i = 2.0, j = (i > 1.0) ? 1.0 : 0.0;
+ gl_FragColor = vec4(0.0, j, 0.0, 1.0);
+}
+</script>
+<script id="vec2FragShader" type="text/something-not-javascript">
+void main() {
+ precision mediump float;
+ vec2 i = vec2(2.0, 0.0), j = (i.x > 1.0) ? vec2(0.0, 1.0) : vec2(0.0, 0.0);
+ gl_FragColor = vec4(j, 0.0, 1.0);
+}
+</script>
+<script id="vec3FragShader" type="text/something-not-javascript">
+void main() {
+ precision mediump float;
+ vec3 i = vec3(0.0, 2.0, 0.0), j = (i.y > 1.0) ? vec3(0.0, 1.0, 0.0) : vec3(0.0, 0.0, 0.0);
+ gl_FragColor = vec4(j, 1.0);
+}
+</script>
+<script id="vec4FragShader" type="text/something-not-javascript">
+void main() {
+ precision mediump float;
+ vec4 i = vec4(0.0, 0.0, 2.0, 0.0), j = (i.z > 1.0) ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(0.0, 0.0, 0.0, 1.0);
+ gl_FragColor = j;
+}
+</script>
+<script id="boolFragShader" type="text/something-not-javascript">
+void main() {
+ bool i = true, j = i ? true : false;
+ gl_FragColor = vec4(0.0, j, 0.0, 1.0);
+}
+</script>
+<script id="bvec2FragShader" type="text/something-not-javascript">
+void main() {
+ bvec2 i = bvec2(true, false), j = i.x ? bvec2(false, true) : bvec2(false, false);
+ gl_FragColor = vec4(j, 0.0, 1.0);
+}
+</script>
+<script id="bvec3FragShader" type="text/something-not-javascript">
+void main() {
+ bvec3 i = bvec3(false, true, false), j = i.y ? bvec3(false, true, false) : bvec3(false, false, false);
+ gl_FragColor = vec4(j, 1.0);
+}
+</script>
+<script id="bvec4FragShader" type="text/something-not-javascript">
+void main() {
+ bvec4 i = bvec4(false, false, true, true), j = i.z ? bvec4(false, true, false, true) : bvec4(false, false, false, true);
+ gl_FragColor = vec4(j);
+}
+</script>
+<script>
+"use strict";
+description("This test verifies initializers with ternary operators correctly initialize all variables.");
+// Test fragment shaders are of the form
+// void main() {
+// {type} i = {initializer}, j = {ternary test using i that succeeds} ? : {green} : {black};
+// gl_FragColor = vec4(...); // Emit green so that test will pass
+// }
+// The fragment shader must compile and link with the default vertex shader. J must be able to use the values of I as well as have its own
+// values properly initialized.
+var tests = [
+ { fShaderId: 'intFragShader', passMsg: 'Ternary operator in integer initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'ivec2FragShader', passMsg: 'Ternary operator in ivec2 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'ivec3FragShader', passMsg: 'Ternary operator in ivec3 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'ivec4FragShader', passMsg: 'Ternary operator in ivec4 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'floatFragShader', passMsg: 'Ternary operator in float initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'vec2FragShader', passMsg: 'Ternary operator in vec2 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'vec3FragShader', passMsg: 'Ternary operator in vec3 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'vec4FragShader', passMsg: 'Ternary operator in vec4 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'boolFragShader', passMsg: 'Ternary operator in bool initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'bvec2FragShader', passMsg: 'Ternary operator in bvec2 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'bvec3FragShader', passMsg: 'Ternary operator in bvec3 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+ { fShaderId: 'bvec4FragShader', passMsg: 'Ternary operator in bvec4 initalization', fShaderSuccess: true, linkSuccess: true, render: true },
+];
+GLSLConformanceTester.runTests(tests);
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uniform-location-length-limits.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uniform-location-length-limits.html
new file mode 100644
index 0000000000..8aeaeb1937
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uniform-location-length-limits.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+<title>WebGL uniform location length tests</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+There is supposed to be an example drawing here, but it's not important.
+</canvas>
+<div id="description">Verify limits on the lengths of uniform locations per WebGL spec, "Maximum Uniform and Attribute Location Lengths".</div>
+<div id="console"></div>
+<script id="goodVertexShader" type="x-shader/x-vertex">
+// A vertex shader where the needed uniform location is exactly 256 characters.
+struct Nesting2 {
+ vec4 identifier62CharactersLong_01234567890123456789012345678901234;
+};
+
+struct Nesting1 {
+ Nesting2 identifier64CharactersLong_0123456789012345678901234567890123456;
+};
+
+uniform Nesting1 identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
+
+void main() {
+ gl_Position = identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456.identifier62CharactersLong_01234567890123456789012345678901234;
+}
+</script>
+<script id="badVertexShader" type="x-shader/x-vertex">
+// A vertex shader where the needed uniform location is 257 characters.
+struct Nesting2 {
+ vec4 identifier63CharactersLong_012345678901234567890123456789012345;
+};
+
+struct Nesting1 {
+ Nesting2 identifier64CharactersLong_0123456789012345678901234567890123456;
+};
+
+uniform Nesting1 identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
+
+void main() {
+ Nesting2 temp = identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456;
+ gl_Position = temp.identifier63CharactersLong_012345678901234567890123456789012345;
+}
+</script>
+<script id="fragmentShader" type="x-shader/x-fragment">
+precision mediump float;
+
+void main() {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+</script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+
+debug("Test uniform location underneath the length limit");
+var program = wtu.loadProgramFromScript(gl, "goodVertexShader", "fragmentShader");
+shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
+var uniformLoc = gl.getUniformLocation(program, "identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456.identifier62CharactersLong_01234567890123456789012345678901234");
+shouldBeNonNull('uniformLoc');
+wtu.glErrorShouldBe(gl, gl.NONE);
+
+debug("Test uniform location over the length limit");
+program = wtu.loadProgramFromScript(gl, "badVertexShader", "fragmentShader");
+wtu.glErrorShouldBe(gl, gl.NONE);
+shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
+var uniformLoc = gl.getUniformLocation(program, "identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456.identifier63CharactersLong_012345678901234567890123456789012345");
+wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
+shouldBeNull('uniformLoc');
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uninitialized-local-global-variables.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uninitialized-local-global-variables.html
new file mode 100644
index 0000000000..d0552af096
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/misc/uninitialized-local-global-variables.html
@@ -0,0 +1,274 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Uninitialized local/global variables should be initialized</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+
+<script id="vs_uninit_in_frag" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 a_position;
+void main() {
+ gl_Position = a_position;
+}
+</script>
+
+<!-- Uninitialized local in vertex shader -->
+<script id="vs_uninit_local_in_vert" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 a_position;
+varying vec3 v_uninit;
+void main() {
+ vec3 uninit; // uninitialized
+ v_uninit = uninit;
+ gl_Position = a_position;
+}
+</script>
+<script id="fs_uninit_local_in_vert" type="x-shader/x-fragment">
+precision mediump float;
+varying vec3 v_uninit;
+void main() {
+ gl_FragColor = v_uninit.xyzz;
+}
+</script>
+
+<!-- Uninitialized local in fragment shader -->
+<script id="fs_uninit_local_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ vec2 uninit; // uninitialized
+ gl_FragColor = uninit.xyyy;
+}
+</script>
+
+<!-- Uninitialized global in vertex shader -->
+<script id="vs_uninit_global_in_vert" type="x-shader/x-vertex">
+precision mediump float;
+attribute vec4 a_position;
+varying float v_uninit;
+float uninit; // uninitialized
+void main() {
+ v_uninit = uninit;
+ gl_Position = a_position;
+}
+</script>
+<script id="fs_uninit_global_in_vert" type="x-shader/x-fragment">
+precision mediump float;
+varying float v_uninit;
+void main() {
+ gl_FragColor = vec4(v_uninit);
+}
+</script>
+
+<!-- Uninitialized global in fragment shader -->
+<script id="fs_uninit_global_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+vec4 uninit; // uninitialized
+void main() {
+ gl_FragColor = uninit;
+}
+</script>
+
+<!-- Uninitialized local int in fragment shader -->
+<script id="fs_uninit_local_int_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ int uninit;
+ gl_FragColor = vec4(uninit);
+}
+</script>
+
+<!-- Uninitialized local variable and another variable in the same declaration using it as an initializer in fragment shader -->
+<script id="fs_uninit_two_local_variables_in_declaration_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ vec2 uninit, uninit2 = uninit;
+ gl_FragColor = uninit2.xyyy;
+}
+</script>
+
+<!-- Uninitialized local array and another variable in the same declaration using it in its initializer in fragment shader -->
+<script id="fs_uninit_array_and_another_in_declaration_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ vec2 uninit[2], uninit2 = uninit[0];
+ gl_FragColor = uninit2.xyyy;
+}
+</script>
+
+<!-- Uninitialized global int in fragment shader -->
+<script id="fs_uninit_global_int_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+int uninit; // uninitialized
+void main() {
+ gl_FragColor = vec4(uninit);
+}
+</script>
+
+<!-- Uninitialized local struct in fragment shader -->
+<script id="fs_uninit_local_struct_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+struct S { vec4 v; };
+void main() {
+ S uninit; // uninitialized
+ gl_FragColor = uninit.v;
+}
+</script>
+
+<!-- Uninitialized global struct in fragment shader -->
+<script id="fs_uninit_global_struct_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+struct S { vec4 v; };
+S uninit; // uninitialized
+void main() {
+ gl_FragColor = uninit.v;
+}
+</script>
+
+<!-- Uninitialized nameless local struct in fragment shader -->
+<script id="fs_uninit_nameless_local_struct_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ struct { vec4 v; } uninit; // uninitialized
+ gl_FragColor = uninit.v;
+}
+</script>
+
+<!-- Uninitialized nameless global struct in fragment shader -->
+<script id="fs_uninit_nameless_global_struct_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+struct { vec4 v; } uninit; // uninitialized
+void main() {
+ gl_FragColor = uninit.v;
+}
+</script>
+
+<!-- Uninitialized local bool in fragment shader -->
+<script id="fs_uninit_local_bool_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+void main() {
+ bool uninit[16]; // uninitialized
+ bool result;
+ for (int i = 0; i < 16; i++) {
+ result = result || uninit[i];
+ }
+ gl_FragColor = result ? vec4(1, 0, 0, 1) : vec4(0);
+}
+</script>
+
+<!-- Uninitialized global bool in fragment shader -->
+<script id="fs_uninit_global_bool_in_frag" type="x-shader/x-fragment">
+precision mediump float;
+bool uninit[16]; // uninitialized
+void main() {
+ bool result = false;
+ for (int i = 0; i < 16; i++) {
+ result = result || uninit[i];
+ }
+ gl_FragColor = result ? vec4(1, 0, 0, 1) : vec4(0);
+}
+</script>
+
+</head>
+<body>
+<canvas id="canvas" width="50" height="50"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description('Uninitialized local/global variables should be initialized: http://anglebug.com/1966');
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("canvas");
+wtu.setupUnitQuad(gl);
+
+var cases = [
+ {
+ name: "Uninitialized local variable in vertex shader",
+ prog: ["vs_uninit_local_in_vert", "fs_uninit_local_in_vert"],
+ },
+ {
+ name: "Uninitialized local variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_local_in_frag"],
+ },
+ {
+ name: "Uninitialized global variable in vertex shader",
+ prog: ["vs_uninit_global_in_vert", "fs_uninit_global_in_vert"],
+ },
+ {
+ name: "Uninitialized global variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_global_in_frag"],
+ },
+ {
+ name: "Uninitialized local int variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_local_int_in_frag"],
+ },
+ {
+ name: "Uninitialized local variable and another variable in the same declaration using it as an initializer in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_two_local_variables_in_declaration_in_frag"],
+ },
+ {
+ name: "Uninitialized local array and another variable in the same declaration using it in its initializer in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_array_and_another_in_declaration_in_frag"],
+ },
+ {
+ name: "Uninitialized global int variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_global_int_in_frag"],
+ },
+ {
+ name: "Uninitialized local struct variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_local_struct_in_frag"],
+ },
+ {
+ name: "Uninitialized global struct variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_global_struct_in_frag"],
+ },
+ {
+ name: "Uninitialized nameless local struct variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_nameless_local_struct_in_frag"],
+ },
+ {
+ name: "Uninitialized nameless global struct variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_nameless_global_struct_in_frag"],
+ },
+ {
+ name: "Uninitialized local bool array variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_local_bool_in_frag"],
+ },
+ {
+ name: "Uninitialized global bool array variable in fragment shader",
+ prog: ["vs_uninit_in_frag", "fs_uninit_global_bool_in_frag"],
+ },
+];
+
+function runTest() {
+ for (var i = 0; i < cases.length; ++i) {
+ debug("");
+ debug(cases[i].name);
+ var program = wtu.setupProgram(gl, cases[i].prog, ["a_position"], undefined, true);
+ gl.clearColor(1.0, 0.0, 0.0, 1.0);
+ wtu.clearAndDrawUnitQuad(gl);
+ wtu.checkCanvas(gl, [0, 0, 0, 0]);
+ }
+
+ debug("");
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
+}
+
+runTest();
+
+var successfullyParsed = true;
+</script>
+<script src="../../../js/js-test-post.js"></script>
+</body>
+</html>
+