Bug 1328559 - Pull in conformance2/programs, including new active built-in attrib test. draft
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 05 Jan 2017 01:06:54 -0800
changeset 456277 e64b83e66b046247615382b8f0d68c18e3a87018
parent 456276 459da6ee296072c68e7537387cb2257de820bf67
child 541175 b15175bf27de725b18619bbb83105aae1d40584e
push id40442
push userbmo:jgilbert@mozilla.com
push dateThu, 05 Jan 2017 09:13:26 +0000
bugs1328559
milestone53.0a1
Bug 1328559 - Pull in conformance2/programs, including new active built-in attrib test. MozReview-Commit-ID: CWX3KVcpOgw
dom/canvas/test/webgl-conf/checkout/conformance2/00_test_list.txt
dom/canvas/test/webgl-conf/checkout/conformance2/programs/00_test_list.txt
dom/canvas/test/webgl-conf/checkout/conformance2/programs/active-built-in-attribs.html
dom/canvas/test/webgl-conf/checkout/conformance2/programs/gl-get-frag-data-location.html
dom/canvas/test/webgl-conf/generated-mochitest.ini
dom/canvas/test/webgl-conf/generated/test_2_conformance2__programs__active-built-in-attribs.html
dom/canvas/test/webgl-conf/generated/test_2_conformance2__programs__gl-get-frag-data-location.html
--- a/dom/canvas/test/webgl-conf/checkout/conformance2/00_test_list.txt
+++ b/dom/canvas/test/webgl-conf/checkout/conformance2/00_test_list.txt
@@ -1,14 +1,15 @@
 attribs/00_test_list.txt
 buffers/00_test_list.txt
 context/00_test_list.txt
 extensions/00_test_list.txt
 glsl3/00_test_list.txt
 misc/00_test_list.txt
