@@ -793,12 +793,20 @@ SLANG_RAW("__generic<T : __BuiltinFloatingPointType, let N : int> vector<T,N> ex
793
793
SLANG_RAW ("__generic<T : __BuiltinFloatingPointType, let N : int, let M : int> matrix<T,N,M> exp2(matrix<T,N,M> x);\n" )
794
794
SLANG_RAW ("\n" )
795
795
SLANG_RAW ("// Convert 16-bit float stored in low bits of integer\n" )
796
+ SLANG_RAW ("__target_intrinsic(glsl, \"unpackHalf2x16($0).x\")\n" )
796
797
SLANG_RAW ("float f16tof32(uint value);\n" )
797
- SLANG_RAW ("__generic<let N : int> vector<float,N> f16tof32(vector<uint,N> value);\n" )
798
+ SLANG_RAW ("\n" )
799
+ SLANG_RAW ("__generic<let N : int>\n" )
800
+ SLANG_RAW ("__target_intrinsic(glsl, \"unpackHalf2x16($0).x\")\n" )
801
+ SLANG_RAW ("vector<float,N> f16tof32(vector<uint,N> value);\n" )
798
802
SLANG_RAW ("\n" )
799
803
SLANG_RAW ("// Convert to 16-bit float stored in low bits of integer\n" )
804
+ SLANG_RAW ("__target_intrinsic(glsl, \"packHalf2x16(vec2($0,0.0))\")\n" )
800
805
SLANG_RAW ("uint f32tof16(float value);\n" )
801
- SLANG_RAW ("__generic<let N : int> vector<uint,N> f32tof16(vector<float,N> value);\n" )
806
+ SLANG_RAW ("\n" )
807
+ SLANG_RAW ("__generic<let N : int>\n" )
808
+ SLANG_RAW ("__target_intrinsic(glsl, \"packHalf2x16(vec2($0,0.0))\")\n" )
809
+ SLANG_RAW ("vector<uint,N> f32tof16(vector<float,N> value);\n" )
802
810
SLANG_RAW ("\n" )
803
811
SLANG_RAW ("// Flip surface normal to face forward, if needed\n" )
804
812
SLANG_RAW ("__generic<T : __BuiltinFloatingPointType, let N : int> vector<T,N> faceforward(vector<T,N> n, vector<T,N> i, vector<T,N> ng);\n" )
@@ -1513,7 +1521,7 @@ for (int aa = 0; aa < kBaseBufferAccessLevelCount; ++aa)
1513
1521
1514
1522
sb << "};\n" ;
1515
1523
}
1516
- SLANG_RAW ("#line 1440 \"hlsl.meta.slang\"" )
1524
+ SLANG_RAW ("#line 1448 \"hlsl.meta.slang\"" )
1517
1525
SLANG_RAW ("\n" )
1518
1526
SLANG_RAW ("\n" )
1519
1527
SLANG_RAW ("\n" )
0 commit comments