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

@@ -131,8 +131,11 @@ Shader version: 450
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:69 Branch: Return with expression
0:69 'vsout' (temp structure{temp 4-component vector of float FragCoord Pos})
0:69 Sequence
0:69 move second child to first child (temp structure{temp 4-component vector of float FragCoord Pos})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float FragCoord Pos})
0:69 'vsout' (temp structure{temp 4-component vector of float FragCoord Pos})
0:69 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
@@ -301,8 +304,11 @@ Shader version: 450
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:69 Branch: Return with expression
0:69 'vsout' (temp structure{temp 4-component vector of float FragCoord Pos})
0:69 Sequence
0:69 move second child to first child (temp structure{temp 4-component vector of float FragCoord Pos})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float FragCoord Pos})
0:69 'vsout' (temp structure{temp 4-component vector of float FragCoord Pos})
0:69 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
@@ -337,14 +343,14 @@ Shader version: 450
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 160
// Id's are bound by 162
Capability Shader
Capability Sampled1D
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
EntryPoint Vertex 4 "main" 115
Name 4 "main"
Name 9 "g_tTex1df4"
Name 14 "c2"
@@ -361,24 +367,25 @@ Shader version: 450
Name 106 "VS_OUTPUT"
MemberName 106(VS_OUTPUT) 0 "Pos"
Name 108 "vsout"
Name 118 "g_sSamp"
Name 121 "g_tTexcdf4"
Name 124 "g_tTexcdi4"
Name 127 "g_tTexcdu4"
Name 130 "g_tTex1df4a"
Name 133 "g_tTex1di4a"
Name 136 "g_tTex1du4a"
Name 139 "g_tTex2df4a"
Name 142 "g_tTex2di4a"
Name 145 "g_tTex2du4a"
Name 148 "g_tTexcdf4a"
Name 151 "g_tTexcdi4a"
Name 154 "g_tTexcdu4a"
Name 155 "c1"
Name 156 "o1"
Name 157 "o2"
Name 158 "o3"
Name 159 "o4"
Name 115 "@entryPointOutput"
Name 120 "g_sSamp"
Name 123 "g_tTexcdf4"
Name 126 "g_tTexcdi4"
Name 129 "g_tTexcdu4"
Name 132 "g_tTex1df4a"
Name 135 "g_tTex1di4a"
Name 138 "g_tTex1du4a"
Name 141 "g_tTex2df4a"
Name 144 "g_tTex2di4a"
Name 147 "g_tTex2du4a"
Name 150 "g_tTexcdf4a"
Name 153 "g_tTexcdi4a"
Name 156 "g_tTexcdu4a"
Name 157 "c1"
Name 158 "o1"
Name 159 "o2"
Name 160 "o3"
Name 161 "o4"
Decorate 9(g_tTex1df4) DescriptorSet 0
Decorate 9(g_tTex1df4) Binding 0
Decorate 27(g_tTex1di4) DescriptorSet 0
@@ -390,20 +397,20 @@ Shader version: 450
Decorate 90(g_tTex3di4) DescriptorSet 0
Decorate 99(g_tTex3du4) DescriptorSet 0
MemberDecorate 106(VS_OUTPUT) 0 BuiltIn FragCoord
Decorate 118(g_sSamp) DescriptorSet 0
Decorate 118(g_sSamp) Binding 0
Decorate 121(g_tTexcdf4) DescriptorSet 0
Decorate 124(g_tTexcdi4) DescriptorSet 0
Decorate 127(g_tTexcdu4) DescriptorSet 0
Decorate 130(g_tTex1df4a) DescriptorSet 0
Decorate 133(g_tTex1di4a) DescriptorSet 0
Decorate 136(g_tTex1du4a) DescriptorSet 0
Decorate 139(g_tTex2df4a) DescriptorSet 0
Decorate 142(g_tTex2di4a) DescriptorSet 0
Decorate 145(g_tTex2du4a) DescriptorSet 0
Decorate 148(g_tTexcdf4a) DescriptorSet 0
Decorate 151(g_tTexcdi4a) DescriptorSet 0
Decorate 154(g_tTexcdu4a) DescriptorSet 0
Decorate 120(g_sSamp) DescriptorSet 0
Decorate 120(g_sSamp) Binding 0
Decorate 123(g_tTexcdf4) DescriptorSet 0
Decorate 126(g_tTexcdi4) DescriptorSet 0
Decorate 129(g_tTexcdu4) DescriptorSet 0
Decorate 132(g_tTex1df4a) DescriptorSet 0
Decorate 135(g_tTex1di4a) DescriptorSet 0
Decorate 138(g_tTex1du4a) DescriptorSet 0
Decorate 141(g_tTex2df4a) DescriptorSet 0
Decorate 144(g_tTex2di4a) DescriptorSet 0
Decorate 147(g_tTex2du4a) DescriptorSet 0
Decorate 150(g_tTexcdf4a) DescriptorSet 0
Decorate 153(g_tTexcdi4a) DescriptorSet 0
Decorate 156(g_tTexcdu4a) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -458,50 +465,52 @@ Shader version: 450
110: 6(float) Constant 0
111: 23(fvec4) ConstantComposite 110 110 110 110
112: TypePointer Function 23(fvec4)
116: TypeSampler
117: TypePointer UniformConstant 116
118(g_sSamp): 117(ptr) Variable UniformConstant
119: TypeImage 6(float) Cube sampled format:Unknown
120: TypePointer UniformConstant 119
121(g_tTexcdf4): 120(ptr) Variable UniformConstant
122: TypeImage 11(int) Cube sampled format:Unknown
123: TypePointer UniformConstant 122
124(g_tTexcdi4): 123(ptr) Variable UniformConstant
125: TypeImage 15(int) Cube sampled format:Unknown
126: TypePointer UniformConstant 125
127(g_tTexcdu4): 126(ptr) Variable UniformConstant
128: TypeImage 6(float) 1D array sampled format:Unknown
129: TypePointer UniformConstant 128
130(g_tTex1df4a): 129(ptr) Variable UniformConstant
131: TypeImage 11(int) 1D array sampled format:Unknown
132: TypePointer UniformConstant 131
133(g_tTex1di4a): 132(ptr) Variable UniformConstant
134: TypeImage 15(int) 1D array sampled format:Unknown
135: TypePointer UniformConstant 134
136(g_tTex1du4a): 135(ptr) Variable UniformConstant
137: TypeImage 6(float) 2D array sampled format:Unknown
138: TypePointer UniformConstant 137
139(g_tTex2df4a): 138(ptr) Variable UniformConstant
140: TypeImage 11(int) 2D array sampled format:Unknown
141: TypePointer UniformConstant 140
142(g_tTex2di4a): 141(ptr) Variable UniformConstant
143: TypeImage 15(int) 2D array sampled format:Unknown
144: TypePointer UniformConstant 143
145(g_tTex2du4a): 144(ptr) Variable UniformConstant
146: TypeImage 6(float) Cube array sampled format:Unknown
147: TypePointer UniformConstant 146
148(g_tTexcdf4a): 147(ptr) Variable UniformConstant
149: TypeImage 11(int) Cube array sampled format:Unknown
150: TypePointer UniformConstant 149
151(g_tTexcdi4a): 150(ptr) Variable UniformConstant
152: TypeImage 15(int) Cube array sampled format:Unknown
153: TypePointer UniformConstant 152
154(g_tTexcdu4a): 153(ptr) Variable UniformConstant
155(c1): 17(ptr) Variable UniformConstant
156(o1): 17(ptr) Variable UniformConstant
157(o2): 13(ptr) Variable UniformConstant
158(o3): 50(ptr) Variable UniformConstant
159(o4): 80(ptr) Variable UniformConstant
114: TypePointer Output 106(VS_OUTPUT)
115(@entryPointOutput): 114(ptr) Variable Output
118: TypeSampler
119: TypePointer UniformConstant 118
120(g_sSamp): 119(ptr) Variable UniformConstant
121: TypeImage 6(float) Cube sampled format:Unknown
122: TypePointer UniformConstant 121
123(g_tTexcdf4): 122(ptr) Variable UniformConstant
124: TypeImage 11(int) Cube sampled format:Unknown
125: TypePointer UniformConstant 124
126(g_tTexcdi4): 125(ptr) Variable UniformConstant
127: TypeImage 15(int) Cube sampled format:Unknown
128: TypePointer UniformConstant 127
129(g_tTexcdu4): 128(ptr) Variable UniformConstant
130: TypeImage 6(float) 1D array sampled format:Unknown
131: TypePointer UniformConstant 130
132(g_tTex1df4a): 131(ptr) Variable UniformConstant
133: TypeImage 11(int) 1D array sampled format:Unknown
134: TypePointer UniformConstant 133
135(g_tTex1di4a): 134(ptr) Variable UniformConstant
136: TypeImage 15(int) 1D array sampled format:Unknown
137: TypePointer UniformConstant 136
138(g_tTex1du4a): 137(ptr) Variable UniformConstant
139: TypeImage 6(float) 2D array sampled format:Unknown
140: TypePointer UniformConstant 139
141(g_tTex2df4a): 140(ptr) Variable UniformConstant
142: TypeImage 11(int) 2D array sampled format:Unknown
143: TypePointer UniformConstant 142
144(g_tTex2di4a): 143(ptr) Variable UniformConstant
145: TypeImage 15(int) 2D array sampled format:Unknown
146: TypePointer UniformConstant 145
147(g_tTex2du4a): 146(ptr) Variable UniformConstant
148: TypeImage 6(float) Cube array sampled format:Unknown
149: TypePointer UniformConstant 148
150(g_tTexcdf4a): 149(ptr) Variable UniformConstant
151: TypeImage 11(int) Cube array sampled format:Unknown
152: TypePointer UniformConstant 151
153(g_tTexcdi4a): 152(ptr) Variable UniformConstant
154: TypeImage 15(int) Cube array sampled format:Unknown
155: TypePointer UniformConstant 154
156(g_tTexcdu4a): 155(ptr) Variable UniformConstant
157(c1): 17(ptr) Variable UniformConstant
158(o1): 17(ptr) Variable UniformConstant
159(o2): 13(ptr) Variable UniformConstant
160(o3): 50(ptr) Variable UniformConstant
161(o4): 80(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
108(vsout): 107(ptr) Variable Function
@@ -561,6 +570,7 @@ Shader version: 450
105: 43(ivec4) ImageFetch 100 102 Lod 104
113: 112(ptr) AccessChain 108(vsout) 109
Store 113 111
114:106(VS_OUTPUT) Load 108(vsout)
ReturnValue 114
116:106(VS_OUTPUT) Load 108(vsout)
Store 115(@entryPointOutput) 116
Return
FunctionEnd