+programs/00_test_list.txt
 query/00_test_list.txt
 reading/00_test_list.txt
 renderbuffers/00_test_list.txt
 rendering/00_test_list.txt
 samplers/00_test_list.txt
 state/00_test_list.txt
 textures/00_test_list.txt
 transform_feedback/00_test_list.txt
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance2/programs/00_test_list.txt
@@ -0,0 +1,2 @@
+active-built-in-attribs.html
+gl-get-frag-data-location.html
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance2/programs/active-built-in-attribs.html
@@ -0,0 +1,107 @@
+<!--
+
+/*
+** Copyright (c) 2016 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Tests: Verify validation for active built-in attribs</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../js/desktop-gl-constants.js"></script>
+<script src="../../js/js-test-pre.js"></script>
+<script src="../../js/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<canvas id="canvas" style="width: 64px; height: 64px;"> </canvas>
+<div id="console"></div>
+<script id="vs" type="x-shader/x-vertex">#version 300 es
+void main() {
+  gl_Position = vec4(gl_VertexID % 2, (gl_VertexID/2) % 2, 0, 1);
+}
+</script>
+
+<script id="fs" type="x-shader/x-fragment">#version 300 es
+precision mediump float;
+out vec4 fragColor;
+void main() {
+  fragColor = vec4(0, 1, 0, 1);
+}
+</script>
+
+<script>
+"use strict";
+description("This test verifies validation for active built-in attribs.");
+
+debug("");
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("canvas");
+var gl = wtu.create3DContext(canvas, null, 2);
+
+if (!gl) {
+  testFailed("WebGL context does not exist");
+} else {
+  testPassed("WebGL context exists");
+  runTests();
+}
+
+var activeInfo, attribLoc;
+
+function runTests() {
+  var prog = wtu.setupProgram(gl, ["vs", "fs"]);
+  if (!prog) {
+    testFailed("Set up program failed");
+    return;
+  }
+  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from set up");
+
+  var numActive = gl.getProgramParameter(prog, gl.ACTIVE_ATTRIBUTES);
+  if (numActive != 1) {
+    testFailed('ACTIVE_ATTRIBUTES should be 1.');
+    return;
+  }
+  testPassed('ACTIVE_ATTRIBUTES should be 1.');
+
+  activeInfo = gl.getActiveAttrib(prog, 0);
+  if (!activeInfo) {
+    testFailed('getActiveAttrib should return an info object.');
+    return;
+  }
+
+  shouldBe('activeInfo.name', '"gl_VertexID"');
+  attribLoc = gl.getAttribLocation(prog, 'gl_VertexID');
+  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be able to request the location of a built-in.");
+  shouldBe('attribLoc', '-1');
+}
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/js-test-post.js"></script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance2/programs/gl-get-frag-data-location.html
@@ -0,0 +1,121 @@
+<!--
+
+/*
+** Copyright (c) 2016 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Tests: Verify getFragDataLocation</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../js/desktop-gl-constants.js"></script>
+<script src="../../js/js-test-pre.js"></script>
+<script src="../../js/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<canvas id="canvas" style="width: 4px; height: 4px;"> </canvas>
+<div id="console"></div>
+<script id="vs" type="x-shader/x-vertex">#version 300 es
+void main() {
+  gl_Position = vec4(0, 0, 0, 1);
+}
+</script>
+
+<script id="fs" type="x-shader/x-fragment">#version 300 es
+precision mediump float;
+layout(location = 2) out vec4 fragColor0;
+layout(location = 0) out vec4 fragColor1;
+void main() {
+  fragColor0 = vec4(0, 1, 0, 1);
+  fragColor1 = vec4(1, 0, 0, 1);
+}
+</script>
+
+<script id="fs-array" type="x-shader/x-fragment">#version 300 es
+precision mediump float;
+out vec4 fragColor[2];
+void main() {
+  fragColor[0] = vec4(0, 1, 0, 1);
+  fragColor[1] = vec4(1, 0, 0, 1);
+}
+</script>
+
+<script>
+"use strict";
+description("This test verifies getFragDataLocation behaviors.");
+
+debug("");
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("canvas");
+var gl = wtu.create3DContext(canvas, null, 2);
+
+if (!gl) {
+  testFailed("WebGL context does not exist");
+} else {
+  testPassed("WebGL context exists");
+  runTests();
+}
+
+function runTests() {
+  var program = wtu.setupProgram(gl, ["vs", "fs"]);
+  var programArray = wtu.setupProgram(gl, ["vs", "fs-array"]);
+  if (!program || !programArray) {
+    testFailed("Set up program failed");
+    return;
+  }
+  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from set up");
+
+  var loc0 = gl.getFragDataLocation(program, "fragColor0");
+  var loc1 = gl.getFragDataLocation(program, "fragColor1");
+  if (loc0 != 2 || loc1 != 0) {
+    testFailed("Fail to query scalar output variable locations, " +
+               "expected: fragColor0->2, fragColor1->0, " +
+               "got: fragColor0->" + loc0 + ", fragColor1->" + loc1);
+  } else {
+    testPassed("getFragDataLocation on scalar variables works fine");
+  }
+
+  var loc = gl.getFragDataLocation(programArray, "fragColor");
+  loc0 = gl.getFragDataLocation(programArray, "fragColor[0]");
+  loc1 = gl.getFragDataLocation(programArray, "fragColor[1]");
+  if (loc < 0 || loc0 < 0 || loc1 < 0 || loc != loc0 || loc0 + 1 != loc1) {
+    testFailed("Fail to query scalar output variable locations, " +
+               "expected: fragColor->0, fragColor[0]->0, fragColor[1]->1, " +
+               "got: fragColor->" + loc + ", fragColor[0]->" + loc0 + ", fragColor[1]->" + loc1);
+  } else {
+    testPassed("getFragDataLocation on variable arrays works fine");
+  }
+  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from testing");
+}
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/js-test-post.js"></script>
+
+</body>
+</html>
--- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
@@ -2451,16 +2451,19 @@ support-files = always-fail.html
                 checkout/conformance2/glsl3/short-circuiting-in-loop-condition.html
                 checkout/conformance2/glsl3/texture-offset-out-of-range.html
                 checkout/conformance2/glsl3/uniform-location-length-limits.html
                 checkout/conformance2/glsl3/vector-dynamic-indexing.html
                 checkout/conformance2/misc/00_test_list.txt
                 checkout/conformance2/misc/expando-loss-2.html
                 checkout/conformance2/misc/instanceof-test.html
                 checkout/conformance2/misc/uninitialized-test-2.html
+                checkout/conformance2/programs/00_test_list.txt
+                checkout/conformance2/programs/active-built-in-attribs.html
+                checkout/conformance2/programs/gl-get-frag-data-location.html
                 checkout/conformance2/query/00_test_list.txt
                 checkout/conformance2/query/occlusion-query.html
                 checkout/conformance2/query/query.html
                 checkout/conformance2/reading/00_test_list.txt
                 checkout/conformance2/reading/read-pixels-from-fbo-test.html
                 checkout/conformance2/reading/read-pixels-into-pixel-pack-buffer.html
                 checkout/conformance2/reading/read-pixels-pack-parameters.html
                 checkout/conformance2/renderbuffers/00_test_list.txt
@@ -4542,16 +4545,20 @@ skip-if = (os == 'win' && debug) || (os 
 [generated/test_2_conformance2__glsl3__vector-dynamic-indexing.html]
 skip-if = (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__misc__expando-loss-2.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__misc__instanceof-test.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__misc__uninitialized-test-2.html]
 skip-if = (os == 'mac') || (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
+[generated/test_2_conformance2__programs__active-built-in-attribs.html]
+skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
+[generated/test_2_conformance2__programs__gl-get-frag-data-location.html]
+skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__query__occlusion-query.html]
 skip-if = (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__query__query.html]
 skip-if = (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__reading__read-pixels-from-fbo-test.html]
 skip-if = (os == 'mac') || (os == 'win') || (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__reading__read-pixels-into-pixel-pack-buffer.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/generated/test_2_conformance2__programs__active-built-in-attribs.html
@@ -0,0 +1,17 @@
+<!-- GENERATED FILE, DO NOT EDIT -->
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <meta charset='utf-8'/>
+    <title>
+      Mochitest wrapper for WebGL Conformance Test Suite tests
+    </title>
+    <link rel='stylesheet' type='text/css' href='../iframe-passthrough.css'/>
+
+    <script src='/tests/SimpleTest/SimpleTest.js'></script>
+    <link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
+  </head>
+  <body>
+    <iframe src='../mochi-single.html?checkout/conformance2/programs/active-built-in-attribs.html?webglVersion=2'></iframe>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/generated/test_2_conformance2__programs__gl-get-frag-data-location.html
@@ -0,0 +1,17 @@
+<!-- GENERATED FILE, DO NOT EDIT -->
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <meta charset='utf-8'/>
+    <title>
+      Mochitest wrapper for WebGL Conformance Test Suite tests
+    </title>
+    <link rel='stylesheet' type='text/css' href='../iframe-passthrough.css'/>
+
+    <script src='/tests/SimpleTest/SimpleTest.js'></script>
+    <link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
+  </head>
+  <body>
+    <iframe src='../mochi-single.html?checkout/conformance2/programs/gl-get-frag-data-location.html?webglVersion=2'></iframe>
+  </body>
+</html>