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

@@ -262,8 +262,11 @@ gl_FragCoord origin is upper left
0:74 1 (const int)
0:74 Constant:
0:74 1.000000
0:76 Branch: Return with expression
0:76 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:76 Sequence
0:76 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:76 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:76 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_sSamp2d' (uniform sampler)
@@ -552,8 +555,11 @@ gl_FragCoord origin is upper left
0:74 1 (const int)
0:74 Constant:
0:74 1.000000
0:76 Branch: Return with expression
0:76 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:76 Sequence
0:76 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:76 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:76 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_sSamp2d' (uniform sampler)
@@ -577,13 +583,13 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 230
// Id's are bound by 232
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 205
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "txval00"
@@ -623,16 +629,17 @@ gl_FragCoord origin is upper left
MemberName 196(PS_OUTPUT) 0 "Color"
MemberName 196(PS_OUTPUT) 1 "Depth"
Name 198 "psout"
Name 206 "g_sSamp2d"
Name 209 "g_tTex1df4a"
Name 210 "g_tTex1df4"
Name 213 "g_tTex1di4"
Name 216 "g_tTex1du4"
Name 219 "g_tTex3df4"
Name 222 "g_tTex3di4"
Name 225 "g_tTex3du4"
Name 227 "c1"
Name 229 "c4"
Name 205 "@entryPointOutput"
Name 208 "g_sSamp2d"
Name 211 "g_tTex1df4a"
Name 212 "g_tTex1df4"
Name 215 "g_tTex1di4"
Name 218 "g_tTex1du4"
Name 221 "g_tTex3df4"
Name 224 "g_tTex3di4"
Name 227 "g_tTex3du4"
Name 229 "c1"
Name 231 "c4"
Decorate 12(g_tTex2df4) DescriptorSet 0
Decorate 16(g_sSamp) DescriptorSet 0
Decorate 16(g_sSamp) Binding 0
@@ -642,16 +649,16 @@ gl_FragCoord origin is upper left
Decorate 125(g_tTexcdi4) DescriptorSet 0
Decorate 135(g_tTexcdu4) DescriptorSet 0
MemberDecorate 196(PS_OUTPUT) 1 BuiltIn FragDepth
Decorate 206(g_sSamp2d) DescriptorSet 0
Decorate 209(g_tTex1df4a) DescriptorSet 0
Decorate 209(g_tTex1df4a) Binding 1
Decorate 210(g_tTex1df4) DescriptorSet 0
Decorate 210(g_tTex1df4) Binding 0
Decorate 213(g_tTex1di4) DescriptorSet 0
Decorate 216(g_tTex1du4) DescriptorSet 0
Decorate 219(g_tTex3df4) DescriptorSet 0
Decorate 222(g_tTex3di4) DescriptorSet 0
Decorate 225(g_tTex3du4) DescriptorSet 0
Decorate 208(g_sSamp2d) DescriptorSet 0
Decorate 211(g_tTex1df4a) DescriptorSet 0
Decorate 211(g_tTex1df4a) Binding 1
Decorate 212(g_tTex1df4) DescriptorSet 0
Decorate 212(g_tTex1df4) Binding 0
Decorate 215(g_tTex1di4) DescriptorSet 0
Decorate 218(g_tTex1du4) DescriptorSet 0
Decorate 221(g_tTex3df4) DescriptorSet 0
Decorate 224(g_tTex3di4) DescriptorSet 0
Decorate 227(g_tTex3du4) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -705,30 +712,32 @@ gl_FragCoord origin is upper left
199: 6(float) Constant 1065353216
200: 7(fvec4) ConstantComposite 199 199 199 199
202: TypePointer Function 6(float)
206(g_sSamp2d): 15(ptr) Variable UniformConstant
207: TypeImage 6(float) 1D sampled format:Unknown
208: TypePointer UniformConstant 207
209(g_tTex1df4a): 208(ptr) Variable UniformConstant
210(g_tTex1df4): 208(ptr) Variable UniformConstant
211: TypeImage 24(int) 1D sampled format:Unknown
212: TypePointer UniformConstant 211
213(g_tTex1di4): 212(ptr) Variable UniformConstant
214: TypeImage 39(int) 1D sampled format:Unknown
215: TypePointer UniformConstant 214
216(g_tTex1du4): 215(ptr) Variable UniformConstant
217: TypeImage 6(float) 3D sampled format:Unknown
218: TypePointer UniformConstant 217
219(g_tTex3df4): 218(ptr) Variable UniformConstant
220: TypeImage 24(int) 3D sampled format:Unknown
221: TypePointer UniformConstant 220
222(g_tTex3di4): 221(ptr) Variable UniformConstant
223: TypeImage 39(int) 3D sampled format:Unknown
224: TypePointer UniformConstant 223
225(g_tTex3du4): 224(ptr) Variable UniformConstant
226: TypePointer UniformConstant 6(float)
227(c1): 226(ptr) Variable UniformConstant
228: TypePointer UniformConstant 7(fvec4)
229(c4): 228(ptr) Variable UniformConstant
204: TypePointer Output 196(PS_OUTPUT)
205(@entryPointOutput): 204(ptr) Variable Output
208(g_sSamp2d): 15(ptr) Variable UniformConstant
209: TypeImage 6(float) 1D sampled format:Unknown
210: TypePointer UniformConstant 209
211(g_tTex1df4a): 210(ptr) Variable UniformConstant
212(g_tTex1df4): 210(ptr) Variable UniformConstant
213: TypeImage 24(int) 1D sampled format:Unknown
214: TypePointer UniformConstant 213
215(g_tTex1di4): 214(ptr) Variable UniformConstant
216: TypeImage 39(int) 1D sampled format:Unknown
217: TypePointer UniformConstant 216
218(g_tTex1du4): 217(ptr) Variable UniformConstant
219: TypeImage 6(float) 3D sampled format:Unknown
220: TypePointer UniformConstant 219
221(g_tTex3df4): 220(ptr) Variable UniformConstant
222: TypeImage 24(int) 3D sampled format:Unknown
223: TypePointer UniformConstant 222
224(g_tTex3di4): 223(ptr) Variable UniformConstant
225: TypeImage 39(int) 3D sampled format:Unknown
226: TypePointer UniformConstant 225
227(g_tTex3du4): 226(ptr) Variable UniformConstant
228: TypePointer UniformConstant 6(float)
229(c1): 228(ptr) Variable UniformConstant
230: TypePointer UniformConstant 7(fvec4)
231(c4): 230(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(txval00): 8(ptr) Variable Function
@@ -904,6 +913,7 @@ gl_FragCoord origin is upper left
Store 201 200
203: 202(ptr) AccessChain 198(psout) 57
Store 203 199
204:196(PS_OUTPUT) Load 198(psout)
ReturnValue 204
206:196(PS_OUTPUT) Load 198(psout)
Store 205(@entryPointOutput) 206
Return
FunctionEnd