yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
ee3ae468
main
1#version 420 2 3// A 64-bit counterpart to spv.matrix.frag, covering the same matrix operations 4// at double precision. As in the 16-bit counterpart, the operands are converted 5// from a 32-bit input rather than declared as double fragment inputs, so that 6// the three shaders differ only in the width being exercised. 7 8layout (location = 0 )in vec4 src ; 9 10layout (location = 0 )out vec4 color ; 11 12void main () 13{ 14dmat3x4 m1 = dmat3x4 (double (src .x )); 15dmat3x4 m2 = dmat3x4 (double (src .y )); 16double f = double (src .z ); 17dvec3 v3 = dvec3 (double (src .w )); 18dvec4 v4 = dvec4 (double (src .x )); 19 20dmat3x4 sum34 ; 21mat3x4 fm ; 22dvec3 sum3 ; 23dvec4 sum4 ; 24 25sum34 = m1 - m2 ; 26sum34 += m1 * f ; 27sum34 += f * m1 ; 28sum34 /=matrixCompMult (m1 ,m2 ); 29sum34 += m1 /f ; 30sum34 += f /m1 ; 31sum34 += f ; 32sum34 -= f ; 33fm = mat3x4 (sum34 ); 34sum34 = dmat3x4 (fm ); 35 36sum3 = v4 * m2 ; 37sum4 = m2 * v3 ; 38 39dmat4x3 m43 = transpose (sum34 ); 40dmat4 m4 = m1 * m43 ; 41 42sum4 = v4 * m4 ; 43 44dvec4 acc = sum4 ; 45 46++ sum34 ; 47-- sum34 ; 48 49sum34 += dmat3x4 (f ); 50sum34 += dmat3x4 (v3 ,f ,v3 ,f ,v3 ,f ); 51 52acc += sum3 * m43 + sum4 ; 53 54acc += dvec4 (m43 ); 55acc += dvec4 (dvec3 (dmat2 (f )),7.2lf ); 56 57// Beyond what spv.matrix.frag covers. Growing a matrix from a smaller one 58// leaves the trailing diagonal at the identity, and is the only construction 59// that uses the one filler rather than just the zero filler. 60dmat4 grown = dmat4 (dmat2 (f )); 61acc += dvec4 (grown [3 ][3 ]); 62 63color = vec4 (acc ); 64}