1#version 450 core
2#extension GL_KHR_memory_scope_semantics : enable
3#extension GL_KHR_cooperative_matrix : enable
4#extension GL_EXT_shader_explicit_arithmetic_types : enable
5
6layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
7
8float<16> ftemplate16;
9
10coopmat fnoparams;
11
12struct S
13{
14    int s;
15};
16
17coopmat<void, gl_ScopeSubgroup, 8, 8, gl_MatrixUseA> fbadtype;
18coopmat<S, gl_ScopeSubgroup, 8, 8, gl_MatrixUseA> fbadtype2;
19coopmat<16, gl_ScopeSubgroup, 8, 8, gl_MatrixUseA> fbadtype3;
20
21coopmat<float16_t, gl_ScopeSubgroup, 8, gl_MatrixUseA> fbadnumparams;
22
23int X = 8;
24
25coopmat<float16_t, gl_ScopeSubgroup, 8, X, gl_MatrixUseA> fbadparam;
26
27layout(constant_id = 0) const int Y = 1;
28
29shared coopmat<float16_t, gl_ScopeSubgroup, 16, 16> sharedmat;
30
31layout(set = 0, binding = 0) buffer InvBlock {
32    coopmat<float16_t, gl_ScopeSubgroup, 16, 16, gl_MatrixUseA> bufmat;
33} invblock;
34
35void main()
36{
37    coopmat<float, gl_ScopeSubgroup, 16, 8, gl_MatrixUseA> f32_16_8;
38    coopmat<float16_t, gl_ScopeSubgroup, 16, 8, gl_MatrixUseA> f16_16_8;
39
40    // invalid implicit conversions
41    f32_16_8 = f16_16_8;
42    f32_16_8 = f16_16_8 + f16_16_8;
43
44    coopmat<float16_t, gl_ScopeSubgroup, 8, 8, gl_MatrixUseA> f16_8_8;
45
46    // mismatching dimensions
47    f16_16_8 = f16_8_8;
48
49    coopmat<float16_t, gl_ScopeSubgroup, 8, Y, gl_MatrixUseA> f16_8_Y;
50    coopmat<float16_t, gl_ScopeSubgroup, 8, (Y+1), gl_MatrixUseA> f16_8_Y1;
51
52    // mismatching dimensions with specialization constants
53    f16_8_Y = f16_8_Y1;
54
55    // wrong arguments for constructor
56    f16_8_8 = coopmat<float16_t, gl_ScopeSubgroup, 8, 8, gl_MatrixUseA>(1, 1);
57
58    // can't construct from a builtin type
59    mat4 m4;
60    coopmat<float, gl_ScopeSubgroup, 4, 4, gl_MatrixUseA> f32_4_4 = coopmat<float, gl_ScopeSubgroup, 4, 4, gl_MatrixUseA>(m4);
61
62    // only support a single array subscript
63    f16_16_8[0][0];
64
65    // don't support scalar component selection
66    f16_16_8.x;
67
68    transpose(f16_8_8);
69}
70