• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1static float2 FP32Out;
2static uint FP16;
3static uint FP16Out;
4static float2 FP32;
5
6struct SPIRV_Cross_Input
7{
8    nointerpolation uint FP16 : TEXCOORD0;
9    nointerpolation float2 FP32 : TEXCOORD1;
10};
11
12struct SPIRV_Cross_Output
13{
14    float2 FP32Out : SV_Target0;
15    uint FP16Out : SV_Target1;
16};
17
18uint spvPackHalf2x16(float2 value)
19{
20    uint2 Packed = f32tof16(value);
21    return Packed.x | (Packed.y << 16);
22}
23
24float2 spvUnpackHalf2x16(uint value)
25{
26    return f16tof32(uint2(value & 0xffff, value >> 16));
27}
28
29void frag_main()
30{
31    FP32Out = spvUnpackHalf2x16(FP16);
32    FP16Out = spvPackHalf2x16(FP32);
33}
34
35SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
36{
37    FP16 = stage_input.FP16;
38    FP32 = stage_input.FP32;
39    frag_main();
40    SPIRV_Cross_Output stage_output;
41    stage_output.FP32Out = FP32Out;
42    stage_output.FP16Out = FP16Out;
43    return stage_output;
44}
45