diff options
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2')
27 files changed, 897 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/input.run.txt b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/input.run.txt new file mode 100644 index 0000000000..4205bf17ca --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/input.run.txt @@ -0,0 +1,3 @@ +# this file is auto-generated. DO NOT EDIT. +log2_001_to_008.html +log2_009_to_012.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_001_to_008.html b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_001_to_008.html new file mode 100644 index 0000000000..53dc3e0f8f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_001_to_008.html @@ -0,0 +1,135 @@ +<!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: log2_001_to_008.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": "log2_float_frag_xvary_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_float_frag_xvary.frag" + }, + "name": "log2_float_frag_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_float_frag_xvary01_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_float_frag_xvary01.frag" + }, + "name": "log2_float_frag_xvary01.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec2_frag_xvary_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec2_frag_xvary.frag" + }, + "name": "log2_vec2_frag_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec2_frag_xvary01_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec2_frag_xvary01.frag" + }, + "name": "log2_vec2_frag_xvary01.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec3_frag_xvary_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec3_frag_xvary.frag" + }, + "name": "log2_vec3_frag_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec3_frag_xvary01_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "log2_vec3_frag_xvary01.frag" + }, + "name": "log2_vec3_frag_xvary01.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "log2_float_vert_xvary_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "log2_float_vert_xvary.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "log2_float_vert_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "log2_float_vert_xvary01_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "log2_float_vert_xvary01.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "log2_float_vert_xvary01.test.html", + "pattern": "compare" + } + ] +}); +var successfullyParsed = true; +</script> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_009_to_012.html b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_009_to_012.html new file mode 100644 index 0000000000..a7644b3792 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_009_to_012.html @@ -0,0 +1,83 @@ +<!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: log2_009_to_012.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": "log2_vec2_vert_xvary_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "log2_vec2_vert_xvary.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "log2_vec2_vert_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "log2_vec2_vert_xvary01_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "log2_vec2_vert_xvary01.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "log2_vec2_vert_xvary01.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "log2_vec3_vert_xvary_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "log2_vec3_vert_xvary.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "log2_vec3_vert_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "log2_vec3_vert_xvary01_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "log2_vec3_vert_xvary01.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "log2_vec3_vert_xvary01.test.html", + "pattern": "compare" + } + ] +}); +var successfullyParsed = true; +</script> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary.frag new file mode 100644 index 0000000000..ad8169e98b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary.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) +{ + float c = 31.0 * color.r + 1.0; + gl_FragColor = vec4(log2(c) / 5.0, 0.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary01.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary01.frag new file mode 100644 index 0000000000..ccbdc87177 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary01.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) +{ + float c = (color.r + 0.01) / 1.01; + gl_FragColor = vec4(log2(c) / -8.0, 0.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary01_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary01_ref.frag new file mode 100644 index 0000000000..ff9edaee40 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary01_ref.frag @@ -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. +*/ + + +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + float x = (color.r + 0.01) / 1.01; + float y = 0.0; + float z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + // Note: z will always be negative between 0.01 and 1.0 and + // so will y since it is raised to an odd power, and the shader spec + // does not support pow(-x, y) where y is not a compile time constant + z = abs((x - 1.0) / (x + 1.0)); + float p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= -2.0 / ln2; + + gl_FragColor = vec4(y / -8.0, 0.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary_ref.frag new file mode 100644 index 0000000000..778cdcd14a --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_frag_xvary_ref.frag @@ -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. +*/ + + +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + float x = 31.0 * color.r + 1.0; + float y = 0.0; + float z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + z = (x - 1.0) / (x + 1.0); + float p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= 2.0 / ln2; + + gl_FragColor = vec4(y / 5.0, 0.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary.vert new file mode 100644 index 0000000000..4015613d2f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary.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_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; + +void main (void) +{ + float c = 31.0 * gtf_Color.r + 1.0; + color = vec4(log2(c) / 5.0, 0.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary01.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary01.vert new file mode 100644 index 0000000000..1cf60f89c7 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary01.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_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; + +void main (void) +{ + float c = (gtf_Color.r + 0.01) / 1.01; + color = vec4(log2(c) / -8.0, 0.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary01_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary01_ref.vert new file mode 100644 index 0000000000..8589a5eb35 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary01_ref.vert @@ -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. +*/ + + +attribute vec4 gtf_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + float x = (gtf_Color.r + 0.01) / 1.01; + float y = 0.0; + float z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + // Note: z will always be negative between 0.01 and 1.0 and + // so will y since it is raised to an odd power, and the shader spec + // does not support pow(-x, y) where y is not a compile time constant + z = abs((x - 1.0) / (x + 1.0)); + float p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= -2.0 / ln2; + + color = vec4(y / -8.0, 0.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary_ref.vert new file mode 100644 index 0000000000..ed2d0feb45 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_float_vert_xvary_ref.vert @@ -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. +*/ + + +attribute vec4 gtf_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + +void main (void) +{ + float x = 31.0 * gtf_Color.r + 1.0; + float y = 0.0; + float z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + z = (x - 1.0) / (x + 1.0); + float p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= 2.0 / ln2; + + color = vec4(y / 5.0, 0.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary.frag new file mode 100644 index 0000000000..2ee68d590c --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary.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) +{ + vec2 c = 31.0 * color.rg + 1.0; + gl_FragColor = vec4(log2(c) / 5.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary01.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary01.frag new file mode 100644 index 0000000000..3dd8484bc8 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary01.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) +{ + vec2 c = (color.rg + 0.01) / 1.01; + gl_FragColor = vec4(log2(c) / -8.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary01_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary01_ref.frag new file mode 100644 index 0000000000..ab307fadc5 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary01_ref.frag @@ -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. +*/ + + +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec2 x = (color.rg + 0.01) / 1.01; + vec2 y = vec2(0.0); + vec2 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + // Note: z will always be negative between 0.01 and 1.0 and + // so will y since it is raised to an odd power, and the shader spec + // does not support pow(-x, y) where y is not a compile time constant + z = abs((x - 1.0) / (x + 1.0)); + vec2 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= -2.0 / ln2; + + gl_FragColor = vec4(y / -8.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary_ref.frag new file mode 100644 index 0000000000..9f54de2a2b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_frag_xvary_ref.frag @@ -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. +*/ + + +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec2 x = 31.0 * color.rg + 1.0; + vec2 y = vec2(0.0); + vec2 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + z = (x - 1.0) / (x + 1.0); + vec2 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= 2.0 / ln2; + + gl_FragColor = vec4(y / 5.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary.vert new file mode 100644 index 0000000000..2f07daaa42 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary.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_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; + +void main (void) +{ + vec2 c = 31.0 * gtf_Color.rg + 1.0; + color = vec4(log2(c) / 5.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary01.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary01.vert new file mode 100644 index 0000000000..64312ac8d6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary01.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_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; + +void main (void) +{ + vec2 c = (gtf_Color.rg + 0.01) / 1.01; + color = vec4(log2(c) / -8.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary01_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary01_ref.vert new file mode 100644 index 0000000000..e0a8cf3419 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary01_ref.vert @@ -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. +*/ + + +attribute vec4 gtf_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec2 x = (gtf_Color.rg + 0.01) / 1.01; + vec2 y = vec2(0.0); + vec2 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + // Note: z will always be negative between 0.01 and 1.0 and + // so will y since it is raised to an odd power, and the shader spec + // does not support pow(-x, y) where y is not a compile time constant + z = abs((x - 1.0) / (x + 1.0)); + vec2 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= -2.0 / ln2; + + color = vec4(y / -8.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary_ref.vert new file mode 100644 index 0000000000..744dfda43f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec2_vert_xvary_ref.vert @@ -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. +*/ + + +attribute vec4 gtf_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec2 x = 31.0 * gtf_Color.rg + 1.0; + vec2 y = vec2(0.0); + vec2 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + z = (x - 1.0) / (x + 1.0); + vec2 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= 2.0 / ln2; + + color = vec4(y / 5.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary.frag new file mode 100644 index 0000000000..5cecf12102 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary.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) +{ + vec3 c = 31.0 * color.rgb + 1.0; + gl_FragColor = vec4(log2(c) / 5.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary01.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary01.frag new file mode 100644 index 0000000000..098e2f9555 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary01.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) +{ + vec3 c = (color.rgb + 0.01) / 1.01; + gl_FragColor = vec4(log2(c) / -8.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary01_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary01_ref.frag new file mode 100644 index 0000000000..5cdf6af9ca --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary01_ref.frag @@ -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. +*/ + + +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec3 x = (color.rgb + 0.01) / 1.01; + vec3 y = vec3(0.0); + vec3 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + // Note: z will always be negative between 0.01 and 1.0 and + // so will y since it is raised to an odd power, and the shader spec + // does not support pow(-x, y) where y is not a compile time constant + z = abs((x - 1.0) / (x + 1.0)); + vec3 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= -2.0 / ln2; + + gl_FragColor = vec4(y / -8.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary_ref.frag new file mode 100644 index 0000000000..d7303ef677 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_frag_xvary_ref.frag @@ -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. +*/ + + +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec3 x = 31.0 * color.rgb + 1.0; + vec3 y = vec3(0.0); + vec3 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + z = (x - 1.0) / (x + 1.0); + vec3 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= 2.0 / ln2; + + gl_FragColor = vec4(y / 5.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary.vert new file mode 100644 index 0000000000..26a270b80d --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary.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_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; + +void main (void) +{ + vec3 c = 31.0 * gtf_Color.rgb + 1.0; + color = vec4(log2(c) / 5.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary01.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary01.vert new file mode 100644 index 0000000000..3f8c464f31 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary01.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_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; + +void main (void) +{ + vec3 c = (gtf_Color.rgb + 0.01) / 1.01; + color = vec4(log2(c) / -8.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary01_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary01_ref.vert new file mode 100644 index 0000000000..97bfe7775d --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary01_ref.vert @@ -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. +*/ + + +attribute vec4 gtf_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec3 x = (gtf_Color.rgb + 0.01) / 1.01; + vec3 y = vec3(0.0); + vec3 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + // Note: z will always be negative between 0.01 and 1.0 and + // so will y since it is raised to an odd power, and the shader spec + // does not support pow(-x, y) where y is not a compile time constant + z = abs((x - 1.0) / (x + 1.0)); + vec3 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= -2.0 / ln2; + + color = vec4(y / -8.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary_ref.vert new file mode 100644 index 0000000000..de23394ff0 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/log2/log2_vec3_vert_xvary_ref.vert @@ -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. +*/ + + +attribute vec4 gtf_Color; +attribute vec4 gtf_Vertex; +uniform mat4 gtf_ModelViewProjectionMatrix; +varying vec4 color; +const float ln2 = 0.69314718055994530941723212145818; + + + +void main (void) +{ + vec3 x = 31.0 * gtf_Color.rgb + 1.0; + vec3 y = vec3(0.0); + vec3 z; // x-1 / x+1 + int n = 50; + + // ln(x) = 2[x-1 + 1 (x-1)^3 + 1 (x-1)^5 + ...] for x > 0 + // [x+1 3 (x+1) 5 (x+1) ] + z = (x - 1.0) / (x + 1.0); + vec3 p = z; + for(int i = 1; i <= 101; i += 2) + { + y += p / float(i); + p *= z * z; + } + y *= 2.0 / ln2; + + color = vec4(y / 5.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} |