| #version 450 core | |
| #extension GL_NV_cooperative_vector : enable | |
| #extension GL_EXT_shader_explicit_arithmetic_types : enable | |
| layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; | |
| layout(set = 0, binding = 0) buffer Buf { | |
| float f[]; | |
| } buf; | |
| coopvecNV<float, 8> make(uint i) { return coopvecNV<float, 8>(buf.f[i]); } | |
| void main() | |
| { | |
| const coopvecNV<float, 8> v = coopvecNV<float, 8>(1.0); | |
| const coopvecNV<float, 8> w = coopvecNV<float, 8>(2.0); | |
| // constant folded: the result is not an aggregate | |
| const coopvecNV<float, 8> m = max(v, w); | |
| // not constant folded: a const argument must not make the call const | |
| const coopvecNV<float, 8> f = fma(v, w, w); | |
| float x = fma(v, w, w)[3]; | |
| // single argument: the argument itself is a call or constructor | |
| coopvecNV<float, 8> r = exp(make(0u)); | |
| coopvecNV<float, 8> s = exp(coopvecNV<float, 8>(buf.f[1])); | |
| buf.f[0] = m[0] + f[1] + x + r[2] + s[3]; | |
| } |