/testing/web-platform/tests/webgl/conformance-1.0.3/conformance/glsl/functions/glsl-function-atan-xy.html

https://github.com/rillian/firefox · HTML · 121 lines · 90 code · 5 blank · 26 comment · 0 complexity · 0aa0c6edfc67491f0bdfd06c823ceaca MD5 · raw file

  1. <!--
  2. /*
  3. ** Copyright (c) 2012 The Khronos Group Inc.
  4. **
  5. ** Permission is hereby granted, free of charge, to any person obtaining a
  6. ** copy of this software and/or associated documentation files (the
  7. ** "Materials"), to deal in the Materials without restriction, including
  8. ** without limitation the rights to use, copy, modify, merge, publish,
  9. ** distribute, sublicense, and/or sell copies of the Materials, and to
  10. ** permit persons to whom the Materials are furnished to do so, subject to
  11. ** the following conditions:
  12. **
  13. ** The above copyright notice and this permission notice shall be included
  14. ** in all copies or substantial portions of the Materials.
  15. **
  16. ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  19. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  20. ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21. ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22. ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  23. */
  24. -->
  25. <!DOCTYPE html>
  26. <html>
  27. <head>
  28. <meta charset="utf-8">
  29. <title>GLSL atan-xy function test</title>
  30. <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
  31. <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
  32. <script src=/resources/testharness.js></script>
  33. <script src=/resources/testharnessreport.js></script>
  34. <script src="../../../resources/js-test-pre.js"></script>
  35. <script src="../../resources/webgl-test-utils.js"> </script>
  36. <script src="../../resources/glsl-generator.js"> </script>
  37. </head>
  38. <body>
  39. <div id="description"></div>
  40. <div id="console"></div>
  41. <script>
  42. "use strict";
  43. var piConstants = [
  44. "const float kPI = 3.14159265358979323846;",
  45. "const float kHalfPI = (kPI * 0.5);",
  46. "const float k2PI = (kPI * 2.0);"
  47. ].join("\n");
  48. var kPI = Math.PI;
  49. var kHalfPI = Math.PI * 0.5;
  50. var k2PI = Math.PI * 2.0;
  51. var atan2 = Math.atan2; // shorthand
  52. GLSLGenerator.runReferenceImageTest({
  53. feature: "atan",
  54. args: "$(type) y, $(type) x",
  55. testFunc: "$(func)($(type), $(type))",
  56. gridRes: 8,
  57. tolerance: 5,
  58. extra: piConstants,
  59. tests: [
  60. {
  61. source: ["$(output) = vec4(",
  62. " $(func)($(input).x + 0.1, $(input).y) / k2PI + 0.5,",
  63. " 0,",
  64. " 0,",
  65. " 1);"].join("\n"),
  66. generator: function(x, y, z, w) {
  67. return [ atan2(x + 0.1, y) / k2PI + 0.5,
  68. 0,
  69. 0,
  70. 1 ];
  71. },
  72. },
  73. {
  74. source: ["$(output) = vec4(",
  75. " $(func)($(input).xy + vec2(0.1, 0.1), $(input).yx) / ",
  76. " k2PI + vec2(0.5, 0.5),",
  77. " 0, 1);"].join("\n"),
  78. generator: function(x, y, z, w) {
  79. return [ atan2(x + 0.1, y) / k2PI + 0.5,
  80. atan2(y + 0.1, x) / k2PI + 0.5,
  81. 0,
  82. 1 ];
  83. },
  84. },
  85. {
  86. source: ["$(output) = vec4(",
  87. " $(func)($(input).xyz + vec3(0.1, 0.1, 0.1), $(input).yzx) / ",
  88. " k2PI + vec3(0.5, 0.5, 0.5),",
  89. " 1);"].join("\n"),
  90. generator: function(x, y, z, w) {
  91. return [ atan2(x + 0.1, y) / k2PI + 0.5,
  92. atan2(y + 0.1, z) / k2PI + 0.5,
  93. atan2(z + 0.1, x) / k2PI + 0.5,
  94. 1 ];
  95. },
  96. },
  97. {
  98. source: ["$(output) = ",
  99. " $(func)($(input) + vec4(0.1, 0.1, 0.1, 0.1), $(input).wzyx) / ",
  100. " k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
  101. ].join("\n"),
  102. generator: function(x, y, z, w) {
  103. return [ atan2(x + 0.1, w) / k2PI + 0.5,
  104. atan2(y + 0.1, z) / k2PI + 0.5,
  105. atan2(z + 0.1, y) / k2PI + 0.5,
  106. atan2(w + 0.1, x) / k2PI + 0.5 ];
  107. },
  108. },
  109. ]
  110. });
  111. var successfullyParsed = true;
  112. </script>
  113. </body>
  114. </html>