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.
10 <meta charset=
"utf-8">
11 <title>Dynamically-indexed 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>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
20 <script id=
"fshaderIndexRowMajorMatrixArrayInUniformBlock" type=
"x-shader/x-fragment">#version
300 es
21 precision mediump float;
23 out vec4 my_FragColor;
27 layout(row_major) uniform a {
32 float f = u_mats[u_zero +
0][
2][
1];
33 my_FragColor = vec4(
1.0 - f, f,
0.0,
1.0);
36 <script id=
"fshaderRowMatrixIndexedByRowMatrixInUniformBlock" type=
"x-shader/x-fragment">#version
300 es
37 precision mediump float;
40 layout(row_major) mat4 u_mat[
3];
41 layout(row_major) mat4 u_ndx[
3];
45 out vec4 my_FragColor;
48 vec4 row = stuff.u_mat[int(stuff.u_ndx[
1][
1][
3])][
2];
49 my_FragColor = row == vec4(
9,
10,
11,
12) ? vec4(
0,
1,
0,
1) : vec4(
1,
0,
0,
1);
52 <script type=
"application/javascript">
54 description(
"Indexing row-major matrices within a uniform block should work");
56 GLSLConformanceTester.runRenderTests([
58 fShaderId: 'fshaderIndexRowMajorMatrixArrayInUniformBlock',
62 uniformBlocks: [{name:
"a", value: new Float32Array([
70 fShaderId: 'fshaderRowMatrixIndexedByRowMatrixInUniformBlock',
74 uniformBlocks: [{name:
"Stuff", value: new Float32Array([
81 // +-- we should be pulling out this column
106 // +-- we should be reading this value as an index into u_mat