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

@ -12,20 +12,29 @@ gl_FragCoord origin is upper left
0:3 'input' (in 4-component vector of float)
0:3 'input' (in 4-component vector of float)
0:3 true case
0:4 Branch: Return with expression
0:4 'input' (in 4-component vector of float)
0:4 Sequence
0:4 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:4 'input' (in 4-component vector of float)
0:4 Branch: Return
0:6 Test condition and select (temp void)
0:6 Condition
0:6 Compare Equal (temp bool)
0:6 'input' (in 4-component vector of float)
0:6 'input' (in 4-component vector of float)
0:6 true case
0:7 Branch: Return with expression
0:7 'input' (in 4-component vector of float)
0:7 Sequence
0:7 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:7 'input' (in 4-component vector of float)
0:7 Branch: Return
0:6 false case
0:9 Branch: Return with expression
0:9 Negate value (temp 4-component vector of float)
0:9 'input' (in 4-component vector of float)
0:9 Sequence
0:9 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:9 Negate value (temp 4-component vector of float)
0:9 'input' (in 4-component vector of float)
0:9 Branch: Return
0:11 Test condition and select (temp void)
0:11 Condition
0:11 Compare Equal (temp bool)
@ -45,8 +54,11 @@ gl_FragCoord origin is upper left
0:19 'input' (in 4-component vector of float)
0:19 true case
0:? Sequence
0:20 Branch: Return with expression
0:20 'input' (in 4-component vector of float)
0:20 Sequence
0:20 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:20 'input' (in 4-component vector of float)
0:20 Branch: Return
0:23 Test condition and select (temp void)
0:23 Condition
0:23 Compare Equal (temp bool)
@ -54,13 +66,19 @@ gl_FragCoord origin is upper left
0:23 'input' (in 4-component vector of float)
0:23 true case
0:? Sequence
0:24 Branch: Return with expression
0:24 'input' (in 4-component vector of float)
0:24 Sequence
0:24 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:24 'input' (in 4-component vector of float)
0:24 Branch: Return
0:23 false case
0:? Sequence
0:26 Branch: Return with expression
0:26 Negate value (temp 4-component vector of float)
0:26 'input' (in 4-component vector of float)
0:26 Sequence
0:26 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:26 Negate value (temp 4-component vector of float)
0:26 'input' (in 4-component vector of float)
0:26 Branch: Return
0:30 Test condition and select (temp void)
0:30 Condition
0:30 move second child to first child (temp float)
@ -93,20 +111,29 @@ gl_FragCoord origin is upper left
0:3 'input' (in 4-component vector of float)
0:3 'input' (in 4-component vector of float)
0:3 true case
0:4 Branch: Return with expression
0:4 'input' (in 4-component vector of float)
0:4 Sequence
0:4 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:4 'input' (in 4-component vector of float)
0:4 Branch: Return
0:6 Test condition and select (temp void)
0:6 Condition
0:6 Compare Equal (temp bool)
0:6 'input' (in 4-component vector of float)
0:6 'input' (in 4-component vector of float)
0:6 true case
0:7 Branch: Return with expression
0:7 'input' (in 4-component vector of float)
0:7 Sequence
0:7 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:7 'input' (in 4-component vector of float)
0:7 Branch: Return
0:6 false case
0:9 Branch: Return with expression
0:9 Negate value (temp 4-component vector of float)
0:9 'input' (in 4-component vector of float)
0:9 Sequence
0:9 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:9 Negate value (temp 4-component vector of float)
0:9 'input' (in 4-component vector of float)
0:9 Branch: Return
0:11 Test condition and select (temp void)
0:11 Condition
0:11 Compare Equal (temp bool)
@ -126,8 +153,11 @@ gl_FragCoord origin is upper left
0:19 'input' (in 4-component vector of float)
0:19 true case
0:? Sequence
0:20 Branch: Return with expression
0:20 'input' (in 4-component vector of float)
0:20 Sequence
0:20 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:20 'input' (in 4-component vector of float)
0:20 Branch: Return
0:23 Test condition and select (temp void)
0:23 Condition
0:23 Compare Equal (temp bool)
@ -135,13 +165,19 @@ gl_FragCoord origin is upper left
0:23 'input' (in 4-component vector of float)
0:23 true case
0:? Sequence
0:24 Branch: Return with expression
0:24 'input' (in 4-component vector of float)
0:24 Sequence
0:24 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:24 'input' (in 4-component vector of float)
0:24 Branch: Return
0:23 false case
0:? Sequence
0:26 Branch: Return with expression
0:26 Negate value (temp 4-component vector of float)
0:26 'input' (in 4-component vector of float)
0:26 Sequence
0:26 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:26 Negate value (temp 4-component vector of float)
0:26 'input' (in 4-component vector of float)
0:26 Branch: Return
0:30 Test condition and select (temp void)
0:30 Condition
0:30 move second child to first child (temp float)
@ -159,17 +195,18 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 82
// Id's are bound by 84
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 9
EntryPoint Fragment 4 "PixelShaderFunction" 9 19
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 9 "input"
Name 65 "ii"
Name 78 "ii"
Name 19 "@entryPointOutput"
Name 67 "ii"
Name 80 "ii"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -178,18 +215,20 @@ gl_FragCoord origin is upper left
9(input): 8(ptr) Variable Input
12: TypeBool
13: TypeVector 12(bool) 4
64: TypePointer Function 6(float)
66: TypeInt 32 0
67: 66(int) Constant 2
68: TypePointer Input 6(float)
74: 6(float) Constant 1065353216
76: TypeInt 32 1
77: TypePointer Function 76(int)
80: 76(int) Constant 1
18: TypePointer Output 7(fvec4)
19(@entryPointOutput): 18(ptr) Variable Output
66: TypePointer Function 6(float)
68: TypeInt 32 0
69: 68(int) Constant 2
70: TypePointer Input 6(float)
76: 6(float) Constant 1065353216
78: TypeInt 32 1
79: TypePointer Function 78(int)
82: 78(int) Constant 1
4(PixelShaderFunction): 2 Function None 3
5: Label
65(ii): 64(ptr) Variable Function
78(ii): 77(ptr) Variable Function
67(ii): 66(ptr) Variable Function
80(ii): 79(ptr) Variable Function
10: 7(fvec4) Load 9(input)
11: 7(fvec4) Load 9(input)
14: 13(bvec4) FOrdEqual 10 11
@ -197,78 +236,84 @@ gl_FragCoord origin is upper left
SelectionMerge 17 None
BranchConditional 15 16 17
16: Label
18: 7(fvec4) Load 9(input)
ReturnValue 18
20: 7(fvec4) Load 9(input)
Store 19(@entryPointOutput) 20
Return
17: Label
20: 7(fvec4) Load 9(input)
21: 7(fvec4) Load 9(input)
22: 13(bvec4) FOrdEqual 20 21
23: 12(bool) All 22
SelectionMerge 25 None
BranchConditional 23 24 28
24: Label
26: 7(fvec4) Load 9(input)
ReturnValue 26
28: Label
29: 7(fvec4) Load 9(input)
30: 7(fvec4) FNegate 29
ReturnValue 30
25: Label
32: 7(fvec4) Load 9(input)
33: 7(fvec4) Load 9(input)
34: 13(bvec4) FOrdEqual 32 33
35: 12(bool) All 34
SelectionMerge 37 None
BranchConditional 35 36 37
36: Label
Branch 37
37: Label
38: 7(fvec4) Load 9(input)
39: 7(fvec4) Load 9(input)
40: 13(bvec4) FOrdEqual 38 39
41: 12(bool) All 40
SelectionMerge 43 None
BranchConditional 41 42 43
42: Label
Branch 43
43: Label
44: 7(fvec4) Load 9(input)
45: 7(fvec4) Load 9(input)
46: 13(bvec4) FOrdEqual 44 45
47: 12(bool) All 46
SelectionMerge 49 None
BranchConditional 47 48 49
48: Label
50: 7(fvec4) Load 9(input)
ReturnValue 50
49: Label
52: 7(fvec4) Load 9(input)
53: 7(fvec4) Load 9(input)
54: 13(bvec4) FOrdEqual 52 53
55: 12(bool) All 54
SelectionMerge 57 None
BranchConditional 55 56 60
56: Label
58: 7(fvec4) Load 9(input)
ReturnValue 58
60: Label
61: 7(fvec4) Load 9(input)
62: 7(fvec4) FNegate 61
ReturnValue 62
57: Label
69: 68(ptr) AccessChain 9(input) 67
70: 6(float) Load 69
Store 65(ii) 70
SelectionMerge 72 None
BranchConditional 70 71 72
71: Label
73: 6(float) Load 65(ii)
75: 6(float) FAdd 73 74
Store 65(ii) 75
Branch 72
72: Label
79: 76(int) Load 78(ii)
81: 76(int) IAdd 79 80
Store 78(ii) 81
22: 7(fvec4) Load 9(input)
23: 7(fvec4) Load 9(input)
24: 13(bvec4) FOrdEqual 22 23
25: 12(bool) All 24
SelectionMerge 27 None
BranchConditional 25 26 30
26: Label
28: 7(fvec4) Load 9(input)
Store 19(@entryPointOutput) 28
Return
30: Label
31: 7(fvec4) Load 9(input)
32: 7(fvec4) FNegate 31
Store 19(@entryPointOutput) 32
Return
27: Label
34: 7(fvec4) Load 9(input)
35: 7(fvec4) Load 9(input)
36: 13(bvec4) FOrdEqual 34 35
37: 12(bool) All 36
SelectionMerge 39 None
BranchConditional 37 38 39
38: Label
Branch 39
39: Label
40: 7(fvec4) Load 9(input)
41: 7(fvec4) Load 9(input)
42: 13(bvec4) FOrdEqual 40 41
43: 12(bool) All 42
SelectionMerge 45 None
BranchConditional 43 44 45
44: Label
Branch 45
45: Label
46: 7(fvec4) Load 9(input)
47: 7(fvec4) Load 9(input)
48: 13(bvec4) FOrdEqual 46 47
49: 12(bool) All 48
SelectionMerge 51 None
BranchConditional 49 50 51
50: Label
52: 7(fvec4) Load 9(input)
Store 19(@entryPointOutput) 52
Return
51: Label
54: 7(fvec4) Load 9(input)
55: 7(fvec4) Load 9(input)
56: 13(bvec4) FOrdEqual 54 55
57: 12(bool) All 56
SelectionMerge 59 None
BranchConditional 57 58 62
58: Label
60: 7(fvec4) Load 9(input)
Store 19(@entryPointOutput) 60
Return
62: Label
63: 7(fvec4) Load 9(input)
64: 7(fvec4) FNegate 63
Store 19(@entryPointOutput) 64
Return
59: Label
71: 70(ptr) AccessChain 9(input) 69
72: 6(float) Load 71
Store 67(ii) 72
SelectionMerge 74 None
BranchConditional 72 73 74
73: Label
75: 6(float) Load 67(ii)
77: 6(float) FAdd 75 76
Store 67(ii) 77
Branch 74
74: Label
81: 78(int) Load 80(ii)
83: 78(int) IAdd 81 82
Store 80(ii) 83
Return
FunctionEnd