Skip to content

Commit 4857dac

Browse files
authored
Test double indirect row_matrix access. (#3335)
Looking at the code in one of the backends I see this is problematic so it seemed there should be a test. Associated with https://crbug.com/angleproject/6386 .
1 parent 806de53 commit 4857dac

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

sdk/tests/conformance2/glsl3/matrix-row-major-dynamic-indexing.html

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@
3333
my_FragColor = vec4(1.0 - f, f, 0.0, 1.0);
3434
}
3535
</script>
36+
<script id="fshaderRowMatrixIndexedByRowMatrixInUniformBlock" type="x-shader/x-fragment">#version 300 es
37+
precision mediump float;
38+
39+
uniform Stuff {
40+
layout(row_major) mat4 u_mat[3];
41+
layout(row_major) mat4 u_ndx[3];
42+
} stuff;
43+
44+
45+
out vec4 my_FragColor;
46+
47+
void main() {
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);
50+
}
51+
</script>
3652
<script type="application/javascript">
3753
"use strict";
3854
description("Indexing row-major matrices within a uniform block should work");
@@ -49,6 +65,51 @@
4965
0, 0, 0, 0,
5066
0, 0, 0, 0,
5167
])}],
68+
},
69+
{
70+
fShaderId: 'fshaderRowMatrixIndexedByRowMatrixInUniformBlock',
71+
fShaderSuccess: true,
72+
linkSuccess: true,
73+
passMsg: '',
74+
uniformBlocks: [{name: "Stuff", value: new Float32Array([
75+
// mat4 u_mat[3]
76+
1, 2, 3, 4,
77+
5, 6, 7, 8,
78+
9, 10, 11, 12,
79+
13, 14, 15, 16,
80+
81+
// +-- we should be pulling out this column
82+
// |
83+
// V
84+
1, 5, 9, 13,
85+
2, 6, 10, 14,
86+
3, 7, 11, 15,
87+
4, 8, 12, 16,
88+
89+
2, 10, 18, 22,
90+
4, 12, 20, 28,
91+
6, 14, 22, 30,
92+
8, 16, 24, 32,
93+
94+
// mat4 u_ndx[3]
95+
0, 0, 0, 0,
96+
0, 0, 0, 0,
97+
0, 0, 0, 0,
98+
0, 0, 0, 0,
99+
100+
0, 0, 0, 0,
101+
0, 0, 0, 2,
102+
0, 0, 0, 0,
103+
0, 1, 0, 0,
104+
// ^
105+
// |
106+
// +-- we should be reading this value as an index into u_mat
107+
108+
0, 0, 0, 0,
109+
0, 0, 0, 0,
110+
0, 0, 0, 0,
111+
0, 0, 0, 0,
112+
])}],
52113
}
53114
], 2);
54115
</script>

0 commit comments

Comments
 (0)