HLSL: Implement half matrices, and map all half* -> float*.

This commit is contained in:
John Kessenich
2017-06-06 23:35:25 -06:00
parent f6deacd579
commit 96f65521b4
7 changed files with 311 additions and 75 deletions

View File

@@ -6,42 +6,70 @@ gl_FragCoord origin is upper left
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child ( temp mediump float)
0:4 'h0' ( temp mediump float)
0:4 move second child to first child ( temp float)
0:4 'h0' ( temp float)
0:4 Constant:
0:4 0.000000
0:5 Sequence
0:5 move second child to first child ( temp mediump 1-component vector of float)
0:5 'h1' ( temp mediump 1-component vector of float)
0:5 move second child to first child ( temp 1-component vector of float)
0:5 'h1' ( temp 1-component vector of float)
0:5 Constant:
0:5 1.000000
0:6 Sequence
0:6 move second child to first child ( temp mediump 2-component vector of float)
0:6 'h2' ( temp mediump 2-component vector of float)
0:6 move second child to first child ( temp 2-component vector of float)
0:6 'h2' ( temp 2-component vector of float)
0:6 Constant:
0:6 2.000000
0:6 2.000000
0:7 Sequence
0:7 move second child to first child ( temp mediump 3-component vector of float)
0:7 'h3' ( temp mediump 3-component vector of float)
0:7 move second child to first child ( temp 3-component vector of float)
0:7 'h3' ( temp 3-component vector of float)
0:7 Constant:
0:7 3.000000
0:7 3.000000
0:7 3.000000
0:8 Sequence
0:8 move second child to first child ( temp mediump 4-component vector of float)
0:8 'h4' ( temp mediump 4-component vector of float)
0:8 move second child to first child ( temp 4-component vector of float)
0:8 'h4' ( temp 4-component vector of float)
0:8 Constant:
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:10 Branch: Return with expression
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:15 Sequence
0:15 move second child to first child ( temp 2X2 matrix of float)
0:15 'h22' ( temp 2X2 matrix of float)
0:? Constant:
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:16 Sequence
0:16 move second child to first child ( temp 2X3 matrix of float)
0:16 'h23' ( temp 2X3 matrix of float)
0:16 Constant:
0:16 4.900000
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:16 4.900000
0:16 0.000000
0:27 Branch: Return with expression
0:27 Construct vec4 ( temp 4-component vector of float)
0:27 add ( temp float)
0:27 add ( temp float)
0:27 direct index ( temp float)
0:27 direct index ( temp 3-component vector of float)
0:27 'h23' ( temp 2X3 matrix of float)
0:27 Constant:
0:27 0 (const int)
0:27 Constant:
0:27 0 (const int)
0:27 direct index ( temp float)
0:27 'h4' ( temp 4-component vector of float)
0:27 Constant:
0:27 1 (const int)
0:27 'h0' ( temp float)
0:3 Function Definition: main( ( temp void)
0:3 Function Parameters:
0:? Sequence
@@ -62,42 +90,70 @@ gl_FragCoord origin is upper left
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child ( temp mediump float)
0:4 'h0' ( temp mediump float)
0:4 move second child to first child ( temp float)
0:4 'h0' ( temp float)
0:4 Constant:
0:4 0.000000
0:5 Sequence
0:5 move second child to first child ( temp mediump 1-component vector of float)
0:5 'h1' ( temp mediump 1-component vector of float)
0:5 move second child to first child ( temp 1-component vector of float)
0:5 'h1' ( temp 1-component vector of float)
0:5 Constant:
0:5 1.000000
0:6 Sequence
0:6 move second child to first child ( temp mediump 2-component vector of float)
0:6 'h2' ( temp mediump 2-component vector of float)
0:6 move second child to first child ( temp 2-component vector of float)
0:6 'h2' ( temp 2-component vector of float)
0:6 Constant:
0:6 2.000000
0:6 2.000000
0:7 Sequence
0:7 move second child to first child ( temp mediump 3-component vector of float)
0:7 'h3' ( temp mediump 3-component vector of float)
0:7 move second child to first child ( temp 3-component vector of float)
0:7 'h3' ( temp 3-component vector of float)
0:7 Constant:
0:7 3.000000
0:7 3.000000
0:7 3.000000
0:8 Sequence
0:8 move second child to first child ( temp mediump 4-component vector of float)
0:8 'h4' ( temp mediump 4-component vector of float)
0:8 move second child to first child ( temp 4-component vector of float)
0:8 'h4' ( temp 4-component vector of float)
0:8 Constant:
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:10 Branch: Return with expression
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:15 Sequence
0:15 move second child to first child ( temp 2X2 matrix of float)
0:15 'h22' ( temp 2X2 matrix of float)
0:? Constant:
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:16 Sequence
0:16 move second child to first child ( temp 2X3 matrix of float)
0:16 'h23' ( temp 2X3 matrix of float)
0:16 Constant:
0:16 4.900000
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:16 4.900000
0:16 0.000000
0:27 Branch: Return with expression
0:27 Construct vec4 ( temp 4-component vector of float)
0:27 add ( temp float)
0:27 add ( temp float)
0:27 direct index ( temp float)
0:27 direct index ( temp 3-component vector of float)
0:27 'h23' ( temp 2X3 matrix of float)
0:27 Constant:
0:27 0 (const int)
0:27 Constant:
0:27 0 (const int)
0:27 direct index ( temp float)
0:27 'h4' ( temp 4-component vector of float)
0:27 Constant:
0:27 1 (const int)
0:27 'h0' ( temp float)
0:3 Function Definition: main( ( temp void)
0:3 Function Parameters:
0:? Sequence
@@ -109,12 +165,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 36
// Id's are bound by 61
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 34
EntryPoint Fragment 4 "main" 59
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -124,13 +180,10 @@ gl_FragCoord origin is upper left
Name 18 "h2"
Name 23 "h3"
Name 27 "h4"
Name 34 "@entryPointOutput"
Decorate 12(h0) RelaxedPrecision
Decorate 14(h1) RelaxedPrecision
Decorate 18(h2) RelaxedPrecision
Decorate 23(h3) RelaxedPrecision
Decorate 27(h4) RelaxedPrecision
Decorate 34(@entryPointOutput) Location 0
Name 32 "h22"
Name 38 "h23"
Name 59 "@entryPointOutput"
Decorate 59(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -150,13 +203,28 @@ gl_FragCoord origin is upper left
26: TypePointer Function 7(fvec4)
28: 6(float) Constant 1082130432
29: 7(fvec4) ConstantComposite 28 28 28 28
30: 7(fvec4) ConstantComposite 13 13 13 13
33: TypePointer Output 7(fvec4)
34(@entryPointOutput): 33(ptr) Variable Output
30: TypeMatrix 16(fvec2) 2
31: TypePointer Function 30
33: 16(fvec2) ConstantComposite 15 19
34: 16(fvec2) ConstantComposite 24 28
35: 30 ConstantComposite 33 34
36: TypeMatrix 21(fvec3) 2
37: TypePointer Function 36
39: 6(float) Constant 1084017869
40: 21(fvec3) ConstantComposite 39 13 13
41: 21(fvec3) ConstantComposite 13 39 13
42: 36 ConstantComposite 40 41
43: TypeInt 32 1
44: 43(int) Constant 0
45: TypeInt 32 0
46: 45(int) Constant 0
49: 45(int) Constant 1
58: TypePointer Output 7(fvec4)
59(@entryPointOutput): 58(ptr) Variable Output
4(main): 2 Function None 3
5: Label
35: 7(fvec4) FunctionCall 9(@main()
Store 34(@entryPointOutput) 35
60: 7(fvec4) FunctionCall 9(@main()
Store 59(@entryPointOutput) 60
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
@@ -166,10 +234,22 @@ gl_FragCoord origin is upper left
18(h2): 17(ptr) Variable Function
23(h3): 22(ptr) Variable Function
27(h4): 26(ptr) Variable Function
32(h22): 31(ptr) Variable Function
38(h23): 37(ptr) Variable Function
Store 12(h0) 13
Store 14(h1) 15
Store 18(h2) 20
Store 23(h3) 25
Store 27(h4) 29
ReturnValue 30
Store 32(h22) 35
Store 38(h23) 42
47: 11(ptr) AccessChain 38(h23) 44 46
48: 6(float) Load 47
50: 11(ptr) AccessChain 27(h4) 49
51: 6(float) Load 50
52: 6(float) FAdd 48 51
53: 6(float) Load 12(h0)
54: 6(float) FAdd 52 53
55: 7(fvec4) CompositeConstruct 54 54 54 54
ReturnValue 55
FunctionEnd

View File

@@ -50,8 +50,8 @@ gl_FragCoord origin is upper left
0:15 'min10float' ( temp mediump float)
0:15 'min16float' ( temp mediump float)
0:16 Sequence
0:16 move second child to first child ( temp mediump float)
0:16 'half' ( temp mediump float)
0:16 move second child to first child ( temp float)
0:16 'half' ( temp float)
0:16 Constant:
0:16 0.500000
0:? Sequence
@@ -99,9 +99,17 @@ gl_FragCoord origin is upper left
0:25 'float' ( temp mediump float)
0:25 Function Call: fn(f1; ( temp mediump float)
0:25 'float' ( temp mediump float)
0:27 Branch: Return with expression
0:27 Construct vec4 ( temp 4-component vector of float)
0:27 'float' ( temp float)
0:29 Branch: Return with expression
0:29 Construct vec4 ( temp 4-component vector of float)
0:29 add ( temp float)
0:29 'float' ( temp float)
0:29 direct index ( temp float)
0:29 direct index ( temp 3-component vector of float)
0:29 'half2x3' ( temp 2X3 matrix of float)
0:29 Constant:
0:29 0 (const int)
0:29 Constant:
0:29 0 (const int)
0:9 Function Definition: main( ( temp void)
0:9 Function Parameters:
0:? Sequence
@@ -166,8 +174,8 @@ gl_FragCoord origin is upper left
0:15 'min10float' ( temp mediump float)
0:15 'min16float' ( temp mediump float)
0:16 Sequence
0:16 move second child to first child ( temp mediump float)
0:16 'half' ( temp mediump float)
0:16 move second child to first child ( temp float)
0:16 'half' ( temp float)
0:16 Constant:
0:16 0.500000
0:? Sequence
@@ -215,9 +223,17 @@ gl_FragCoord origin is upper left
0:25 'float' ( temp mediump float)
0:25 Function Call: fn(f1; ( temp mediump float)
0:25 'float' ( temp mediump float)
0:27 Branch: Return with expression
0:27 Construct vec4 ( temp 4-component vector of float)
0:27 'float' ( temp float)
0:29 Branch: Return with expression
0:29 Construct vec4 ( temp 4-component vector of float)
0:29 add ( temp float)
0:29 'float' ( temp float)
0:29 direct index ( temp float)
0:29 direct index ( temp 3-component vector of float)
0:29 'half2x3' ( temp 2X3 matrix of float)
0:29 Constant:
0:29 0 (const int)
0:29 Constant:
0:29 0 (const int)
0:9 Function Definition: main( ( temp void)
0:9 Function Parameters:
0:? Sequence
@@ -229,12 +245,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 97
// Id's are bound by 105
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 95
EntryPoint Fragment 4 "main" 103
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -252,13 +268,13 @@ gl_FragCoord origin is upper left
MemberName 56(foo_t) 0 "float"
Name 58 "float"
Name 86 "param"
Name 95 "@entryPointOutput"
Name 94 "half2x3"
Name 103 "@entryPointOutput"
Decorate 49(min16float) RelaxedPrecision
Decorate 50 RelaxedPrecision
Decorate 51 RelaxedPrecision
Decorate 52(min10float) RelaxedPrecision
Decorate 53 RelaxedPrecision
Decorate 54(half) RelaxedPrecision
Decorate 64 RelaxedPrecision
Decorate 65 RelaxedPrecision
Decorate 66 RelaxedPrecision
@@ -278,7 +294,7 @@ gl_FragCoord origin is upper left
Decorate 87 RelaxedPrecision
Decorate 88 RelaxedPrecision
Decorate 89 RelaxedPrecision
Decorate 95(@entryPointOutput) Location 0
Decorate 103(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -303,12 +319,16 @@ gl_FragCoord origin is upper left
56(foo_t): TypeStruct 6(float)
57: TypePointer Function 56(foo_t)
59: 6(float) Constant 1109917696
94: TypePointer Output 12(fvec4)
95(@entryPointOutput): 94(ptr) Variable Output
91: TypeVector 6(float) 3
92: TypeMatrix 91(fvec3) 2
93: TypePointer Function 92
95: 22(int) Constant 0
102: TypePointer Output 12(fvec4)
103(@entryPointOutput): 102(ptr) Variable Output
4(main): 2 Function None 3
5: Label
96: 12(fvec4) FunctionCall 14(@main()
Store 95(@entryPointOutput) 96
104: 12(fvec4) FunctionCall 14(@main()
Store 103(@entryPointOutput) 104
Return
FunctionEnd
10(fn(f1;): 6(float) Function None 8
@@ -329,6 +349,7 @@ gl_FragCoord origin is upper left
58(float): 57(ptr) Variable Function
75: 7(ptr) Variable Function
86(param): 7(ptr) Variable Function
94(half2x3): 93(ptr) Variable Function
Store 19(float) 20
27: 6(float) Load 19(float)
29: 21(bool) FOrdNotEqual 27 28
@@ -391,6 +412,9 @@ gl_FragCoord origin is upper left
89: 6(float) FAdd 85 88
Store 19(float) 89
90: 6(float) Load 19(float)
91: 12(fvec4) CompositeConstruct 90 90 90 90
ReturnValue 91
96: 7(ptr) AccessChain 94(half2x3) 40 95
97: 6(float) Load 96
98: 6(float) FAdd 90 97
99: 12(fvec4) CompositeConstruct 98 98 98 98
ReturnValue 99
FunctionEnd

View File

@@ -7,5 +7,22 @@ float4 main() : SV_Target0
half3 h3 = 3;
half4 h4 = 4;
return 0.0;
half1x1 h11;
half1x2 h12;
half1x3 h13;
half1x4 h14;
half2x1 h21;
half2x2 h22 = half2x2(1,2,3,4);
half2x3 h23 = (half2x3)4.9;
half2x4 h24;
half3x1 h31;
half3x2 h32;
half3x3 h33;
half3x4 h34;
half4x1 h41;
half4x2 h42;
half4x3 h43;
half4x4 h44;
return h23._11 + h4.y + h0;
}

View File

@@ -24,5 +24,7 @@ float4 main() : SV_Target0
float = float + int + uint + min16float + min10float + (bool[0] ? int : float) + fn(float);
return float;
half2x3 half2x3;
return float + half2x3._11;
}