Merge pull request #740 from steve-lunarg/f16tof32
HLSL: add f16tof32 and f32tof16 decompositions.
diff --git a/Test/baseResults/hlsl.intrinsics.f1632.frag.out b/Test/baseResults/hlsl.intrinsics.f1632.frag.out
index f00c6f8..84ced71 100644
--- a/Test/baseResults/hlsl.intrinsics.f1632.frag.out
+++ b/Test/baseResults/hlsl.intrinsics.f1632.frag.out
@@ -1,80 +1,131 @@
hlsl.intrinsics.f1632.frag
-ERROR: 0:3: 'f32tof16' : unimplemented intrinsic: handle natively
-ERROR: 0:16: 'f32tof16' : unimplemented intrinsic: handle natively
-ERROR: 0:23: 'f32tof16' : unimplemented intrinsic: handle natively
-ERROR: 0:30: 'f32tof16' : unimplemented intrinsic: handle natively
-ERROR: 4 compilation errors. No code generated.
-
-
Shader version: 450
gl_FragCoord origin is upper left
-ERROR: node is still EOpNull!
-0:2 Function Definition: PixelShaderFunctionS(f1; (temp float)
+0:? Sequence
+0:2 Function Definition: PixelShaderFunctionS(u1; (temp float)
0:2 Function Parameters:
-0:2 'inF0' (in float)
+0:2 'inF0' (in uint)
0:? Sequence
-0:3 ERROR: Bad unary op
- (temp uint)
-0:3 'inF0' (in float)
-0:5 Branch: Return with expression
-0:5 Constant:
-0:5 0.000000
-0:9 Function Definition: PixelShaderFunction1(vf1; (temp 1-component vector of float)
-0:9 Function Parameters:
-0:9 'inF0' (in 1-component vector of float)
+0:3 Branch: Return with expression
+0:3 direct index (temp float)
+0:3 unpackHalf2x16 (temp 2-component vector of float)
+0:3 'inF0' (in uint)
+0:3 Constant:
+0:3 0.000000
+0:7 Function Definition: PixelShaderFunction1(vu1; (temp 1-component vector of float)
+0:7 Function Parameters:
+0:7 'inF0' (in 1-component vector of uint)
0:? Sequence
-0:11 Branch: Return with expression
-0:11 Constant:
-0:11 0.000000
-0:15 Function Definition: PixelShaderFunction2(vf2; (temp 2-component vector of float)
-0:15 Function Parameters:
-0:15 'inF0' (in 2-component vector of float)
+0:8 Branch: Return with expression
+0:8 Constant:
+0:8 0.000000
+0:12 Function Definition: PixelShaderFunction2(vu2; (temp 2-component vector of float)
+0:12 Function Parameters:
+0:12 'inF0' (in 2-component vector of uint)
0:? Sequence
-0:16 ERROR: Bad unary op
- (temp 2-component vector of uint)
-0:16 'inF0' (in 2-component vector of float)
+0:13 Branch: Return with expression
+0:13 Construct vec2 (temp 2-component vector of float)
+0:13 direct index (temp float)
+0:13 unpackHalf2x16 (temp 2-component vector of float)
+0:13 direct index (temp uint)
+0:13 'inF0' (in 2-component vector of uint)
+0:13 Constant:
+0:13 0 (const int)
+0:13 Constant:
+0:13 0.000000
+0:13 direct index (temp float)
+0:13 unpackHalf2x16 (temp 2-component vector of float)
+0:13 direct index (temp uint)
+0:13 'inF0' (in 2-component vector of uint)
+0:13 Constant:
+0:13 1 (const int)
+0:13 Constant:
+0:13 0.000000
+0:17 Function Definition: PixelShaderFunction3(vu3; (temp 3-component vector of float)
+0:17 Function Parameters:
+0:17 'inF0' (in 3-component vector of uint)
+0:? Sequence
0:18 Branch: Return with expression
-0:? Constant:
-0:? 1.000000
-0:? 2.000000
-0:22 Function Definition: PixelShaderFunction3(vf3; (temp 3-component vector of float)
+0:18 Construct vec3 (temp 3-component vector of float)
+0:18 direct index (temp float)
+0:18 unpackHalf2x16 (temp 2-component vector of float)
+0:18 direct index (temp uint)
+0:18 'inF0' (in 3-component vector of uint)
+0:18 Constant:
+0:18 0 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 direct index (temp float)
+0:18 unpackHalf2x16 (temp 2-component vector of float)
+0:18 direct index (temp uint)
+0:18 'inF0' (in 3-component vector of uint)
+0:18 Constant:
+0:18 1 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 direct index (temp float)
+0:18 unpackHalf2x16 (temp 2-component vector of float)
+0:18 direct index (temp uint)
+0:18 'inF0' (in 3-component vector of uint)
+0:18 Constant:
+0:18 2 (const int)
+0:18 Constant:
+0:18 0.000000
+0:22 Function Definition: PixelShaderFunction(vu4; (temp 4-component vector of float)
0:22 Function Parameters:
-0:22 'inF0' (in 3-component vector of float)
+0:22 'inF0' (in 4-component vector of uint)
0:? Sequence
-0:23 ERROR: Bad unary op
- (temp 3-component vector of uint)
-0:23 'inF0' (in 3-component vector of float)
-0:25 Branch: Return with expression
-0:? Constant:
-0:? 1.000000
-0:? 2.000000
-0:? 3.000000
-0:29 Function Definition: @PixelShaderFunction(vf4; (temp 4-component vector of float)
-0:29 Function Parameters:
-0:29 'inF0' (in 4-component vector of float)
+0:23 Branch: Return with expression
+0:23 Construct vec4 (temp 4-component vector of float)
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 0 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 1 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 2 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 3 (const int)
+0:23 Constant:
+0:23 0.000000
+0:27 Function Definition: @main( (temp 4-component vector of float)
+0:27 Function Parameters:
0:? Sequence
-0:30 ERROR: Bad unary op
- (temp 4-component vector of uint)
-0:30 'inF0' (in 4-component vector of float)
-0:32 Branch: Return with expression
-0:? Constant:
-0:? 1.000000
-0:? 2.000000
-0:? 3.000000
-0:? 4.000000
-0:29 Function Definition: PixelShaderFunction( (temp void)
-0:29 Function Parameters:
+0:28 Branch: Return with expression
+0:28 Constant:
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:27 Function Definition: main( (temp void)
+0:27 Function Parameters:
0:? Sequence
-0:29 move second child to first child (temp 4-component vector of float)
-0:? 'inF0' (temp 4-component vector of float)
-0:? 'inF0' (layout(location=0 ) in 4-component vector of float)
-0:29 move second child to first child (temp 4-component vector of float)
+0:27 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
-0:29 Function Call: @PixelShaderFunction(vf4; (temp 4-component vector of float)
-0:? 'inF0' (temp 4-component vector of float)
+0:27 Function Call: @main( (temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
-0:? 'inF0' (layout(location=0 ) in 4-component vector of float)
Linked fragment stage:
@@ -82,72 +133,256 @@
Shader version: 450
gl_FragCoord origin is upper left
-ERROR: node is still EOpNull!
-0:2 Function Definition: PixelShaderFunctionS(f1; (temp float)
+0:? Sequence
+0:2 Function Definition: PixelShaderFunctionS(u1; (temp float)
0:2 Function Parameters:
-0:2 'inF0' (in float)
+0:2 'inF0' (in uint)
0:? Sequence
-0:3 ERROR: Bad unary op
- (temp uint)
-0:3 'inF0' (in float)
-0:5 Branch: Return with expression
-0:5 Constant:
-0:5 0.000000
-0:9 Function Definition: PixelShaderFunction1(vf1; (temp 1-component vector of float)
-0:9 Function Parameters:
-0:9 'inF0' (in 1-component vector of float)
+0:3 Branch: Return with expression
+0:3 direct index (temp float)
+0:3 unpackHalf2x16 (temp 2-component vector of float)
+0:3 'inF0' (in uint)
+0:3 Constant:
+0:3 0.000000
+0:7 Function Definition: PixelShaderFunction1(vu1; (temp 1-component vector of float)
+0:7 Function Parameters:
+0:7 'inF0' (in 1-component vector of uint)
0:? Sequence
-0:11 Branch: Return with expression
-0:11 Constant:
-0:11 0.000000
-0:15 Function Definition: PixelShaderFunction2(vf2; (temp 2-component vector of float)
-0:15 Function Parameters:
-0:15 'inF0' (in 2-component vector of float)
+0:8 Branch: Return with expression
+0:8 Constant:
+0:8 0.000000
+0:12 Function Definition: PixelShaderFunction2(vu2; (temp 2-component vector of float)
+0:12 Function Parameters:
+0:12 'inF0' (in 2-component vector of uint)
0:? Sequence
-0:16 ERROR: Bad unary op
- (temp 2-component vector of uint)
-0:16 'inF0' (in 2-component vector of float)
+0:13 Branch: Return with expression
+0:13 Construct vec2 (temp 2-component vector of float)
+0:13 direct index (temp float)
+0:13 unpackHalf2x16 (temp 2-component vector of float)
+0:13 direct index (temp uint)
+0:13 'inF0' (in 2-component vector of uint)
+0:13 Constant:
+0:13 0 (const int)
+0:13 Constant:
+0:13 0.000000
+0:13 direct index (temp float)
+0:13 unpackHalf2x16 (temp 2-component vector of float)
+0:13 direct index (temp uint)
+0:13 'inF0' (in 2-component vector of uint)
+0:13 Constant:
+0:13 1 (const int)
+0:13 Constant:
+0:13 0.000000
+0:17 Function Definition: PixelShaderFunction3(vu3; (temp 3-component vector of float)
+0:17 Function Parameters:
+0:17 'inF0' (in 3-component vector of uint)
+0:? Sequence
0:18 Branch: Return with expression
-0:? Constant:
-0:? 1.000000
-0:? 2.000000
-0:22 Function Definition: PixelShaderFunction3(vf3; (temp 3-component vector of float)
+0:18 Construct vec3 (temp 3-component vector of float)
+0:18 direct index (temp float)
+0:18 unpackHalf2x16 (temp 2-component vector of float)
+0:18 direct index (temp uint)
+0:18 'inF0' (in 3-component vector of uint)
+0:18 Constant:
+0:18 0 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 direct index (temp float)
+0:18 unpackHalf2x16 (temp 2-component vector of float)
+0:18 direct index (temp uint)
+0:18 'inF0' (in 3-component vector of uint)
+0:18 Constant:
+0:18 1 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 direct index (temp float)
+0:18 unpackHalf2x16 (temp 2-component vector of float)
+0:18 direct index (temp uint)
+0:18 'inF0' (in 3-component vector of uint)
+0:18 Constant:
+0:18 2 (const int)
+0:18 Constant:
+0:18 0.000000
+0:22 Function Definition: PixelShaderFunction(vu4; (temp 4-component vector of float)
0:22 Function Parameters:
-0:22 'inF0' (in 3-component vector of float)
+0:22 'inF0' (in 4-component vector of uint)
0:? Sequence
-0:23 ERROR: Bad unary op
- (temp 3-component vector of uint)
-0:23 'inF0' (in 3-component vector of float)
-0:25 Branch: Return with expression
-0:? Constant:
-0:? 1.000000
-0:? 2.000000
-0:? 3.000000
-0:29 Function Definition: @PixelShaderFunction(vf4; (temp 4-component vector of float)
-0:29 Function Parameters:
-0:29 'inF0' (in 4-component vector of float)
+0:23 Branch: Return with expression
+0:23 Construct vec4 (temp 4-component vector of float)
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 0 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 1 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 2 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 direct index (temp float)
+0:23 unpackHalf2x16 (temp 2-component vector of float)
+0:23 direct index (temp uint)
+0:23 'inF0' (in 4-component vector of uint)
+0:23 Constant:
+0:23 3 (const int)
+0:23 Constant:
+0:23 0.000000
+0:27 Function Definition: @main( (temp 4-component vector of float)
+0:27 Function Parameters:
0:? Sequence
-0:30 ERROR: Bad unary op
- (temp 4-component vector of uint)
-0:30 'inF0' (in 4-component vector of float)
-0:32 Branch: Return with expression
-0:? Constant:
-0:? 1.000000
-0:? 2.000000
-0:? 3.000000
-0:? 4.000000
-0:29 Function Definition: PixelShaderFunction( (temp void)
-0:29 Function Parameters:
+0:28 Branch: Return with expression
+0:28 Constant:
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:27 Function Definition: main( (temp void)
+0:27 Function Parameters:
0:? Sequence
-0:29 move second child to first child (temp 4-component vector of float)
-0:? 'inF0' (temp 4-component vector of float)
-0:? 'inF0' (layout(location=0 ) in 4-component vector of float)
-0:29 move second child to first child (temp 4-component vector of float)
+0:27 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
-0:29 Function Call: @PixelShaderFunction(vf4; (temp 4-component vector of float)
-0:? 'inF0' (temp 4-component vector of float)
+0:27 Function Call: @main( (temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
-0:? 'inF0' (layout(location=0 ) in 4-component vector of float)
-SPIR-V is not generated for failed compile or link
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 103
+
+ Capability Shader
+ 1: ExtInstImport "GLSL.std.450"
+ MemoryModel Logical GLSL450
+ EntryPoint Fragment 4 "main" 101
+ ExecutionMode 4 OriginUpperLeft
+ Name 4 "main"
+ Name 11 "PixelShaderFunctionS(u1;"
+ Name 10 "inF0"
+ Name 14 "PixelShaderFunction1(vu1;"
+ Name 13 "inF0"
+ Name 21 "PixelShaderFunction2(vu2;"
+ Name 20 "inF0"
+ Name 28 "PixelShaderFunction3(vu3;"
+ Name 27 "inF0"
+ Name 35 "PixelShaderFunction(vu4;"
+ Name 34 "inF0"
+ Name 38 "@main("
+ Name 101 "@entryPointOutput"
+ Decorate 101(@entryPointOutput) Location 0
+ 2: TypeVoid
+ 3: TypeFunction 2
+ 6: TypeInt 32 0
+ 7: TypePointer Function 6(int)
+ 8: TypeFloat 32
+ 9: TypeFunction 8(float) 7(ptr)
+ 16: TypeVector 6(int) 2
+ 17: TypePointer Function 16(ivec2)
+ 18: TypeVector 8(float) 2
+ 19: TypeFunction 18(fvec2) 17(ptr)
+ 23: TypeVector 6(int) 3
+ 24: TypePointer Function 23(ivec3)
+ 25: TypeVector 8(float) 3
+ 26: TypeFunction 25(fvec3) 24(ptr)
+ 30: TypeVector 6(int) 4
+ 31: TypePointer Function 30(ivec4)
+ 32: TypeVector 8(float) 4
+ 33: TypeFunction 32(fvec4) 31(ptr)
+ 37: TypeFunction 32(fvec4)
+ 42: 6(int) Constant 0
+ 46: 8(float) Constant 0
+ 53: 6(int) Constant 1
+ 69: 6(int) Constant 2
+ 89: 6(int) Constant 3
+ 97: 32(fvec4) ConstantComposite 46 46 46 46
+ 100: TypePointer Output 32(fvec4)
+101(@entryPointOutput): 100(ptr) Variable Output
+ 4(main): 2 Function None 3
+ 5: Label
+ 102: 32(fvec4) FunctionCall 38(@main()
+ Store 101(@entryPointOutput) 102
+ Return
+ FunctionEnd
+11(PixelShaderFunctionS(u1;): 8(float) Function None 9
+ 10(inF0): 7(ptr) FunctionParameter
+ 12: Label
+ 40: 6(int) Load 10(inF0)
+ 41: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 40
+ 43: 8(float) CompositeExtract 41 0
+ ReturnValue 43
+ FunctionEnd
+14(PixelShaderFunction1(vu1;): 8(float) Function None 9
+ 13(inF0): 7(ptr) FunctionParameter
+ 15: Label
+ ReturnValue 46
+ FunctionEnd
+21(PixelShaderFunction2(vu2;): 18(fvec2) Function None 19
+ 20(inF0): 17(ptr) FunctionParameter
+ 22: Label
+ 49: 7(ptr) AccessChain 20(inF0) 42
+ 50: 6(int) Load 49
+ 51: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 50
+ 52: 8(float) CompositeExtract 51 0
+ 54: 7(ptr) AccessChain 20(inF0) 53
+ 55: 6(int) Load 54
+ 56: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 55
+ 57: 8(float) CompositeExtract 56 0
+ 58: 18(fvec2) CompositeConstruct 52 57
+ ReturnValue 58
+ FunctionEnd
+28(PixelShaderFunction3(vu3;): 25(fvec3) Function None 26
+ 27(inF0): 24(ptr) FunctionParameter
+ 29: Label
+ 61: 7(ptr) AccessChain 27(inF0) 42
+ 62: 6(int) Load 61
+ 63: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 62
+ 64: 8(float) CompositeExtract 63 0
+ 65: 7(ptr) AccessChain 27(inF0) 53
+ 66: 6(int) Load 65
+ 67: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 66
+ 68: 8(float) CompositeExtract 67 0
+ 70: 7(ptr) AccessChain 27(inF0) 69
+ 71: 6(int) Load 70
+ 72: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 71
+ 73: 8(float) CompositeExtract 72 0
+ 74: 25(fvec3) CompositeConstruct 64 68 73
+ ReturnValue 74
+ FunctionEnd
+35(PixelShaderFunction(vu4;): 32(fvec4) Function None 33
+ 34(inF0): 31(ptr) FunctionParameter
+ 36: Label
+ 77: 7(ptr) AccessChain 34(inF0) 42
+ 78: 6(int) Load 77
+ 79: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 78
+ 80: 8(float) CompositeExtract 79 0
+ 81: 7(ptr) AccessChain 34(inF0) 53
+ 82: 6(int) Load 81
+ 83: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 82
+ 84: 8(float) CompositeExtract 83 0
+ 85: 7(ptr) AccessChain 34(inF0) 69
+ 86: 6(int) Load 85
+ 87: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 86
+ 88: 8(float) CompositeExtract 87 0
+ 90: 7(ptr) AccessChain 34(inF0) 89
+ 91: 6(int) Load 90
+ 92: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 91
+ 93: 8(float) CompositeExtract 92 0
+ 94: 32(fvec4) CompositeConstruct 80 84 88 93
+ ReturnValue 94
+ FunctionEnd
+ 38(@main(): 32(fvec4) Function None 37
+ 39: Label
+ ReturnValue 97
+ FunctionEnd
diff --git a/Test/baseResults/hlsl.intrinsics.f3216.frag.out b/Test/baseResults/hlsl.intrinsics.f3216.frag.out
new file mode 100644
index 0000000..a75fe65
--- /dev/null
+++ b/Test/baseResults/hlsl.intrinsics.f3216.frag.out
@@ -0,0 +1,401 @@
+hlsl.intrinsics.f3216.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2 Function Definition: PixelShaderFunctionS(f1; (temp uint)
+0:2 Function Parameters:
+0:2 'inF0' (in float)
+0:? Sequence
+0:3 Branch: Return with expression
+0:3 packHalf2x16 (temp uint)
+0:3 Construct vec2 (temp 2-component vector of float)
+0:3 'inF0' (in float)
+0:3 Constant:
+0:3 0.000000
+0:7 Function Definition: PixelShaderFunction1(vf1; (temp 1-component vector of uint)
+0:7 Function Parameters:
+0:7 'inF0' (in 1-component vector of float)
+0:? Sequence
+0:8 Branch: Return with expression
+0:8 Construct uint (temp 1-component vector of uint)
+0:8 packHalf2x16 (temp uint)
+0:8 Construct vec2 (temp 2-component vector of float)
+0:8 Construct float (in float)
+0:8 'inF0' (in 1-component vector of float)
+0:8 Constant:
+0:8 0.000000
+0:12 Function Definition: PixelShaderFunction2(vf2; (temp 2-component vector of uint)
+0:12 Function Parameters:
+0:12 'inF0' (in 2-component vector of float)
+0:? Sequence
+0:13 Branch: Return with expression
+0:13 Construct uvec2 (temp 2-component vector of uint)
+0:13 packHalf2x16 (temp uint)
+0:13 Construct vec2 (temp 2-component vector of float)
+0:13 direct index (temp float)
+0:13 'inF0' (in 2-component vector of float)
+0:13 Constant:
+0:13 0 (const int)
+0:13 Constant:
+0:13 0.000000
+0:13 packHalf2x16 (temp uint)
+0:13 Construct vec2 (temp 2-component vector of float)
+0:13 direct index (temp float)
+0:13 'inF0' (in 2-component vector of float)
+0:13 Constant:
+0:13 1 (const int)
+0:13 Constant:
+0:13 0.000000
+0:17 Function Definition: PixelShaderFunction3(vf3; (temp 3-component vector of uint)
+0:17 Function Parameters:
+0:17 'inF0' (in 3-component vector of float)
+0:? Sequence
+0:18 Branch: Return with expression
+0:18 Construct uvec3 (temp 3-component vector of uint)
+0:18 packHalf2x16 (temp uint)
+0:18 Construct vec2 (temp 2-component vector of float)
+0:18 direct index (temp float)
+0:18 'inF0' (in 3-component vector of float)
+0:18 Constant:
+0:18 0 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 packHalf2x16 (temp uint)
+0:18 Construct vec2 (temp 2-component vector of float)
+0:18 direct index (temp float)
+0:18 'inF0' (in 3-component vector of float)
+0:18 Constant:
+0:18 1 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 packHalf2x16 (temp uint)
+0:18 Construct vec2 (temp 2-component vector of float)
+0:18 direct index (temp float)
+0:18 'inF0' (in 3-component vector of float)
+0:18 Constant:
+0:18 2 (const int)
+0:18 Constant:
+0:18 0.000000
+0:22 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of uint)
+0:22 Function Parameters:
+0:22 'inF0' (in 4-component vector of float)
+0:? Sequence
+0:23 Branch: Return with expression
+0:23 Construct uvec4 (temp 4-component vector of uint)
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 0 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 1 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 2 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 3 (const int)
+0:23 Constant:
+0:23 0.000000
+0:27 Function Definition: @main( (temp 4-component vector of float)
+0:27 Function Parameters:
+0:? Sequence
+0:28 Branch: Return with expression
+0:28 Constant:
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:27 Function Definition: main( (temp void)
+0:27 Function Parameters:
+0:? Sequence
+0:27 move second child to first child (temp 4-component vector of float)
+0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
+0:27 Function Call: @main( (temp 4-component vector of float)
+0:? Linker Objects
+0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2 Function Definition: PixelShaderFunctionS(f1; (temp uint)
+0:2 Function Parameters:
+0:2 'inF0' (in float)
+0:? Sequence
+0:3 Branch: Return with expression
+0:3 packHalf2x16 (temp uint)
+0:3 Construct vec2 (temp 2-component vector of float)
+0:3 'inF0' (in float)
+0:3 Constant:
+0:3 0.000000
+0:7 Function Definition: PixelShaderFunction1(vf1; (temp 1-component vector of uint)
+0:7 Function Parameters:
+0:7 'inF0' (in 1-component vector of float)
+0:? Sequence
+0:8 Branch: Return with expression
+0:8 Construct uint (temp 1-component vector of uint)
+0:8 packHalf2x16 (temp uint)
+0:8 Construct vec2 (temp 2-component vector of float)
+0:8 Construct float (in float)
+0:8 'inF0' (in 1-component vector of float)
+0:8 Constant:
+0:8 0.000000
+0:12 Function Definition: PixelShaderFunction2(vf2; (temp 2-component vector of uint)
+0:12 Function Parameters:
+0:12 'inF0' (in 2-component vector of float)
+0:? Sequence
+0:13 Branch: Return with expression
+0:13 Construct uvec2 (temp 2-component vector of uint)
+0:13 packHalf2x16 (temp uint)
+0:13 Construct vec2 (temp 2-component vector of float)
+0:13 direct index (temp float)
+0:13 'inF0' (in 2-component vector of float)
+0:13 Constant:
+0:13 0 (const int)
+0:13 Constant:
+0:13 0.000000
+0:13 packHalf2x16 (temp uint)
+0:13 Construct vec2 (temp 2-component vector of float)
+0:13 direct index (temp float)
+0:13 'inF0' (in 2-component vector of float)
+0:13 Constant:
+0:13 1 (const int)
+0:13 Constant:
+0:13 0.000000
+0:17 Function Definition: PixelShaderFunction3(vf3; (temp 3-component vector of uint)
+0:17 Function Parameters:
+0:17 'inF0' (in 3-component vector of float)
+0:? Sequence
+0:18 Branch: Return with expression
+0:18 Construct uvec3 (temp 3-component vector of uint)
+0:18 packHalf2x16 (temp uint)
+0:18 Construct vec2 (temp 2-component vector of float)
+0:18 direct index (temp float)
+0:18 'inF0' (in 3-component vector of float)
+0:18 Constant:
+0:18 0 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 packHalf2x16 (temp uint)
+0:18 Construct vec2 (temp 2-component vector of float)
+0:18 direct index (temp float)
+0:18 'inF0' (in 3-component vector of float)
+0:18 Constant:
+0:18 1 (const int)
+0:18 Constant:
+0:18 0.000000
+0:18 packHalf2x16 (temp uint)
+0:18 Construct vec2 (temp 2-component vector of float)
+0:18 direct index (temp float)
+0:18 'inF0' (in 3-component vector of float)
+0:18 Constant:
+0:18 2 (const int)
+0:18 Constant:
+0:18 0.000000
+0:22 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of uint)
+0:22 Function Parameters:
+0:22 'inF0' (in 4-component vector of float)
+0:? Sequence
+0:23 Branch: Return with expression
+0:23 Construct uvec4 (temp 4-component vector of uint)
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 0 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 1 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 2 (const int)
+0:23 Constant:
+0:23 0.000000
+0:23 packHalf2x16 (temp uint)
+0:23 Construct vec2 (temp 2-component vector of float)
+0:23 direct index (temp float)
+0:23 'inF0' (in 4-component vector of float)
+0:23 Constant:
+0:23 3 (const int)
+0:23 Constant:
+0:23 0.000000
+0:27 Function Definition: @main( (temp 4-component vector of float)
+0:27 Function Parameters:
+0:? Sequence
+0:28 Branch: Return with expression
+0:28 Constant:
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:28 0.000000
+0:27 Function Definition: main( (temp void)
+0:27 Function Parameters:
+0:? Sequence
+0:27 move second child to first child (temp 4-component vector of float)
+0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
+0:27 Function Call: @main( (temp 4-component vector of float)
+0:? Linker Objects
+0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 106
+
+ Capability Shader
+ 1: ExtInstImport "GLSL.std.450"
+ MemoryModel Logical GLSL450
+ EntryPoint Fragment 4 "main" 104
+ ExecutionMode 4 OriginUpperLeft
+ Name 4 "main"
+ Name 11 "PixelShaderFunctionS(f1;"
+ Name 10 "inF0"
+ Name 14 "PixelShaderFunction1(vf1;"
+ Name 13 "inF0"
+ Name 21 "PixelShaderFunction2(vf2;"
+ Name 20 "inF0"
+ Name 28 "PixelShaderFunction3(vf3;"
+ Name 27 "inF0"
+ Name 35 "PixelShaderFunction(vf4;"
+ Name 34 "inF0"
+ Name 38 "@main("
+ Name 104 "@entryPointOutput"
+ Decorate 104(@entryPointOutput) Location 0
+ 2: TypeVoid
+ 3: TypeFunction 2
+ 6: TypeFloat 32
+ 7: TypePointer Function 6(float)
+ 8: TypeInt 32 0
+ 9: TypeFunction 8(int) 7(ptr)
+ 16: TypeVector 6(float) 2
+ 17: TypePointer Function 16(fvec2)
+ 18: TypeVector 8(int) 2
+ 19: TypeFunction 18(ivec2) 17(ptr)
+ 23: TypeVector 6(float) 3
+ 24: TypePointer Function 23(fvec3)
+ 25: TypeVector 8(int) 3
+ 26: TypeFunction 25(ivec3) 24(ptr)
+ 30: TypeVector 6(float) 4
+ 31: TypePointer Function 30(fvec4)
+ 32: TypeVector 8(int) 4
+ 33: TypeFunction 32(ivec4) 31(ptr)
+ 37: TypeFunction 30(fvec4)
+ 41: 6(float) Constant 0
+ 51: 8(int) Constant 0
+ 56: 8(int) Constant 1
+ 72: 8(int) Constant 2
+ 92: 8(int) Constant 3
+ 100: 30(fvec4) ConstantComposite 41 41 41 41
+ 103: TypePointer Output 30(fvec4)
+104(@entryPointOutput): 103(ptr) Variable Output
+ 4(main): 2 Function None 3
+ 5: Label
+ 105: 30(fvec4) FunctionCall 38(@main()
+ Store 104(@entryPointOutput) 105
+ Return
+ FunctionEnd
+11(PixelShaderFunctionS(f1;): 8(int) Function None 9
+ 10(inF0): 7(ptr) FunctionParameter
+ 12: Label
+ 40: 6(float) Load 10(inF0)
+ 42: 16(fvec2) CompositeConstruct 40 41
+ 43: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 42
+ ReturnValue 43
+ FunctionEnd
+14(PixelShaderFunction1(vf1;): 8(int) Function None 9
+ 13(inF0): 7(ptr) FunctionParameter
+ 15: Label
+ 46: 6(float) Load 13(inF0)
+ 47: 16(fvec2) CompositeConstruct 46 41
+ 48: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 47
+ ReturnValue 48
+ FunctionEnd
+21(PixelShaderFunction2(vf2;): 18(ivec2) Function None 19
+ 20(inF0): 17(ptr) FunctionParameter
+ 22: Label
+ 52: 7(ptr) AccessChain 20(inF0) 51
+ 53: 6(float) Load 52
+ 54: 16(fvec2) CompositeConstruct 53 41
+ 55: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 54
+ 57: 7(ptr) AccessChain 20(inF0) 56
+ 58: 6(float) Load 57
+ 59: 16(fvec2) CompositeConstruct 58 41
+ 60: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 59
+ 61: 18(ivec2) CompositeConstruct 55 60
+ ReturnValue 61
+ FunctionEnd
+28(PixelShaderFunction3(vf3;): 25(ivec3) Function None 26
+ 27(inF0): 24(ptr) FunctionParameter
+ 29: Label
+ 64: 7(ptr) AccessChain 27(inF0) 51
+ 65: 6(float) Load 64
+ 66: 16(fvec2) CompositeConstruct 65 41
+ 67: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 66
+ 68: 7(ptr) AccessChain 27(inF0) 56
+ 69: 6(float) Load 68
+ 70: 16(fvec2) CompositeConstruct 69 41
+ 71: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 70
+ 73: 7(ptr) AccessChain 27(inF0) 72
+ 74: 6(float) Load 73
+ 75: 16(fvec2) CompositeConstruct 74 41
+ 76: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 75
+ 77: 25(ivec3) CompositeConstruct 67 71 76
+ ReturnValue 77
+ FunctionEnd
+35(PixelShaderFunction(vf4;): 32(ivec4) Function None 33
+ 34(inF0): 31(ptr) FunctionParameter
+ 36: Label
+ 80: 7(ptr) AccessChain 34(inF0) 51
+ 81: 6(float) Load 80
+ 82: 16(fvec2) CompositeConstruct 81 41
+ 83: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 82
+ 84: 7(ptr) AccessChain 34(inF0) 56
+ 85: 6(float) Load 84
+ 86: 16(fvec2) CompositeConstruct 85 41
+ 87: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 86
+ 88: 7(ptr) AccessChain 34(inF0) 72
+ 89: 6(float) Load 88
+ 90: 16(fvec2) CompositeConstruct 89 41
+ 91: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 90
+ 93: 7(ptr) AccessChain 34(inF0) 92
+ 94: 6(float) Load 93
+ 95: 16(fvec2) CompositeConstruct 94 41
+ 96: 8(int) ExtInst 1(GLSL.std.450) 58(PackHalf2x16) 95
+ 97: 32(ivec4) CompositeConstruct 83 87 91 96
+ ReturnValue 97
+ FunctionEnd
+ 38(@main(): 30(fvec4) Function None 37
+ 39: Label
+ ReturnValue 100
+ FunctionEnd
diff --git a/Test/baseResults/hlsl.intrinsics.negative.frag.out b/Test/baseResults/hlsl.intrinsics.negative.frag.out
index d914154..84df958 100644
--- a/Test/baseResults/hlsl.intrinsics.negative.frag.out
+++ b/Test/baseResults/hlsl.intrinsics.negative.frag.out
@@ -1,6 +1,5 @@
hlsl.intrinsics.negative.frag
ERROR: 0:10: 'determinant' : no matching overloaded function found
-ERROR: 0:12: 'f32tof16' : unimplemented intrinsic: handle natively
ERROR: 0:23: 'length' : ambiguous best function under implicit type conversion
ERROR: 0:25: 'normalize' : ambiguous best function under implicit type conversion
ERROR: 0:26: 'reflect' : ambiguous best function under implicit type conversion
@@ -13,16 +12,13 @@
ERROR: 0:49: 'cross' : no matching overloaded function found
ERROR: 0:50: 'D3DCOLORtoUBYTE4' : no matching overloaded function found
ERROR: 0:51: 'determinant' : no matching overloaded function found
-ERROR: 0:52: 'f32tof16' : unimplemented intrinsic: handle natively
ERROR: 0:57: 'transpose' : no matching overloaded function found
ERROR: 0:64: 'CheckAccessFullyMapped' : no matching overloaded function found
ERROR: 0:66: 'D3DCOLORtoUBYTE4' : no matching overloaded function found
ERROR: 0:67: 'determinant' : no matching overloaded function found
-ERROR: 0:68: 'f32tof16' : unimplemented intrinsic: handle natively
ERROR: 0:73: 'transpose' : no matching overloaded function found
ERROR: 0:81: 'CheckAccessFullyMapped' : no matching overloaded function found
ERROR: 0:84: 'determinant' : no matching overloaded function found
-ERROR: 0:85: 'f32tof16' : unimplemented intrinsic: handle natively
ERROR: 0:90: 'transpose' : no matching overloaded function found
ERROR: 0:117: 'countbits' : no matching overloaded function found
ERROR: 0:117: 'D3DCOLORtoUBYTE4' : no matching overloaded function found
@@ -63,7 +59,7 @@
ERROR: 0:133: 'reflect' : no matching overloaded function found
ERROR: 0:133: 'refract' : no matching overloaded function found
ERROR: 0:133: 'reversebits' : no matching overloaded function found
-ERROR: 64 compilation errors. No code generated.
+ERROR: 60 compilation errors. No code generated.
Shader version: 450
@@ -111,10 +107,12 @@
0:9 3 (const int)
0:10 Constant:
0:10 0.000000
-0:12 ERROR: Bad unary op
- (temp float)
-0:12 Convert float to uint (temp uint)
-0:12 'inF0' (in float)
+0:12 direct index (temp float)
+0:12 unpackHalf2x16 (temp 2-component vector of float)
+0:12 Convert float to uint (temp uint)
+0:12 'inF0' (in float)
+0:12 Constant:
+0:12 0.000000
0:13 findMSB (temp uint)
0:13 Convert float to uint (temp uint)
0:13 'inF0' (in float)
@@ -195,10 +193,25 @@
0:50 0.000000
0:51 Constant:
0:51 0.000000
-0:52 ERROR: Bad unary op
- (temp 2-component vector of float)
-0:52 Convert float to uint (temp 2-component vector of uint)
-0:52 'inF0' (in 2-component vector of float)
+0:52 Construct vec2 (temp 2-component vector of float)
+0:52 direct index (temp float)
+0:52 unpackHalf2x16 (temp 2-component vector of float)
+0:52 direct index (temp uint)
+0:52 Convert float to uint (temp 2-component vector of uint)
+0:52 'inF0' (in 2-component vector of float)
+0:52 Constant:
+0:52 0 (const int)
+0:52 Constant:
+0:52 0.000000
+0:52 direct index (temp float)
+0:52 unpackHalf2x16 (temp 2-component vector of float)
+0:52 direct index (temp uint)
+0:52 Convert float to uint (temp 2-component vector of uint)
+0:52 'inF0' (in 2-component vector of float)
+0:52 Constant:
+0:52 1 (const int)
+0:52 Constant:
+0:52 0.000000
0:53 findMSB (temp 2-component vector of uint)
0:53 Convert float to uint (temp 2-component vector of uint)
0:53 'inF0' (in 2-component vector of float)
@@ -230,10 +243,34 @@
0:66 0.000000
0:67 Constant:
0:67 0.000000
-0:68 ERROR: Bad unary op
- (temp 3-component vector of float)
-0:68 Convert float to uint (temp 3-component vector of uint)
-0:68 'inF0' (in 3-component vector of float)
+0:68 Construct vec3 (temp 3-component vector of float)
+0:68 direct index (temp float)
+0:68 unpackHalf2x16 (temp 2-component vector of float)
+0:68 direct index (temp uint)
+0:68 Convert float to uint (temp 3-component vector of uint)
+0:68 'inF0' (in 3-component vector of float)
+0:68 Constant:
+0:68 0 (const int)
+0:68 Constant:
+0:68 0.000000
+0:68 direct index (temp float)
+0:68 unpackHalf2x16 (temp 2-component vector of float)
+0:68 direct index (temp uint)
+0:68 Convert float to uint (temp 3-component vector of uint)
+0:68 'inF0' (in 3-component vector of float)
+0:68 Constant:
+0:68 1 (const int)
+0:68 Constant:
+0:68 0.000000
+0:68 direct index (temp float)
+0:68 unpackHalf2x16 (temp 2-component vector of float)
+0:68 direct index (temp uint)
+0:68 Convert float to uint (temp 3-component vector of uint)
+0:68 'inF0' (in 3-component vector of float)
+0:68 Constant:
+0:68 2 (const int)
+0:68 Constant:
+0:68 0.000000
0:69 findMSB (temp 3-component vector of uint)
0:69 Convert float to uint (temp 3-component vector of uint)
0:69 'inF0' (in 3-component vector of float)
@@ -269,10 +306,43 @@
0:83 'inF1' (in 4-component vector of float)
0:84 Constant:
0:84 0.000000
-0:85 ERROR: Bad unary op
- (temp 4-component vector of float)
-0:85 Convert float to uint (temp 4-component vector of uint)
-0:85 'inF0' (in 4-component vector of float)
+0:85 Construct vec4 (temp 4-component vector of float)
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 0 (const int)
+0:85 Constant:
+0:85 0.000000
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 1 (const int)
+0:85 Constant:
+0:85 0.000000
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 2 (const int)
+0:85 Constant:
+0:85 0.000000
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 3 (const int)
+0:85 Constant:
+0:85 0.000000
0:86 findMSB (temp 4-component vector of uint)
0:86 Convert float to uint (temp 4-component vector of uint)
0:86 'inF0' (in 4-component vector of float)
@@ -499,10 +569,12 @@
0:9 3 (const int)
0:10 Constant:
0:10 0.000000
-0:12 ERROR: Bad unary op
- (temp float)
-0:12 Convert float to uint (temp uint)
-0:12 'inF0' (in float)
+0:12 direct index (temp float)
+0:12 unpackHalf2x16 (temp 2-component vector of float)
+0:12 Convert float to uint (temp uint)
+0:12 'inF0' (in float)
+0:12 Constant:
+0:12 0.000000
0:13 findMSB (temp uint)
0:13 Convert float to uint (temp uint)
0:13 'inF0' (in float)
@@ -583,10 +655,25 @@
0:50 0.000000
0:51 Constant:
0:51 0.000000
-0:52 ERROR: Bad unary op
- (temp 2-component vector of float)
-0:52 Convert float to uint (temp 2-component vector of uint)
-0:52 'inF0' (in 2-component vector of float)
+0:52 Construct vec2 (temp 2-component vector of float)
+0:52 direct index (temp float)
+0:52 unpackHalf2x16 (temp 2-component vector of float)
+0:52 direct index (temp uint)
+0:52 Convert float to uint (temp 2-component vector of uint)
+0:52 'inF0' (in 2-component vector of float)
+0:52 Constant:
+0:52 0 (const int)
+0:52 Constant:
+0:52 0.000000
+0:52 direct index (temp float)
+0:52 unpackHalf2x16 (temp 2-component vector of float)
+0:52 direct index (temp uint)
+0:52 Convert float to uint (temp 2-component vector of uint)
+0:52 'inF0' (in 2-component vector of float)
+0:52 Constant:
+0:52 1 (const int)
+0:52 Constant:
+0:52 0.000000
0:53 findMSB (temp 2-component vector of uint)
0:53 Convert float to uint (temp 2-component vector of uint)
0:53 'inF0' (in 2-component vector of float)
@@ -618,10 +705,34 @@
0:66 0.000000
0:67 Constant:
0:67 0.000000
-0:68 ERROR: Bad unary op
- (temp 3-component vector of float)
-0:68 Convert float to uint (temp 3-component vector of uint)
-0:68 'inF0' (in 3-component vector of float)
+0:68 Construct vec3 (temp 3-component vector of float)
+0:68 direct index (temp float)
+0:68 unpackHalf2x16 (temp 2-component vector of float)
+0:68 direct index (temp uint)
+0:68 Convert float to uint (temp 3-component vector of uint)
+0:68 'inF0' (in 3-component vector of float)
+0:68 Constant:
+0:68 0 (const int)
+0:68 Constant:
+0:68 0.000000
+0:68 direct index (temp float)
+0:68 unpackHalf2x16 (temp 2-component vector of float)
+0:68 direct index (temp uint)
+0:68 Convert float to uint (temp 3-component vector of uint)
+0:68 'inF0' (in 3-component vector of float)
+0:68 Constant:
+0:68 1 (const int)
+0:68 Constant:
+0:68 0.000000
+0:68 direct index (temp float)
+0:68 unpackHalf2x16 (temp 2-component vector of float)
+0:68 direct index (temp uint)
+0:68 Convert float to uint (temp 3-component vector of uint)
+0:68 'inF0' (in 3-component vector of float)
+0:68 Constant:
+0:68 2 (const int)
+0:68 Constant:
+0:68 0.000000
0:69 findMSB (temp 3-component vector of uint)
0:69 Convert float to uint (temp 3-component vector of uint)
0:69 'inF0' (in 3-component vector of float)
@@ -657,10 +768,43 @@
0:83 'inF1' (in 4-component vector of float)
0:84 Constant:
0:84 0.000000
-0:85 ERROR: Bad unary op
- (temp 4-component vector of float)
-0:85 Convert float to uint (temp 4-component vector of uint)
-0:85 'inF0' (in 4-component vector of float)
+0:85 Construct vec4 (temp 4-component vector of float)
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 0 (const int)
+0:85 Constant:
+0:85 0.000000
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 1 (const int)
+0:85 Constant:
+0:85 0.000000
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 2 (const int)
+0:85 Constant:
+0:85 0.000000
+0:85 direct index (temp float)
+0:85 unpackHalf2x16 (temp 2-component vector of float)
+0:85 direct index (temp uint)
+0:85 Convert float to uint (temp 4-component vector of uint)
+0:85 'inF0' (in 4-component vector of float)
+0:85 Constant:
+0:85 3 (const int)
+0:85 Constant:
+0:85 0.000000
0:86 findMSB (temp 4-component vector of uint)
0:86 Convert float to uint (temp 4-component vector of uint)
0:86 'inF0' (in 4-component vector of float)
diff --git a/Test/hlsl.intrinsics.f1632.frag b/Test/hlsl.intrinsics.f1632.frag
index 91ff33e..f406860 100644
--- a/Test/hlsl.intrinsics.f1632.frag
+++ b/Test/hlsl.intrinsics.f1632.frag
@@ -1,34 +1,29 @@
-float PixelShaderFunctionS(float inF0)
+float PixelShaderFunctionS(uint inF0)
{
- f32tof16(inF0);
-
- return 0.0;
+ return f16tof32(inF0);
}
-float1 PixelShaderFunction1(float1 inF0)
+float1 PixelShaderFunction1(uint1 inF0)
{
- // TODO: ... add when float1 prototypes are generated
- return 0.0;
+ return f16tof32(inF0);
}
-float2 PixelShaderFunction2(float2 inF0)
+float2 PixelShaderFunction2(uint2 inF0)
{
- f32tof16(inF0);
-
- return float2(1,2);
+ return f16tof32(inF0);
}
-float3 PixelShaderFunction3(float3 inF0)
+float3 PixelShaderFunction3(uint3 inF0)
{
- f32tof16(inF0);
-
- return float3(1,2,3);
+ return f16tof32(inF0);
}
-float4 PixelShaderFunction(float4 inF0)
+float4 PixelShaderFunction(uint4 inF0)
{
- f32tof16(inF0);
-
- return float4(1,2,3,4);
+ return f16tof32(inF0);
}
+float4 main() : SV_Target0
+{
+ return 0;
+}
diff --git a/Test/hlsl.intrinsics.f3216.frag b/Test/hlsl.intrinsics.f3216.frag
new file mode 100644
index 0000000..f31136d
--- /dev/null
+++ b/Test/hlsl.intrinsics.f3216.frag
@@ -0,0 +1,29 @@
+uint PixelShaderFunctionS(float inF0)
+{
+ return f32tof16(inF0);
+}
+
+uint1 PixelShaderFunction1(float1 inF0)
+{
+ return f32tof16(inF0);
+}
+
+uint2 PixelShaderFunction2(float2 inF0)
+{
+ return f32tof16(inF0);
+}
+
+uint3 PixelShaderFunction3(float3 inF0)
+{
+ return f32tof16(inF0);
+}
+
+uint4 PixelShaderFunction(float4 inF0)
+{
+ return f32tof16(inF0);
+}
+
+float4 main() : SV_Target0
+{
+ return 0;
+}
diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp
index 3187f43..910f439 100644
--- a/gtests/Hlsl.FromFile.cpp
+++ b/gtests/Hlsl.FromFile.cpp
@@ -132,7 +132,8 @@
{"hlsl.intrinsics.evalfns.frag", "main"},
{"hlsl.intrinsics.d3dcolortoubyte4.frag", "main"},
{"hlsl.intrinsics.double.frag", "PixelShaderFunction"},
- {"hlsl.intrinsics.f1632.frag", "PixelShaderFunction"},
+ {"hlsl.intrinsics.f1632.frag", "main"},
+ {"hlsl.intrinsics.f3216.frag", "main"},
{"hlsl.intrinsics.frag", "main"},
{"hlsl.intrinsics.lit.frag", "PixelShaderFunction"},
{"hlsl.intrinsics.negative.comp", "ComputeShaderFunction"},
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index af4edc2..dcf4d96 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -3564,10 +3564,107 @@
}
case EOpF16tof32:
+ {
+ // input uvecN with low 16 bits of each component holding a float16. convert to float32.
+ TIntermTyped* argValue = node->getAsUnaryNode()->getOperand();
+ TIntermTyped* zero = intermediate.addConstantUnion(0.0, EbtFloat, loc, true);
+ const int vecSize = argValue->getType().getVectorSize();
+
+ TOperator constructOp = EOpNull;
+ switch (vecSize) {
+ case 1: constructOp = EOpNull; break; // direct use, no construct needed
+ case 2: constructOp = EOpConstructVec2; break;
+ case 3: constructOp = EOpConstructVec3; break;
+ case 4: constructOp = EOpConstructVec4; break;
+ default: assert(0); break;
+ }
+
+ // For scalar case, we don't need to construct another type.
+ TIntermAggregate* result = (vecSize > 1) ? new TIntermAggregate(constructOp) : nullptr;
+
+ if (result) {
+ result->setType(TType(EbtFloat, EvqTemporary, vecSize));
+ result->setLoc(loc);
+ }
+
+ for (int idx = 0; idx < vecSize; ++idx) {
+ TIntermTyped* idxConst = intermediate.addConstantUnion(idx, loc, true);
+ TIntermTyped* component = argValue->getType().isVector() ?
+ intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc) : argValue;
+
+ if (component != argValue)
+ component->setType(TType(argValue->getBasicType(), EvqTemporary));
+
+ TIntermTyped* unpackOp = new TIntermUnary(EOpUnpackHalf2x16);
+ unpackOp->setType(TType(EbtFloat, EvqTemporary, 2));
+ unpackOp->getAsUnaryNode()->setOperand(component);
+ unpackOp->setLoc(loc);
+
+ TIntermTyped* lowOrder = intermediate.addIndex(EOpIndexDirect, unpackOp, zero, loc);
+
+ if (result != nullptr) {
+ result->getSequence().push_back(lowOrder);
+ node = result;
+ } else {
+ node = lowOrder;
+ }
+ }
+
+ break;
+ }
+
case EOpF32tof16:
{
- // Temporary until decomposition is available.
- error(loc, "unimplemented intrinsic: handle natively", "f32tof16", "");
+ // input floatN converted to 16 bit float in low order bits of each component of uintN
+ TIntermTyped* argValue = node->getAsUnaryNode()->getOperand();
+
+ TIntermTyped* zero = intermediate.addConstantUnion(0.0, EbtFloat, loc, true);
+ const int vecSize = argValue->getType().getVectorSize();
+
+ TOperator constructOp = EOpNull;
+ switch (vecSize) {
+ case 1: constructOp = EOpNull; break; // direct use, no construct needed
+ case 2: constructOp = EOpConstructUVec2; break;
+ case 3: constructOp = EOpConstructUVec3; break;
+ case 4: constructOp = EOpConstructUVec4; break;
+ default: assert(0); break;
+ }
+
+ // For scalar case, we don't need to construct another type.
+ TIntermAggregate* result = (vecSize > 1) ? new TIntermAggregate(constructOp) : nullptr;
+
+ if (result) {
+ result->setType(TType(EbtUint, EvqTemporary, vecSize));
+ result->setLoc(loc);
+ }
+
+ for (int idx = 0; idx < vecSize; ++idx) {
+ TIntermTyped* idxConst = intermediate.addConstantUnion(idx, loc, true);
+ TIntermTyped* component = argValue->getType().isVector() ?
+ intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc) : argValue;
+
+ if (component != argValue)
+ component->setType(TType(argValue->getBasicType(), EvqTemporary));
+
+ TIntermAggregate* vec2ComponentAndZero = new TIntermAggregate(EOpConstructVec2);
+ vec2ComponentAndZero->getSequence().push_back(component);
+ vec2ComponentAndZero->getSequence().push_back(zero);
+ vec2ComponentAndZero->setType(TType(EbtFloat, EvqTemporary, 2));
+ vec2ComponentAndZero->setLoc(loc);
+
+ TIntermTyped* packOp = new TIntermUnary(EOpPackHalf2x16);
+ packOp->getAsUnaryNode()->setOperand(vec2ComponentAndZero);
+ packOp->setLoc(loc);
+ packOp->setType(TType(EbtUint, EvqTemporary));
+
+ if (result != nullptr) {
+ result->getSequence().push_back(packOp);
+ node = result;
+ } else {
+ node = packOp;
+ }
+ }
+
break;
}