yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
0b521448
main
1 2struct PS_OUTPUT 3{ 4float4 Color :SV_Target0 ; 5}; 6 7uniform int3 i3 ; 8uniform bool3 b3 ; 9uniform float3 f3 ; 10uniform uint3 u3 ; 11uniform double3 d3 ; 12 13uniform int is ; 14uniform bool bs ; 15uniform float fs ; 16uniform uint us ; 17uniform double ds ; 18 19void Fn_F3 (float3 x ) { } 20void Fn_I3 (int3 x ) { } 21void Fn_U3 (uint3 x ) { } 22void Fn_B3 (bool3 x ) { } 23void Fn_D3 (double3 x ) { } 24 25// ----------- Test implicit conversions on function returns ----------- 26float3 Fn_R_F3I (out float3 p ) {p = i3 ;return i3 ; } 27float3 Fn_R_F3U (out float3 p ) {p = u3 ;return u3 ; } 28float3 Fn_R_F3B (out float3 p ) {p = b3 ;return b3 ; } 29float3 Fn_R_F3D (out float3 p ) {p = d3 ;return d3 ; }// valid, but loss of precision on downconversion. 30 31int3 Fn_R_I3U (out int3 p ) {p = u3 ;return u3 ; } 32int3 Fn_R_I3B (out int3 p ) {p = b3 ;return b3 ; } 33int3 Fn_R_I3F (out int3 p ) {p = f3 ;return f3 ; } 34int3 Fn_R_I3D (out int3 p ) {p = d3 ;return d3 ; }// valid, but loss of precision on downconversion. 35 36uint3 Fn_R_U3I (out uint3 p ) {p = i3 ;return i3 ; } 37uint3 Fn_R_U3F (out uint3 p ) {p = f3 ;return f3 ; } 38uint3 Fn_R_U3B (out uint3 p ) {p = b3 ;return b3 ; } 39uint3 Fn_R_U3D (out uint3 p ) {p = d3 ;return d3 ; }// valid, but loss of precision on downconversion. 40 41bool3 Fn_R_B3I (out bool3 p ) {p = i3 ;return i3 ; } 42bool3 Fn_R_B3U (out bool3 p ) {p = u3 ;return u3 ; } 43bool3 Fn_R_B3F (out bool3 p ) {p = f3 ;return f3 ; } 44bool3 Fn_R_B3D (out bool3 p ) {p = d3 ;return d3 ; } 45 46double3 Fn_R_D3I (out double3 p ) {p = i3 ;return i3 ; } 47double3 Fn_R_D3U (out double3 p ) {p = u3 ;return u3 ; } 48double3 Fn_R_D3B (out double3 p ) {p = b3 ;return b3 ; } 49double3 Fn_R_D3F (out double3 p ) {p = f3 ;return f3 ; } 50 51PS_OUTPUT main () 52{ 53// ----------- assignment conversions ----------- 54float3 r00 = i3 ; 55float3 r01 = b3 ; 56float3 r02 = u3 ; 57float3 r03 = d3 ;// valid, but loss of precision on downconversion. 58 59int3 r10 = b3 ; 60int3 r11 = u3 ; 61int3 r12 = f3 ; 62int3 r13 = d3 ;// valid, but loss of precision on downconversion. 63 64uint3 r20 = b3 ; 65uint3 r21 = i3 ; 66uint3 r22 = f3 ; 67uint3 r23 = d3 ;// valid, but loss of precision on downconversion. 68 69bool3 r30 = i3 ; 70bool3 r31 = u3 ; 71bool3 r32 = f3 ; 72bool3 r33 = d3 ; 73 74double3 r40 = i3 ; 75double3 r41 = u3 ; 76double3 r42 = f3 ; 77double3 r43 = b3 ; 78 79// ----------- assign ops: vector times vector ----------- 80r00 *=i3 ; 81r01 *=b3 ; 82r02 *=u3 ; 83r03 *=d3 ;// valid, but loss of precision on downconversion. 84 85r10 *=b3 ; 86r11 *=u3 ; 87r12 *=f3 ; 88r13 *=d3 ;// valid, but loss of precision on downconversion. 89 90r20 *=b3 ; 91r21 *=i3 ; 92r22 *=f3 ; 93r23 *=d3 ;// valid, but loss of precision on downconversion. 94 95// No mul operator for bools 96 97r40 *=i3 ; 98r41 *=u3 ; 99r42 *=f3 ; 100r43 *=b3 ; 101 102// ----------- assign ops: vector times scalar ----------- 103r00 *=is ; 104r01 *=bs ; 105r02 *=us ; 106r03 *=ds ;// valid, but loss of precision on downconversion. 107 108r10 *=bs ; 109r11 *=us ; 110r12 *=fs ; 111r13 *=ds ;// valid, but loss of precision on downconversion. 112 113r20 *=bs ; 114r21 *=is ; 115r22 *=fs ; 116r23 *=ds ;// valid, but loss of precision on downconversion. 117 118// No mul operator for bools 119 120r40 *=is ; 121r41 *=us ; 122r42 *=fs ; 123r43 *=bs ; 124 125 126#define FN_OVERLOADS 0 // change to 1 when overloads under promotions are in place 127 128#if FN_OVERLOADS 129Fn_F3 (i3 ); 130Fn_F3 (u3 ); 131Fn_F3 (f3 ); 132Fn_F3 (b3 ); 133Fn_F3 (d3 );// valid, but loss of precision on downconversion. 134 135Fn_I3 (i3 ); 136Fn_I3 (u3 ); 137Fn_I3 (f3 ); 138Fn_I3 (b3 ); 139Fn_I3 (d3 );// valid, but loss of precision on downconversion. 140 141Fn_U3 (i3 ); 142Fn_U3 (u3 ); 143Fn_U3 (f3 ); 144Fn_U3 (b3 ); 145Fn_U3 (d3 );// valid, but loss of precision on downconversion. 146 147Fn_B3 (i3 ); 148Fn_B3 (u3 ); 149Fn_B3 (f3 ); 150Fn_B3 (b3 ); 151Fn_B3 (d3 ); 152 153Fn_D3 (i3 ); 154Fn_D3 (u3 ); 155Fn_D3 (f3 ); 156Fn_D3 (b3 ); 157Fn_D3 (d3 ); 158 159Fn_F3 (i3 .x ); 160Fn_F3 (u3 .x ); 161Fn_F3 (f3 .x ); 162Fn_F3 (b3 .x ); 163Fn_F3 (d3 .x );// valid, but loss of precision on downconversion. 164 165Fn_I3 (i3 .x ); 166Fn_I3 (u3 .x ); 167Fn_I3 (f3 .x ); 168Fn_I3 (b3 .x ); 169Fn_I3 (d3 .x );// valid, but loss of precision on downconversion. 170 171Fn_U3 (i3 .x ); 172Fn_U3 (u3 .x ); 173Fn_U3 (f3 .x ); 174Fn_U3 (b3 .x ); 175Fn_U3 (d3 .x );// valid, but loss of precision on downconversion. 176 177Fn_B3 (i3 .x ); 178Fn_B3 (u3 .x ); 179Fn_B3 (f3 .x ); 180Fn_B3 (b3 .x ); 181Fn_B3 (d3 .x ); 182 183Fn_D3 (i3 .x ); 184Fn_D3 (u3 .x ); 185Fn_D3 (f3 .x ); 186Fn_D3 (b3 .x ); 187Fn_D3 (d3 .x ); 188#endif 189 190const int si = 3 ; 191const float sf = 1.2 ; 192 193int c1 = si * sf ;// 3.6 (not 3!) 194int c2 = sf * si ;// 3.6 (not 3!) 195 196float4 outval = float4 (si * sf ,sf * si ,c1 ,c2 ); 197 198PS_OUTPUT psout ; 199psout .Color = outval ; 200return psout ; 201}