diff options
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord')
8 files changed, 205 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_001_to_003.html b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_001_to_003.html new file mode 100644 index 0000000000..2118dfa105 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_001_to_003.html @@ -0,0 +1,90 @@ +<!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: gl_FragCoord_001_to_003.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", + "fragmentShader": "gl_FragCoord_xy_frag_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "gl_FragCoord_xy_frag.frag" + }, + "name": "gl_FragCoord_xy_frag.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "gl_FragCoord_z_frag_ref.vert", + "fragmentShader": "gl_FragCoord_z_frag_ref.frag", + "builtin_uniforms": { + "min_required": 2, + "valid_values": [ + "gl_DepthRange.near", + "gl_DepthRange.far", + "gl_DepthRange.diff" + ], + } + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "gl_FragCoord_z_frag.frag" + }, + "name": "gl_FragCoord_z_frag.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "uniforms": { + "result": { + "count": 1, + "type": "uniform4fv", + "value": [ + 0.5, + 0.5, + 0.5, + 1.0 + ] + } + }, + "fragmentShader": "../default/expected.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "gl_FragCoord_w_frag.frag" + }, + "name": "gl_FragCoord_w_frag.test.html", + "pattern": "compare" + } + ] +}); +var successfullyParsed = true; +</script> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_w_frag.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_w_frag.frag new file mode 100644 index 0000000000..ee8be18726 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_w_frag.frag @@ -0,0 +1,15 @@ + +/* +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 +void main(void) +{ + gl_FragColor = vec4(vec3(gl_FragCoord.w), 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_xy_frag.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_xy_frag.frag new file mode 100644 index 0000000000..772661fc5f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_xy_frag.frag @@ -0,0 +1,19 @@ + +/* +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 +uniform float viewportwidth; +uniform float viewportheight; + +void main(void) +{ + // The image width is 500 so scale the position to 0...1 for color + gl_FragColor = vec4(gl_FragCoord.x /viewportwidth , gl_FragCoord.y/viewportheight, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_xy_frag_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_xy_frag_ref.frag new file mode 100644 index 0000000000..deea9c581b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_xy_frag_ref.frag @@ -0,0 +1,20 @@ + +/* +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) +{ + // The image width is 500x500 and the rectangle is 434x434 + // The green component corresponds to x (0...1 left to right) and the + // blue component corresponds to y (0...1 bottom to top) + gl_FragColor = vec4((434.0 / 500.0) * (color.gb - 0.5) + 0.5, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag.frag new file mode 100644 index 0000000000..e81a81d803 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag.frag @@ -0,0 +1,15 @@ + +/* +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 +void main(void) +{ + gl_FragColor = vec4(vec3(gl_FragCoord.z), 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag_ref.frag new file mode 100644 index 0000000000..d66db17deb --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag_ref.frag @@ -0,0 +1,25 @@ + +/* +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 position; + +void main(void) +{ + // Normalized device coordinates + float z = position.z / position.w; + float f = gl_DepthRange.far; + float n = gl_DepthRange.near; + + // Window coordinates + z = ((f - n) / 2.0) * z + (f + n) / 2.0; + + gl_FragColor = vec4(vec3(z), 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag_ref.vert new file mode 100644 index 0000000000..3c11ffb73d --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_z_frag_ref.vert @@ -0,0 +1,19 @@ + +/* +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. +*/ + + +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 position; + +void main(void) +{ + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; + + // Vertex's clip coordinates + position = gl_Position; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/input.run.txt b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/input.run.txt new file mode 100644 index 0000000000..588cde7bff --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/gl_FragCoord/input.run.txt @@ -0,0 +1,2 @@ +# this file is auto-generated. DO NOT EDIT. +gl_FragCoord_001_to_003.html |