summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-11 13:18:11 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-11 13:18:11 +0200
commit8f2ada03fdc3ab43f5da76df4e55edd6067cecfe (patch)
treeac683249d167b87f80cf18a0fe50d8dae0708fdd
parent5b2b090a1569379fcbf213078c9c708510413856 (diff)
downloaduxp-8f2ada03fdc3ab43f5da76df4e55edd6067cecfe.tar.gz
Update array-length-side-effects.html conformance test.
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance2/glsl3/array-length-side-effects.html49
1 files changed, 32 insertions, 17 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance2/glsl3/array-length-side-effects.html b/dom/canvas/test/webgl-conf/checkout/conformance2/glsl3/array-length-side-effects.html
index 68df48073f..53f512714a 100644
--- a/dom/canvas/test/webgl-conf/checkout/conformance2/glsl3/array-length-side-effects.html
+++ b/dom/canvas/test/webgl-conf/checkout/conformance2/glsl3/array-length-side-effects.html
@@ -29,7 +29,7 @@
<html>
<head>
<meta charset="utf-8">
-<title>GLSL: test that length() method called on a complex expression does not compile</title>
+<title>GLSL: test that length() method called on a complex expression works</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>
@@ -45,10 +45,14 @@ precision mediump float;
out vec4 my_FragColor;
void main() {
- int a[3];
- int b[3];
+ int a[3] = int[3](1, 2, 3);
+ int b[3] = int[3](4, 5, 6);
int c = (a = b).length();
- my_FragColor = vec4(float(c));
+ if (c == 3 && a[0] == 4 && a[1] == 5 && a[2] == 6) {
+ my_FragColor = vec4(0, 1, 0, 1);
+ } else {
+ my_FragColor = vec4(1, 0, 0, 1);
+ }
}
</script>
<script id="fshaderLengthOfFunctionCall" type="x-shader/x-fragment">#version 300 es
@@ -56,14 +60,21 @@ precision mediump float;
out vec4 my_FragColor;
+int sideEffectCounter = 0;
+
int[2] func() {
+ ++sideEffectCounter;
int a[2];
return a;
}
void main() {
int b = (func()).length();
- my_FragColor = vec4(float(b));
+ if (sideEffectCounter == 1 && b == 2) {
+ my_FragColor = vec4(0, 1, 0, 1);
+ } else {
+ my_FragColor = vec4(1, 0, 0, 1);
+ }
}
</script>
<script id="fshaderLengthOfConstructor" type="x-shader/x-fragment">#version 300 es
@@ -73,31 +84,35 @@ out vec4 my_FragColor;
void main() {
int a = (int[1](0)).length();
- my_FragColor = vec4(float(a));
+ if (a == 1) {
+ my_FragColor = vec4(0, 1, 0, 1);
+ } else {
+ my_FragColor = vec4(1, 0, 0, 1);
+ }
}
</script>
<script type="application/javascript">
"use strict";
description();
-debug("These restrictions come from ESSL 3.00 section 5.9 definition of expression, which only allows length to be called on array names, not on arbitrary expressions returning an array.");
-GLSLConformanceTester.runTests([
+debug('length() method is allowed to be called on arbitrary expressions returning arrays. ESSL 3.00 section 5.9 says that length is allowed on "array names", but ESSL 3.20 has newer, clarified wording that says that it is allowed for "arrays". This was always the intent of the spec.');
+GLSLConformanceTester.runRenderTests([
{
fShaderId: "fshaderLengthOfAssignment",
- fShaderSuccess: false,
- linkSuccess: false,
- passMsg: "Fragment shader which tries to evaluate the length of an assignment operation should fail."
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Fragment shader which tries to evaluate the length of an assignment operation should succeed."
},
{
fShaderId: "fshaderLengthOfFunctionCall",
- fShaderSuccess: false,
- linkSuccess: false,
- passMsg: "Fragment shader which tries to evaluate the length of a return value should fail."
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Fragment shader which tries to evaluate the length of a return value should succeed."
},
{
fShaderId: "fshaderLengthOfConstructor",
- fShaderSuccess: false,
- linkSuccess: false,
- passMsg: "Fragment shader which tries to evaluate the length of a newly constructed array should fail."
+ fShaderSuccess: true,
+ linkSuccess: true,
+ passMsg: "Fragment shader which tries to evaluate the length of a newly constructed array should succeed."
}
], 2);
</script>