content/canvas/test/webgl-conformance/conformance/glsl/matrices/glsl-mat4-to-mat3.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-conformance/conformance/glsl/matrices/glsl-mat4-to-mat3.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     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 mat4 to mat3 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 id="shader_emu" type="something-not-js">
    1.25 +mat3 mat3_emu(mat4 m4) {
    1.26 +  return mat3(
    1.27 +      m4[0][0], m4[0][1], m4[0][2],
    1.28 +      m4[1][0], m4[1][1], m4[1][2],
    1.29 +      m4[2][0], m4[2][1], m4[2][2]);
    1.30 +}
    1.31 +</script>
    1.32 +<script id="shader_test" type="something-not-js">
    1.33 +  mat4 m4 = mat4($(input), $(input).yzwx, $(input).zwxy, $(input).wxyz);
    1.34 +  mat3 m3 = $(conversion)(m4);
    1.35 +  vec3 c;
    1.36 +  if ($(input).y < 0.33) {
    1.37 +    c = m3[0];
    1.38 +  } else if ($(input).y > 0.66) {
    1.39 +    c = m3[1];
    1.40 +  } else {
    1.41 +    c = m3[2];
    1.42 +  }
    1.43 +  $(output) = vec4(c, 1);
    1.44 +</script>
    1.45 +<script>
    1.46 +// See resources glsl-generator runBasicTest for how this works
    1.47 +var wtu = WebGLTestUtils;
    1.48 +GLSLGenerator.runBasicTest({
    1.49 +  gridRes: 8,
    1.50 +  tests: [
    1.51 +    {
    1.52 +      name: "mat4 to mat3",
    1.53 +      reference: {
    1.54 +        shader: wtu.getScript("shader_test"),
    1.55 +        subs: {
    1.56 +          emu: wtu.getScript("shader_emu"),
    1.57 +          conversion: "mat3_emu"
    1.58 +        }
    1.59 +      },
    1.60 +      test: {
    1.61 +        shader: wtu.getScript("shader_test"),
    1.62 +        subs: {
    1.63 +          conversion: "mat3"
    1.64 +        },
    1.65 +      }
    1.66 +    }
    1.67 +  ]
    1.68 +});
    1.69 +successfullyParsed = true;
    1.70 +</script>
    1.71 +</body>
    1.72 +</html>
    1.73 +

mercurial