HLSL: Emulate write-to-output on return-from-entry-point, for return value.

This fixes issue #487 and #480.
It also correctly handles output parameters from the entry point.
This commit is contained in:
John Kessenich
2016-08-28 15:00:23 -06:00
parent 81cd764b5f
commit 6a70eb7161
91 changed files with 5158 additions and 4130 deletions

View File

@@ -112,8 +112,11 @@ gl_FragCoord origin is upper left
0:66 1 (const int)
0:66 Constant:
0:66 1.000000
0:68 Branch: Return with expression
0:68 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:68 Sequence
0:68 move second child to first child (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:68 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:68 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
@@ -263,8 +266,11 @@ gl_FragCoord origin is upper left
0:66 1 (const int)
0:66 Constant:
0:66 1.000000
0:68 Branch: Return with expression
0:68 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:68 Sequence
0:68 move second child to first child (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:68 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:68 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
@@ -299,7 +305,7 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 149
// Id's are bound by 151
Capability Shader
Capability ImageGatherExtended
@@ -307,7 +313,7 @@ gl_FragCoord origin is upper left
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 96
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "g_tTex1df4a"
@@ -324,26 +330,27 @@ gl_FragCoord origin is upper left
MemberName 84(PS_OUTPUT) 0 "Color"
MemberName 84(PS_OUTPUT) 1 "Depth"
Name 86 "psout"
Name 99 "g_sSamp"
Name 102 "g_tTex1df4"
Name 105 "g_tTex1di4"
Name 108 "g_tTex1du4"
Name 111 "g_tTex2df4"
Name 114 "g_tTex2di4"
Name 117 "g_tTex2du4"
Name 120 "g_tTex3df4"
Name 123 "g_tTex3di4"
Name 126 "g_tTex3du4"
Name 129 "g_tTexcdf4"
Name 132 "g_tTexcdi4"
Name 135 "g_tTexcdu4"
Name 138 "g_tTexcdf4a"
Name 141 "g_tTexcdi4a"
Name 144 "g_tTexcdu4a"
Name 145 "c1"
Name 146 "c2"
Name 147 "o3"
Name 148 "o4"
Name 96 "@entryPointOutput"
Name 101 "g_sSamp"
Name 104 "g_tTex1df4"
Name 107 "g_tTex1di4"
Name 110 "g_tTex1du4"
Name 113 "g_tTex2df4"
Name 116 "g_tTex2di4"
Name 119 "g_tTex2du4"
Name 122 "g_tTex3df4"
Name 125 "g_tTex3di4"
Name 128 "g_tTex3du4"
Name 131 "g_tTexcdf4"
Name 134 "g_tTexcdi4"
Name 137 "g_tTexcdu4"
Name 140 "g_tTexcdf4a"
Name 143 "g_tTexcdi4a"
Name 146 "g_tTexcdu4a"
Name 147 "c1"
Name 148 "c2"
Name 149 "o3"
Name 150 "o4"
Decorate 9(g_tTex1df4a) DescriptorSet 0
Decorate 29(g_tTex1di4a) DescriptorSet 0
Decorate 40(g_tTex1du4a) DescriptorSet 0
@@ -351,24 +358,24 @@ gl_FragCoord origin is upper left
Decorate 66(g_tTex2di4a) DescriptorSet 0
Decorate 76(g_tTex2du4a) DescriptorSet 0
MemberDecorate 84(PS_OUTPUT) 1 BuiltIn FragDepth
Decorate 99(g_sSamp) DescriptorSet 0
Decorate 99(g_sSamp) Binding 0
Decorate 102(g_tTex1df4) DescriptorSet 0
Decorate 102(g_tTex1df4) Binding 0
Decorate 105(g_tTex1di4) DescriptorSet 0
Decorate 108(g_tTex1du4) DescriptorSet 0
Decorate 111(g_tTex2df4) DescriptorSet 0
Decorate 114(g_tTex2di4) DescriptorSet 0
Decorate 117(g_tTex2du4) DescriptorSet 0
Decorate 120(g_tTex3df4) DescriptorSet 0
Decorate 123(g_tTex3di4) DescriptorSet 0
Decorate 126(g_tTex3du4) DescriptorSet 0
Decorate 129(g_tTexcdf4) DescriptorSet 0
Decorate 132(g_tTexcdi4) DescriptorSet 0
Decorate 135(g_tTexcdu4) DescriptorSet 0
Decorate 138(g_tTexcdf4a) DescriptorSet 0
Decorate 141(g_tTexcdi4a) DescriptorSet 0
Decorate 144(g_tTexcdu4a) DescriptorSet 0
Decorate 101(g_sSamp) DescriptorSet 0
Decorate 101(g_sSamp) Binding 0
Decorate 104(g_tTex1df4) DescriptorSet 0
Decorate 104(g_tTex1df4) Binding 0
Decorate 107(g_tTex1di4) DescriptorSet 0
Decorate 110(g_tTex1du4) DescriptorSet 0
Decorate 113(g_tTex2df4) DescriptorSet 0
Decorate 116(g_tTex2di4) DescriptorSet 0
Decorate 119(g_tTex2du4) DescriptorSet 0
Decorate 122(g_tTex3df4) DescriptorSet 0
Decorate 125(g_tTex3di4) DescriptorSet 0
Decorate 128(g_tTex3du4) DescriptorSet 0
Decorate 131(g_tTexcdf4) DescriptorSet 0
Decorate 134(g_tTexcdi4) DescriptorSet 0
Decorate 137(g_tTexcdu4) DescriptorSet 0
Decorate 140(g_tTexcdf4a) DescriptorSet 0
Decorate 143(g_tTexcdi4a) DescriptorSet 0
Decorate 146(g_tTexcdu4a) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -415,58 +422,60 @@ gl_FragCoord origin is upper left
90: TypePointer Function 25(fvec4)
92: 11(int) Constant 1
93: TypePointer Function 6(float)
97: TypeSampler
98: TypePointer UniformConstant 97
99(g_sSamp): 98(ptr) Variable UniformConstant
100: TypeImage 6(float) 1D sampled format:Unknown
101: TypePointer UniformConstant 100
102(g_tTex1df4): 101(ptr) Variable UniformConstant
103: TypeImage 11(int) 1D sampled format:Unknown
104: TypePointer UniformConstant 103
105(g_tTex1di4): 104(ptr) Variable UniformConstant
106: TypeImage 18(int) 1D sampled format:Unknown
107: TypePointer UniformConstant 106
108(g_tTex1du4): 107(ptr) Variable UniformConstant
109: TypeImage 6(float) 2D sampled format:Unknown
110: TypePointer UniformConstant 109
111(g_tTex2df4): 110(ptr) Variable UniformConstant
112: TypeImage 11(int) 2D sampled format:Unknown
113: TypePointer UniformConstant 112
114(g_tTex2di4): 113(ptr) Variable UniformConstant
115: TypeImage 18(int) 2D sampled format:Unknown
116: TypePointer UniformConstant 115
117(g_tTex2du4): 116(ptr) Variable UniformConstant
118: TypeImage 6(float) 3D sampled format:Unknown
119: TypePointer UniformConstant 118
120(g_tTex3df4): 119(ptr) Variable UniformConstant
121: TypeImage 11(int) 3D sampled format:Unknown
122: TypePointer UniformConstant 121
123(g_tTex3di4): 122(ptr) Variable UniformConstant
124: TypeImage 18(int) 3D sampled format:Unknown
125: TypePointer UniformConstant 124
126(g_tTex3du4): 125(ptr) Variable UniformConstant
127: TypeImage 6(float) Cube sampled format:Unknown
128: TypePointer UniformConstant 127
129(g_tTexcdf4): 128(ptr) Variable UniformConstant
130: TypeImage 11(int) Cube sampled format:Unknown
131: TypePointer UniformConstant 130
132(g_tTexcdi4): 131(ptr) Variable UniformConstant
133: TypeImage 18(int) Cube sampled format:Unknown
134: TypePointer UniformConstant 133
135(g_tTexcdu4): 134(ptr) Variable UniformConstant
136: TypeImage 6(float) Cube array sampled format:Unknown
137: TypePointer UniformConstant 136
138(g_tTexcdf4a): 137(ptr) Variable UniformConstant
139: TypeImage 11(int) Cube array sampled format:Unknown
140: TypePointer UniformConstant 139
141(g_tTexcdi4a): 140(ptr) Variable UniformConstant
142: TypeImage 18(int) Cube array sampled format:Unknown
143: TypePointer UniformConstant 142
144(g_tTexcdu4a): 143(ptr) Variable UniformConstant
145(c1): 20(ptr) Variable UniformConstant
146(c2): 60(ptr) Variable UniformConstant
147(o3): 13(ptr) Variable UniformConstant
148(o4): 53(ptr) Variable UniformConstant
95: TypePointer Output 84(PS_OUTPUT)
96(@entryPointOutput): 95(ptr) Variable Output
99: TypeSampler
100: TypePointer UniformConstant 99
101(g_sSamp): 100(ptr) Variable UniformConstant
102: TypeImage 6(float) 1D sampled format:Unknown
103: TypePointer UniformConstant 102
104(g_tTex1df4): 103(ptr) Variable UniformConstant
105: TypeImage 11(int) 1D sampled format:Unknown
106: TypePointer UniformConstant 105
107(g_tTex1di4): 106(ptr) Variable UniformConstant
108: TypeImage 18(int) 1D sampled format:Unknown
109: TypePointer UniformConstant 108
110(g_tTex1du4): 109(ptr) Variable UniformConstant
111: TypeImage 6(float) 2D sampled format:Unknown
112: TypePointer UniformConstant 111
113(g_tTex2df4): 112(ptr) Variable UniformConstant
114: TypeImage 11(int) 2D sampled format:Unknown
115: TypePointer UniformConstant 114
116(g_tTex2di4): 115(ptr) Variable UniformConstant
117: TypeImage 18(int) 2D sampled format:Unknown
118: TypePointer UniformConstant 117
119(g_tTex2du4): 118(ptr) Variable UniformConstant
120: TypeImage 6(float) 3D sampled format:Unknown
121: TypePointer UniformConstant 120
122(g_tTex3df4): 121(ptr) Variable UniformConstant
123: TypeImage 11(int) 3D sampled format:Unknown
124: TypePointer UniformConstant 123
125(g_tTex3di4): 124(ptr) Variable UniformConstant
126: TypeImage 18(int) 3D sampled format:Unknown
127: TypePointer UniformConstant 126
128(g_tTex3du4): 127(ptr) Variable UniformConstant
129: TypeImage 6(float) Cube sampled format:Unknown
130: TypePointer UniformConstant 129
131(g_tTexcdf4): 130(ptr) Variable UniformConstant
132: TypeImage 11(int) Cube sampled format:Unknown
133: TypePointer UniformConstant 132
134(g_tTexcdi4): 133(ptr) Variable UniformConstant
135: TypeImage 18(int) Cube sampled format:Unknown
136: TypePointer UniformConstant 135
137(g_tTexcdu4): 136(ptr) Variable UniformConstant
138: TypeImage 6(float) Cube array sampled format:Unknown
139: TypePointer UniformConstant 138
140(g_tTexcdf4a): 139(ptr) Variable UniformConstant
141: TypeImage 11(int) Cube array sampled format:Unknown
142: TypePointer UniformConstant 141
143(g_tTexcdi4a): 142(ptr) Variable UniformConstant
144: TypeImage 18(int) Cube array sampled format:Unknown
145: TypePointer UniformConstant 144
146(g_tTexcdu4a): 145(ptr) Variable UniformConstant
147(c1): 20(ptr) Variable UniformConstant
148(c2): 60(ptr) Variable UniformConstant
149(o3): 13(ptr) Variable UniformConstant
150(o4): 53(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
86(psout): 85(ptr) Variable Function
@@ -516,6 +525,7 @@ gl_FragCoord origin is upper left
Store 91 89
94: 93(ptr) AccessChain 86(psout) 92
Store 94 88
95:84(PS_OUTPUT) Load 86(psout)
ReturnValue 95
97:84(PS_OUTPUT) Load 86(psout)
Store 96(@entryPointOutput) 97
Return
FunctionEnd