summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_001_to_002.html69
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag.frag24
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag_ref.frag27
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_frag.frag18
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/input.run.txt2
5 files changed, 140 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_001_to_002.html b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_001_to_002.html
new file mode 100644
index 0000000000..d976162551
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_001_to_002.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<!-- this file is auto-generated. DO NOT EDIT. -->
+<!--
+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.
+-->
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL GLSL conformance test: discard_001_to_002.html</title>
+<link rel="stylesheet" href="../../../../resources/js-test-style.css" />
+<link rel="stylesheet" href="../../../../resources/ogles-tests.css" />
+<script src="../../../../js/js-test-pre.js"></script>
+<script src="../../../../js/webgl-test-utils.js"></script>
+<script src="../../ogles-utils.js"></script>
+</head>
+<body>
+<canvas id="example" width="500" height="500" style="width: 16px; height: 16px;"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+</body>
+<script>
+"use strict";
+OpenGLESTestRunner.run({
+ "tests": [
+ {
+ "referenceProgram": {
+ "vertexShader": "../default/default.vert",
+ "uniforms": {
+ "result": {
+ "count": 1,
+ "type": "uniform4fv",
+ "value": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ }
+ },
+ "fragmentShader": "../default/expected.frag"
+ },
+ "model": null,
+ "testProgram": {
+ "vertexShader": "../default/default.vert",
+ "fragmentShader": "discard_frag.frag"
+ },
+ "name": "discard_frag.test.html",
+ "pattern": "compare"
+ },
+ {
+ "referenceProgram": {
+ "vertexShader": "../default/default.vert",
+ "fragmentShader": "discard_cond_frag_ref.frag"
+ },
+ "model": null,
+ "testProgram": {
+ "vertexShader": "../default/default.vert",
+ "fragmentShader": "discard_cond_frag.frag"
+ },
+ "name": "discard_cond_frag.test.html",
+ "pattern": "compare"
+ }
+ ]
+});
+var successfullyParsed = true;
+</script>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag.frag
new file mode 100644
index 0000000000..31de4525c1
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag.frag
@@ -0,0 +1,24 @@
+
+/*
+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.
+*/
+
+
+#ifdef GL_ES
+precision mediump float;
+#endif
+varying vec4 color;
+
+void main (void)
+{
+ bool toDiscard = false;
+ if(color.r > 0.75) toDiscard = true;
+ else if(color.g > 0.75) toDiscard = true;
+ else if(color.b > 0.75) toDiscard = true;
+
+ if (toDiscard) discard;
+
+ gl_FragColor = color;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag_ref.frag
new file mode 100644
index 0000000000..f455d1f57e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_cond_frag_ref.frag
@@ -0,0 +1,27 @@
+
+/*
+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.
+*/
+
+
+#ifdef GL_ES
+precision mediump float;
+#endif
+varying vec4 color;
+
+void main (void)
+{
+ if(color.r > 0.75 || color.g > 0.75 || color.b > 0.75)
+ {
+ /* The background color is black by default.
+ * Setting the fragment color to it simulates a discarded fragment.
+ */
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+ }
+ else
+ {
+ gl_FragColor = color;
+ }
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_frag.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_frag.frag
new file mode 100644
index 0000000000..c88776fb38
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/discard_frag.frag
@@ -0,0 +1,18 @@
+
+/*
+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.
+*/
+
+
+#ifdef GL_ES
+precision mediump float;
+#endif
+varying vec4 color;
+
+void main (void)
+{
+ gl_FragColor = color;
+ discard;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/input.run.txt b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/input.run.txt
new file mode 100644
index 0000000000..ff9bfa993d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/discard/input.run.txt
@@ -0,0 +1,2 @@
+# this file is auto-generated. DO NOT EDIT.
+discard_001_to_002.html