yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
6295c279
main
1uniform int idx ; 2uniform float3x2 um ; 3 4struct PS_OUTPUT 5{ 6float4 Color : SV_Target0 ; 7} ; 8 9PS_OUTPUT main () 10{ 11// matrices of 3 rows, 2 columns (regardless of row vs col major storage) 12const float3x2 m1 = { { 10 , 11 } , // row-wise initialization 13{ 12 , 13 } , 14{ 14 , 15 } } ; 15 16const float3x2 m2 = { 20 , 21 , 22 , 23 , 24 , 25 } ; // component-wise matrix initialization is allowed 17const float3x2 m3 = { 30 , 31 , 33 , 33 , 34 , 35 } ; // component-wise matrix initialization is allowed 18 19// These can be observed in the AST post-const folding to ensure we obtain the right value, 20// as given in comments to the right of each line. Note that the first indirection into a 21// matrix returns a row vector. 22float e1_00 = m1 [ 0 ][ 0 ] ; // 10 23float e1_01 = m1 [ 0 ][ 1 ] ; // 11 24float e1_10 = m1 [ 1 ][ 0 ] ; // 12 25float e1_11 = m1 [ 1 ][ 1 ] ; // 13 26float e1_20 = m1 [ 2 ][ 0 ] ; // 14 27float e1_21 = m1 [ 2 ][ 1 ] ; // 15 28 29float e2_00 = m2 [ 0 ][ 0 ] ; // 20 30float e2_01 = m2 [ 0 ][ 1 ] ; // 21 31float e2_10 = m2 [ 1 ][ 0 ] ; // 22 32float e2_11 = m2 [ 1 ][ 1 ] ; // 23 33float e2_20 = m2 [ 2 ][ 0 ] ; // 24 34float e2_21 = m2 [ 2 ][ 1 ] ; // 25 35 36// float e3a_00 = m3._m00; // TODO... also as an lvalue for a non-const matrix 37// float e3b_00 = m3._11; // TODO... also as an lvalue for a non-const matrix 38 39float2 r0a = m1 [ 0 ] ; // row0: 10,11: types must match: constant index into constant 40float2 r1a = m1 [ 1 ] ; // row1: 12,13: ... 41float2 r2a = m1 [ 2 ] ; // row2: 14,15: ... 42 43float2 r0b = m2 [ idx ] ; // types should match: variable index into constant 44float2 r0c = um [ idx ] ; // types should match: variable index into variable 45 46PS_OUTPUT psout ; 47psout . Color = e2_11 ; // 23 48return psout ; 49}