HLSL: Recognize types declared as identifiers as identifiers.

E.g., in

    float float;
    (float) * float;

The "(float)" is not a type cast, it is an expression.
This commit is contained in:
John Kessenich
2017-06-13 22:22:52 -06:00
parent 91c46c6567
commit 0320d090e2
4 changed files with 127 additions and 76 deletions

View File

@@ -99,17 +99,28 @@ 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: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:28 move second child to first child ( temp float)
0:28 direct index ( temp float)
0:28 direct index ( temp 3-component vector of float)
0:28 'half2x3' ( temp 2X3 matrix of float)
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:28 component-wise multiply ( temp float)
0:28 'float' ( temp float)
0:28 'float' ( temp float)
0:30 Branch: Return with expression
0:30 Construct vec4 ( temp 4-component vector of float)
0:30 add ( temp float)
0:30 'float' ( temp float)
0:30 direct index ( temp float)
0:30 direct index ( temp 3-component vector of float)
0:30 'half2x3' ( temp 2X3 matrix of float)
0:30 Constant:
0:30 0 (const int)
0:30 Constant:
0:30 0 (const int)
0:9 Function Definition: main( ( temp void)
0:9 Function Parameters:
0:? Sequence
@@ -223,17 +234,28 @@ 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: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:28 move second child to first child ( temp float)
0:28 direct index ( temp float)
0:28 direct index ( temp 3-component vector of float)
0:28 'half2x3' ( temp 2X3 matrix of float)
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:28 component-wise multiply ( temp float)
0:28 'float' ( temp float)
0:28 'float' ( temp float)
0:30 Branch: Return with expression
0:30 Construct vec4 ( temp 4-component vector of float)
0:30 add ( temp float)
0:30 'float' ( temp float)
0:30 direct index ( temp float)
0:30 direct index ( temp 3-component vector of float)
0:30 'half2x3' ( temp 2X3 matrix of float)
0:30 Constant:
0:30 0 (const int)
0:30 Constant:
0:30 0 (const int)
0:9 Function Definition: main( ( temp void)
0:9 Function Parameters:
0:? Sequence
@@ -245,12 +267,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 105
// Id's are bound by 109
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 103
EntryPoint Fragment 4 "main" 107
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -268,8 +290,8 @@ gl_FragCoord origin is upper left
MemberName 56(foo_t) 0 "float"
Name 58 "float"
Name 86 "param"
Name 94 "half2x3"
Name 103 "@entryPointOutput"
Name 93 "half2x3"
Name 107 "@entryPointOutput"
Decorate 49(min16float) RelaxedPrecision
Decorate 50 RelaxedPrecision
Decorate 51 RelaxedPrecision
@@ -294,7 +316,7 @@ gl_FragCoord origin is upper left
Decorate 87 RelaxedPrecision
Decorate 88 RelaxedPrecision
Decorate 89 RelaxedPrecision
Decorate 103(@entryPointOutput) Location 0
Decorate 107(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -319,16 +341,16 @@ gl_FragCoord origin is upper left
56(foo_t): TypeStruct 6(float)
57: TypePointer Function 56(foo_t)
59: 6(float) Constant 1109917696
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
90: TypeVector 6(float) 3
91: TypeMatrix 90(fvec3) 2
92: TypePointer Function 91
97: 22(int) Constant 0
106: TypePointer Output 12(fvec4)
107(@entryPointOutput): 106(ptr) Variable Output
4(main): 2 Function None 3
5: Label
104: 12(fvec4) FunctionCall 14(@main()
Store 103(@entryPointOutput) 104
108: 12(fvec4) FunctionCall 14(@main()
Store 107(@entryPointOutput) 108
Return
FunctionEnd
10(fn(f1;): 6(float) Function None 8
@@ -349,7 +371,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
93(half2x3): 92(ptr) Variable Function
Store 19(float) 20
27: 6(float) Load 19(float)
29: 21(bool) FOrdNotEqual 27 28
@@ -411,10 +433,15 @@ gl_FragCoord origin is upper left
88: 6(float) FunctionCall 10(fn(f1;) 86(param)
89: 6(float) FAdd 85 88
Store 19(float) 89
90: 6(float) Load 19(float)
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
94: 6(float) Load 19(float)
95: 6(float) Load 19(float)
96: 6(float) FMul 94 95
98: 7(ptr) AccessChain 93(half2x3) 40 97
Store 98 96
99: 6(float) Load 19(float)
100: 7(ptr) AccessChain 93(half2x3) 40 97
101: 6(float) Load 100
102: 6(float) FAdd 99 101
103: 12(fvec4) CompositeConstruct 102 102 102 102
ReturnValue 103
FunctionEnd