1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/conformance/glsl/functions/glsl-function-acos.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +<!-- 1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.6 +Use of this source code is governed by a BSD-style license that can be 1.7 +found in the LICENSE file. 1.8 + --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 +<head> 1.12 +<meta charset="utf-8"> 1.13 + <title>GLSL acos function test</title> 1.14 + <link rel="stylesheet" href="../../../resources/js-test-style.css"/> 1.15 + <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/> 1.16 + <script src="../../../resources/js-test-pre.js"></script> 1.17 + <script src="../../resources/webgl-test.js"> </script> 1.18 + <script src="../../resources/webgl-test-utils.js"> </script> 1.19 + <script src="../../resources/glsl-generator.js"> </script> 1.20 +</head> 1.21 +<body> 1.22 +<div id="description"></div> 1.23 +<div id="console"></div> 1.24 +<script> 1.25 + 1.26 +var piConstants = [ 1.27 + "const float kPI = 3.14159265358979323846;", 1.28 + "const float kHalfPI = (kPI * 0.5);", 1.29 + "const float k2PI = (kPI * 2.0);" 1.30 +].join("\n"); 1.31 + 1.32 +var kPI = Math.PI; 1.33 +var kHalfPI = Math.PI * 0.5; 1.34 +var k2PI = Math.PI * 2.0; 1.35 +var acos = Math.acos; // shorthand 1.36 + 1.37 +GLSLGenerator.runReferenceImageTest({ 1.38 + feature: "acos", 1.39 + args: "$(type) value", 1.40 + testFunc: "$(func)($(type))", 1.41 + gridRes: 8, 1.42 + tolerance: 2, 1.43 + extra: piConstants, 1.44 + tests: [ 1.45 + { 1.46 + source: ["$(output) = vec4(", 1.47 + " $(func)($(input).x * 0.8) / kPI,", 1.48 + " $(func)($(input).y * 0.8) / kPI,", 1.49 + " 0,", 1.50 + " 1);"].join("\n"), 1.51 + generator: function(x, y, z, w) { 1.52 + return [ acos(x * 0.8) / kPI, 1.53 + acos(y * 0.8) / kPI, 1.54 + 0, 1.55 + 1 ]; 1.56 + }, 1.57 + }, 1.58 + { 1.59 + source: ["$(output) = vec4(", 1.60 + " $(func)($(input).xy * 0.8) / kPI,", 1.61 + " 0, 1);"].join("\n"), 1.62 + generator: function(x, y, z, w) { 1.63 + return [ acos(x * 0.8) / kPI, 1.64 + acos(y * 0.8) / kPI, 1.65 + 0, 1.66 + 1 ]; 1.67 + }, 1.68 + }, 1.69 + { 1.70 + source: ["$(output) = vec4(", 1.71 + " $(func)($(input).xyz * 0.8) / kPI,", 1.72 + " 1);"].join("\n"), 1.73 + generator: function(x, y, z, w) { 1.74 + return [ acos(x * 0.8) / kPI, 1.75 + acos(y * 0.8) / kPI, 1.76 + acos(z * 0.8) / kPI, 1.77 + 1 ]; 1.78 + }, 1.79 + }, 1.80 + { 1.81 + source: ["$(output) = ", 1.82 + " $(func)($(input) * 0.8) / kPI;", 1.83 + ].join("\n"), 1.84 + generator: function(x, y, z, w) { 1.85 + return [ acos(x * 0.8) / kPI, 1.86 + acos(y * 0.8) / kPI, 1.87 + acos(z * 0.8) / kPI, 1.88 + acos(w * 0.8) / kPI ]; 1.89 + }, 1.90 + }, 1.91 + ] 1.92 +}); 1.93 +successfullyParsed = true; 1.94 +</script> 1.95 +</body> 1.96 +</html> 1.97 +