diff options
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin')
14 files changed, 744 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/input.run.txt b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/input.run.txt new file mode 100644 index 0000000000..2995c56588 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/input.run.txt @@ -0,0 +1,2 @@ +# this file is auto-generated. DO NOT EDIT. +sin_001_to_006.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_001_to_006.html b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_001_to_006.html new file mode 100644 index 0000000000..16e5039800 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_001_to_006.html @@ -0,0 +1,109 @@ +<!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: sin_001_to_006.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": "sin_float_frag_xvary_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "sin_float_frag_xvary.frag" + }, + "name": "sin_float_frag_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "sin_vec2_frag_xvary_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "sin_vec2_frag_xvary.frag" + }, + "name": "sin_vec2_frag_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "sin_vec3_frag_xvary_ref.frag" + }, + "model": null, + "testProgram": { + "vertexShader": "../default/default.vert", + "fragmentShader": "sin_vec3_frag_xvary.frag" + }, + "name": "sin_vec3_frag_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "sin_float_vert_xvary_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "sin_float_vert_xvary.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "sin_float_vert_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "sin_vec2_vert_xvary_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "sin_vec2_vert_xvary.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "sin_vec2_vert_xvary.test.html", + "pattern": "compare" + }, + { + "referenceProgram": { + "vertexShader": "sin_vec3_vert_xvary_ref.vert", + "fragmentShader": "../default/default.frag" + }, + "model": "grid", + "testProgram": { + "vertexShader": "sin_vec3_vert_xvary.vert", + "fragmentShader": "../default/default.frag" + }, + "name": "sin_vec3_vert_xvary.test.html", + "pattern": "compare" + } + ] +}); +var successfullyParsed = true; +</script> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_frag_xvary.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_frag_xvary.frag new file mode 100644 index 0000000000..d3eb4c8702 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_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) +{ + const float M_PI = 3.14159265358979323846; + gl_FragColor = vec4(0.5 * sin(2.0 * M_PI * color.r) + 0.5, 0.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_frag_xvary_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_frag_xvary_ref.frag new file mode 100644 index 0000000000..b8f6613004 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_frag_xvary_ref.frag @@ -0,0 +1,84 @@ + +/* +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; + +float lerp(float a, float b, float s) +{ + return a + (b - a) * s; +} + +void main (void) +{ + float sinValues[17]; + sinValues[0] = 0.0; + sinValues[1] = 0.382683; + sinValues[2] = 0.707107; + sinValues[3] = 0.92388; + sinValues[4] = 1.0; + sinValues[5] = 0.92388; + sinValues[6] = 0.707107; + sinValues[7] = 0.382683; + sinValues[8] = 0.0; + sinValues[9] = -0.382683; + sinValues[10] = -0.707107; + sinValues[11] = -0.92388; + sinValues[12] = -1.0; + sinValues[13] = -0.923879; + sinValues[14] = -0.707107; + sinValues[15] = -0.382683; + sinValues[16] = 0.0; + + const float M_PI = 3.14159265358979323846; + float c = 2.0 * M_PI * color.r; + + float arrVal = c * 2.546478971; + int arr0 = int(floor(arrVal)); + float weight = arrVal - floor(arrVal); + float sin_c = 0.0; + + if (arr0 == 0) + sin_c = lerp(sinValues[0], sinValues[1], weight); + else if (arr0 == 1) + sin_c = lerp(sinValues[1], sinValues[2], weight); + else if (arr0 == 2) + sin_c = lerp(sinValues[2], sinValues[3], weight); + else if (arr0 == 3) + sin_c = lerp(sinValues[3], sinValues[4], weight); + else if (arr0 == 4) + sin_c = lerp(sinValues[4], sinValues[5], weight); + else if (arr0 == 5) + sin_c = lerp(sinValues[5], sinValues[6], weight); + else if (arr0 == 6) + sin_c = lerp(sinValues[6], sinValues[7], weight); + else if (arr0 == 7) + sin_c = lerp(sinValues[7], sinValues[8], weight); + else if (arr0 == 8) + sin_c = lerp(sinValues[8], sinValues[9], weight); + else if (arr0 == 9) + sin_c = lerp(sinValues[9], sinValues[10], weight); + else if (arr0 == 10) + sin_c = lerp(sinValues[10], sinValues[11], weight); + else if (arr0 == 11) + sin_c = lerp(sinValues[11], sinValues[12], weight); + else if (arr0 == 12) + sin_c = lerp(sinValues[12], sinValues[13], weight); + else if (arr0 == 13) + sin_c = lerp(sinValues[13], sinValues[14], weight); + else if (arr0 == 14) + sin_c = lerp(sinValues[14], sinValues[15], weight); + else if (arr0 == 15) + sin_c = lerp(sinValues[15], sinValues[16], weight); + else if (arr0 == 16) + sin_c = sinValues[16]; + + gl_FragColor = vec4(0.5 * sin_c + 0.5, 0.0, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_vert_xvary.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_vert_xvary.vert new file mode 100644 index 0000000000..fe39395cce --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_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) +{ + const float M_PI = 3.14159265358979323846; + color = vec4(0.5 * sin(2.0 * M_PI * gtf_Color.r) + 0.5, 0.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_vert_xvary_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_vert_xvary_ref.vert new file mode 100644 index 0000000000..68292455db --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_float_vert_xvary_ref.vert @@ -0,0 +1,38 @@ + +/* +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) +{ + const float M_PI = 3.14159265358979323846; + float c = 2.0 * M_PI * gtf_Color.r; + float sign = 1.0; + + float sin_c = 0.0; + float fact; + float fact_of; + + // Taylors series expansion for sin + for(int i = 0; i < 12; i++) + { + fact = 1.0; + for(int j = 2; j <= 23; j++) + if (j <= 2 * i + 1) + fact *= float(j); + + sin_c += sign * pow(c, 2.0 * float(i) + 1.0) / fact; + sign *= -1.0; + } + + color = vec4(0.5 * sin_c + 0.5, 0.0, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_frag_xvary.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_frag_xvary.frag new file mode 100644 index 0000000000..efb9c543b4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_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) +{ + const float M_PI = 3.14159265358979323846; + gl_FragColor = vec4(0.5 * sin(2.0 * M_PI * color.rg) + 0.5, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_frag_xvary_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_frag_xvary_ref.frag new file mode 100644 index 0000000000..504e8b98b9 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_frag_xvary_ref.frag @@ -0,0 +1,120 @@ + +/* +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; + +float lerp(float a, float b, float s) +{ + return a + (b - a) * s; +} + +void main (void) +{ + float sinValues[17]; + sinValues[0] = 0.0; + sinValues[1] = 0.382683; + sinValues[2] = 0.707107; + sinValues[3] = 0.92388; + sinValues[4] = 1.0; + sinValues[5] = 0.92388; + sinValues[6] = 0.707107; + sinValues[7] = 0.382683; + sinValues[8] = 0.0; + sinValues[9] = -0.382683; + sinValues[10] = -0.707107; + sinValues[11] = -0.92388; + sinValues[12] = -1.0; + sinValues[13] = -0.923879; + sinValues[14] = -0.707107; + sinValues[15] = -0.382683; + sinValues[16] = 0.0; + + const float M_PI = 3.14159265358979323846; + vec2 c = 2.0 * M_PI * color.rg; + + vec2 arrVal = c * 2.546478971; + int arr0x = int(floor(arrVal.x)); + int arr0y = int(floor(arrVal.y)); + vec2 weight = arrVal - floor(arrVal); + vec2 sin_c = vec2(0.0, 0.0); + + if (arr0x == 0) + sin_c.x = lerp(sinValues[0], sinValues[1], weight.x); + else if (arr0x == 1) + sin_c.x = lerp(sinValues[1], sinValues[2], weight.x); + else if (arr0x == 2) + sin_c.x = lerp(sinValues[2], sinValues[3], weight.x); + else if (arr0x == 3) + sin_c.x = lerp(sinValues[3], sinValues[4], weight.x); + else if (arr0x == 4) + sin_c.x = lerp(sinValues[4], sinValues[5], weight.x); + else if (arr0x == 5) + sin_c.x = lerp(sinValues[5], sinValues[6], weight.x); + else if (arr0x == 6) + sin_c.x = lerp(sinValues[6], sinValues[7], weight.x); + else if (arr0x == 7) + sin_c.x = lerp(sinValues[7], sinValues[8], weight.x); + else if (arr0x == 8) + sin_c.x = lerp(sinValues[8], sinValues[9], weight.x); + else if (arr0x == 9) + sin_c.x = lerp(sinValues[9], sinValues[10], weight.x); + else if (arr0x == 10) + sin_c.x = lerp(sinValues[10], sinValues[11], weight.x); + else if (arr0x == 11) + sin_c.x = lerp(sinValues[11], sinValues[12], weight.x); + else if (arr0x == 12) + sin_c.x = lerp(sinValues[12], sinValues[13], weight.x); + else if (arr0x == 13) + sin_c.x = lerp(sinValues[13], sinValues[14], weight.x); + else if (arr0x == 14) + sin_c.x = lerp(sinValues[14], sinValues[15], weight.x); + else if (arr0x == 15) + sin_c.x = lerp(sinValues[15], sinValues[16], weight.x); + else if (arr0x == 16) + sin_c.x = sinValues[16]; + + if (arr0y == 0) + sin_c.y = lerp(sinValues[0], sinValues[1], weight.y); + else if (arr0y == 1) + sin_c.y = lerp(sinValues[1], sinValues[2], weight.y); + else if (arr0y == 2) + sin_c.y = lerp(sinValues[2], sinValues[3], weight.y); + else if (arr0y == 3) + sin_c.y = lerp(sinValues[3], sinValues[4], weight.y); + else if (arr0y == 4) + sin_c.y = lerp(sinValues[4], sinValues[5], weight.y); + else if (arr0y == 5) + sin_c.y = lerp(sinValues[5], sinValues[6], weight.y); + else if (arr0y == 6) + sin_c.y = lerp(sinValues[6], sinValues[7], weight.y); + else if (arr0y == 7) + sin_c.y = lerp(sinValues[7], sinValues[8], weight.y); + else if (arr0y == 8) + sin_c.y = lerp(sinValues[8], sinValues[9], weight.y); + else if (arr0y == 9) + sin_c.y = lerp(sinValues[9], sinValues[10], weight.y); + else if (arr0y == 10) + sin_c.y = lerp(sinValues[10], sinValues[11], weight.y); + else if (arr0y == 11) + sin_c.y = lerp(sinValues[11], sinValues[12], weight.y); + else if (arr0y == 12) + sin_c.y = lerp(sinValues[12], sinValues[13], weight.y); + else if (arr0y == 13) + sin_c.y = lerp(sinValues[13], sinValues[14], weight.y); + else if (arr0y == 14) + sin_c.y = lerp(sinValues[14], sinValues[15], weight.y); + else if (arr0y == 15) + sin_c.y = lerp(sinValues[15], sinValues[16], weight.y); + else if (arr0y == 16) + sin_c.y = sinValues[16]; + + gl_FragColor = vec4(0.5 * sin_c + 0.5, 0.0, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_vert_xvary.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_vert_xvary.vert new file mode 100644 index 0000000000..910f090ce6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_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) +{ + const float M_PI = 3.14159265358979323846; + color = vec4(0.5 * sin(2.0 * M_PI * gtf_Color.rg) + 0.5, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_vert_xvary_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_vert_xvary_ref.vert new file mode 100644 index 0000000000..3d1567e142 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec2_vert_xvary_ref.vert @@ -0,0 +1,62 @@ + +/* +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; + +float lerp(float a, float b, float s) +{ + return a + (b - a) * s; +} + +void main (void) +{ + float sinValues[17]; + sinValues[0] = 0.0; + sinValues[1] = 0.382683; + sinValues[2] = 0.707107; + sinValues[3] = 0.92388; + sinValues[4] = 1.0; + sinValues[5] = 0.92388; + sinValues[6] = 0.707107; + sinValues[7] = 0.382683; + sinValues[8] = 0.0; + sinValues[9] = -0.382683; + sinValues[10] = -0.707107; + sinValues[11] = -0.92388; + sinValues[12] = -1.0; + sinValues[13] = -0.923879; + sinValues[14] = -0.707107; + sinValues[15] = -0.382683; + sinValues[16] = 0.0; + + const float M_PI = 3.14159265358979323846; + vec2 c = 2.0 * M_PI * gtf_Color.rg; + float sign = 1.0; + + vec2 sin_c = vec2(0.0); + float fact; + float fact_of; + + // Taylors series expansion for sin + for(int i = 0; i < 12; i++) + { + fact = 1.0; + for(int j = 2; j <= 23; j++) + if (j <= 2 * i + 1) + fact *= float(j); + + sin_c += sign * pow(c, vec2(2.0 * float(i) + 1.0)) / fact; + sign *= -1.0; + } + + color = vec4(0.5 * sin_c + 0.5, 0.0, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_frag_xvary.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_frag_xvary.frag new file mode 100644 index 0000000000..21f6124e41 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_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) +{ + const float M_PI = 3.14159265358979323846; + gl_FragColor = vec4(0.5 * sin(2.0 * M_PI * color.rgb) + 0.5, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_frag_xvary_ref.frag b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_frag_xvary_ref.frag new file mode 100644 index 0000000000..86aada5af7 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_frag_xvary_ref.frag @@ -0,0 +1,156 @@ + +/* +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; + +float lerp(float a, float b, float s) +{ + return a + (b - a) * s; +} + +void main (void) +{ + float sinValues[17]; + sinValues[0] = 0.0; + sinValues[1] = 0.382683; + sinValues[2] = 0.707107; + sinValues[3] = 0.92388; + sinValues[4] = 1.0; + sinValues[5] = 0.92388; + sinValues[6] = 0.707107; + sinValues[7] = 0.382683; + sinValues[8] = 0.0; + sinValues[9] = -0.382683; + sinValues[10] = -0.707107; + sinValues[11] = -0.92388; + sinValues[12] = -1.0; + sinValues[13] = -0.923879; + sinValues[14] = -0.707107; + sinValues[15] = -0.382683; + sinValues[16] = 0.0; + + const float M_PI = 3.14159265358979323846; + vec3 c = 2.0 * M_PI * color.rgb; + + vec3 arrVal = c * 2.546478971; + int arr0x = int(floor(arrVal.x)); + int arr0y = int(floor(arrVal.y)); + int arr0z = int(floor(arrVal.z)); + vec3 weight = arrVal - floor(arrVal); + vec3 sin_c = vec3(0.0, 0.0, 0.0); + + if (arr0x == 0) + sin_c.x = lerp(sinValues[0], sinValues[1], weight.x); + else if (arr0x == 1) + sin_c.x = lerp(sinValues[1], sinValues[2], weight.x); + else if (arr0x == 2) + sin_c.x = lerp(sinValues[2], sinValues[3], weight.x); + else if (arr0x == 3) + sin_c.x = lerp(sinValues[3], sinValues[4], weight.x); + else if (arr0x == 4) + sin_c.x = lerp(sinValues[4], sinValues[5], weight.x); + else if (arr0x == 5) + sin_c.x = lerp(sinValues[5], sinValues[6], weight.x); + else if (arr0x == 6) + sin_c.x = lerp(sinValues[6], sinValues[7], weight.x); + else if (arr0x == 7) + sin_c.x = lerp(sinValues[7], sinValues[8], weight.x); + else if (arr0x == 8) + sin_c.x = lerp(sinValues[8], sinValues[9], weight.x); + else if (arr0x == 9) + sin_c.x = lerp(sinValues[9], sinValues[10], weight.x); + else if (arr0x == 10) + sin_c.x = lerp(sinValues[10], sinValues[11], weight.x); + else if (arr0x == 11) + sin_c.x = lerp(sinValues[11], sinValues[12], weight.x); + else if (arr0x == 12) + sin_c.x = lerp(sinValues[12], sinValues[13], weight.x); + else if (arr0x == 13) + sin_c.x = lerp(sinValues[13], sinValues[14], weight.x); + else if (arr0x == 14) + sin_c.x = lerp(sinValues[14], sinValues[15], weight.x); + else if (arr0x == 15) + sin_c.x = lerp(sinValues[15], sinValues[16], weight.x); + else if (arr0x == 16) + sin_c.x = sinValues[16]; + + if (arr0y == 0) + sin_c.y = lerp(sinValues[0], sinValues[1], weight.y); + else if (arr0y == 1) + sin_c.y = lerp(sinValues[1], sinValues[2], weight.y); + else if (arr0y == 2) + sin_c.y = lerp(sinValues[2], sinValues[3], weight.y); + else if (arr0y == 3) + sin_c.y = lerp(sinValues[3], sinValues[4], weight.y); + else if (arr0y == 4) + sin_c.y = lerp(sinValues[4], sinValues[5], weight.y); + else if (arr0y == 5) + sin_c.y = lerp(sinValues[5], sinValues[6], weight.y); + else if (arr0y == 6) + sin_c.y = lerp(sinValues[6], sinValues[7], weight.y); + else if (arr0y == 7) + sin_c.y = lerp(sinValues[7], sinValues[8], weight.y); + else if (arr0y == 8) + sin_c.y = lerp(sinValues[8], sinValues[9], weight.y); + else if (arr0y == 9) + sin_c.y = lerp(sinValues[9], sinValues[10], weight.y); + else if (arr0y == 10) + sin_c.y = lerp(sinValues[10], sinValues[11], weight.y); + else if (arr0y == 11) + sin_c.y = lerp(sinValues[11], sinValues[12], weight.y); + else if (arr0y == 12) + sin_c.y = lerp(sinValues[12], sinValues[13], weight.y); + else if (arr0y == 13) + sin_c.y = lerp(sinValues[13], sinValues[14], weight.y); + else if (arr0y == 14) + sin_c.y = lerp(sinValues[14], sinValues[15], weight.y); + else if (arr0y == 15) + sin_c.y = lerp(sinValues[15], sinValues[16], weight.y); + else if (arr0y == 16) + sin_c.y = sinValues[16]; + + if (arr0z == 0) + sin_c.z = lerp(sinValues[0], sinValues[1], weight.z); + else if (arr0z == 1) + sin_c.z = lerp(sinValues[1], sinValues[2], weight.z); + else if (arr0z == 2) + sin_c.z = lerp(sinValues[2], sinValues[3], weight.z); + else if (arr0z == 3) + sin_c.z = lerp(sinValues[3], sinValues[4], weight.z); + else if (arr0z == 4) + sin_c.z = lerp(sinValues[4], sinValues[5], weight.z); + else if (arr0z == 5) + sin_c.z = lerp(sinValues[5], sinValues[6], weight.z); + else if (arr0z == 6) + sin_c.z = lerp(sinValues[6], sinValues[7], weight.z); + else if (arr0z == 7) + sin_c.z = lerp(sinValues[7], sinValues[8], weight.z); + else if (arr0z == 8) + sin_c.z = lerp(sinValues[8], sinValues[9], weight.z); + else if (arr0z == 9) + sin_c.z = lerp(sinValues[9], sinValues[10], weight.z); + else if (arr0z == 10) + sin_c.z = lerp(sinValues[10], sinValues[11], weight.z); + else if (arr0z == 11) + sin_c.z = lerp(sinValues[11], sinValues[12], weight.z); + else if (arr0z == 12) + sin_c.z = lerp(sinValues[12], sinValues[13], weight.z); + else if (arr0z == 13) + sin_c.z = lerp(sinValues[13], sinValues[14], weight.z); + else if (arr0z == 14) + sin_c.z = lerp(sinValues[14], sinValues[15], weight.z); + else if (arr0z == 15) + sin_c.z = lerp(sinValues[15], sinValues[16], weight.z); + else if (arr0z == 16) + sin_c.z = sinValues[16]; + + gl_FragColor = vec4(0.5 * sin_c + 0.5, 1.0); +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_vert_xvary.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_vert_xvary.vert new file mode 100644 index 0000000000..25ea3a6a49 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_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) +{ + const float M_PI = 3.14159265358979323846; + color = vec4(0.5 * sin(2.0 * M_PI * gtf_Color.rgb) + 0.5, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_vert_xvary_ref.vert b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_vert_xvary_ref.vert new file mode 100644 index 0000000000..962f1d8e9b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/sin/sin_vec3_vert_xvary_ref.vert @@ -0,0 +1,62 @@ + +/* +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; + +float lerp(float a, float b, float s) +{ + return a + (b - a) * s; +} + +void main (void) +{ + float sinValues[17]; + sinValues[0] = 0.0; + sinValues[1] = 0.382683; + sinValues[2] = 0.707107; + sinValues[3] = 0.92388; + sinValues[4] = 1.0; + sinValues[5] = 0.92388; + sinValues[6] = 0.707107; + sinValues[7] = 0.382683; + sinValues[8] = 0.0; + sinValues[9] = -0.382683; + sinValues[10] = -0.707107; + sinValues[11] = -0.92388; + sinValues[12] = -1.0; + sinValues[13] = -0.923879; + sinValues[14] = -0.707107; + sinValues[15] = -0.382683; + sinValues[16] = 0.0; + + const float M_PI = 3.14159265358979323846; + vec3 c = 2.0 * M_PI * gtf_Color.rgb; + float sign = 1.0; + + vec3 sin_c = vec3(0.0); + float fact; + float fact_of; + + // Taylors series expansion for sin + for(int i = 0; i < 12; i++) + { + fact = 1.0; + for(int j = 2; j <= 23; j++) + if (j <= 2 * i + 1) + fact *= float(j); + + sin_c += sign * pow(c, vec3(2.0 * float(i) + 1.0)) / fact; + sign *= -1.0; + } + + color = vec4(0.5 * sin_c + 0.5, 1.0); + gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; +} |