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-distance.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 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 distance 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 +GLSLGenerator.runFeatureTest({ 1.27 + feature: "distance", 1.28 + args: "$(type) p1, $(type) p2", 1.29 + baseArgs: "value$(field)", 1.30 + testFunc: "$(func)($(type),$(type))", 1.31 + emuFuncs: [ 1.32 + { type: "float", 1.33 + code: [ 1.34 + "float $(func)_emu($(args)) {", 1.35 + " return abs(p1 - p2);", 1.36 + "}"].join("\n") 1.37 + }, 1.38 + { type: "vec2", 1.39 + code: [ 1.40 + "float $(func)_emu($(args)) {", 1.41 + " return length(p1 - p2);", 1.42 + "}"].join("\n") 1.43 + }, 1.44 + { type: "vec3", 1.45 + code: [ 1.46 + "float $(func)_emu($(args)) {", 1.47 + " return length(p1 - p2);", 1.48 + "}"].join("\n") 1.49 + }, 1.50 + { type: "vec4", 1.51 + code: [ 1.52 + "float $(func)_emu($(args)) {", 1.53 + " return length(p1 - p2);", 1.54 + "}"].join("\n") 1.55 + } 1.56 + ], 1.57 + gridRes: 8, 1.58 + tests: [ 1.59 + ["$(output) = vec4(", 1.60 + " $(func)(", 1.61 + " $(input).x * 8.0 - 4.0,", 1.62 + " $(input).y * 8.0 - 4.0) / 8.0,", 1.63 + " 0,", 1.64 + " 0,", 1.65 + " 1);"].join("\n"), 1.66 + ["$(output) = vec4(", 1.67 + " 0,", 1.68 + " $(func)(", 1.69 + " $(input).xy * 8.0 - 4.0,", 1.70 + " $(input).wz * 8.0 - 4.0) / 8.0,", 1.71 + " 0, 1);"].join("\n"), 1.72 + ["$(output) = vec4(", 1.73 + " 0, 0,", 1.74 + " $(func)(", 1.75 + " $(input).xyz * 8.0 - 4.0,", 1.76 + " $(input).yzw * 8.0 - 4.0) / 8.0,", 1.77 + " 1);"].join("\n"), 1.78 + ["$(output) = vec4(", 1.79 + " $(func)(", 1.80 + " vec4($(input).xyz, 0) * 8.0 - 4.0,", 1.81 + " vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,", 1.82 + " 0, 0, 1);", 1.83 + ].join("\n") 1.84 + ] 1.85 +}); 1.86 +successfullyParsed = true; 1.87 +</script> 1.88 +</body> 1.89 +</html> 1.90 +