matrix-row-major.html (1352B)
1 <!-- 2 Copyright (c) 2019 The Khronos Group Inc. 3 Use of this source code is governed by an MIT-style license that can be 4 found in the LICENSE.txt file. 5 --> 6 7 <!DOCTYPE html> 8 <html> 9 <head> 10 <meta charset="utf-8"> 11 <title>Row-major matrix test</title> 12 <link rel="stylesheet" href="../../resources/js-test-style.css"/> 13 <script src="../../js/js-test-pre.js"></script> 14 <script src="../../js/webgl-test-utils.js"></script> 15 <script src="../../js/glsl-conformance-test.js"></script> 16 </head> 17 <body> 18 <div id="description"></div> 19 <div id="console"></div> 20 <script id="fshaderUniformMatrixRowMajor" type="x-shader/x-fragment">#version 300 es 21 precision mediump float; 22 out highp vec4 my_FragColor; 23 layout(std140, row_major) uniform b { 24 mat4x3 m; 25 }; 26 void main() { 27 // If the matrix is interpreted as row-major, then the translation components will be 0,1,0, or solid green. 28 my_FragColor = mat4(m) * vec4(0.0, 0.0, 0.0, 1.0); 29 } 30 </script> 31 <script type="application/javascript"> 32 "use strict"; 33 description("Row-major matrix layouts should work."); 34 35 GLSLConformanceTester.runRenderTests([ 36 { 37 fShaderId: 'fshaderUniformMatrixRowMajor', 38 fShaderSuccess: true, 39 linkSuccess: true, 40 passMsg: '', 41 uniformBlocks: [{name: "b", value: new Float32Array([ 42 0, 0, 0, 0, // Red 43 0, 0, 0, 1, // Green 44 0, 0, 0, 0, // Blue 45 ])}] 46 } 47 ], 2); 48 </script> 49 </body> 50 </html>