HLSL: Remove workarounds for assigning to opaques.

This assumes it will be combined with optimizing transforms
that eliminate assignments to opaques.
This commit is contained in:
John Kessenich
2017-09-07 04:33:11 -06:00
committed by GregF
parent dabd1bf2f0
commit 15fa7ef5f5
7 changed files with 313 additions and 234 deletions

View File

@@ -1,6 +1,5 @@
hlsl.flattenOpaqueInit.vert
WARNING: 0:20: '=' : cannot do member-wise aliasing for opaque members with this initializer
WARNING: AST will form illegal SPIR-V; need to transform to legalize
Shader version: 500
0:? Sequence
0:5 Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
@@ -19,13 +18,36 @@ Shader version: 500
0:10 Function Definition: fillOpaque( ( temp structure{ temp sampler smpl, temp texture2D tex})
0:10 Function Parameters:
0:? Sequence
0:12 'g_tInputTexture_sampler' ( uniform sampler)
0:13 'g_tInputTexture' ( uniform texture2D)
0:12 move second child to first child ( temp sampler)
0:? 't.smpl' ( temp sampler)
0:12 'g_tInputTexture_sampler' ( uniform sampler)
0:13 move second child to first child ( temp texture2D)
0:? 't.tex' ( temp texture2D)
0:13 'g_tInputTexture' ( uniform texture2D)
0:14 Branch: Return with expression
0:14 't' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:18 Function Definition: @main( ( temp 4-component vector of float)
0:18 Function Parameters:
0:? Sequence
0:19 Sequence
0:19 Sequence
0:19 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 'g_tInputTexture_sampler' ( uniform sampler)
0:19 'g_tInputTexture' ( uniform texture2D)
0:19 move second child to first child ( temp sampler)
0:? 'tex1.smpl' ( temp sampler)
0:19 smpl: direct index for structure ( temp sampler)
0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 Constant:
0:19 0 (const int)
0:19 move second child to first child ( temp texture2D)
0:? 'tex1.tex' ( temp texture2D)
0:19 tex: direct index for structure ( temp texture2D)
0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 Constant:
0:19 1 (const int)
0:20 Sequence
0:20 Sequence
0:20 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex})
@@ -45,8 +67,8 @@ Shader version: 500
0:20 1 (const int)
0:21 Branch: Return with expression
0:21 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
0:? 'g_tInputTexture_sampler' ( uniform sampler)
0:? 'g_tInputTexture' ( uniform texture2D)
0:? 'tex1.smpl' ( temp sampler)
0:? 'tex1.tex' ( temp texture2D)
0:18 Function Definition: main( ( temp void)
0:18 Function Parameters:
0:? Sequence
@@ -80,13 +102,36 @@ Shader version: 500
0:10 Function Definition: fillOpaque( ( temp structure{ temp sampler smpl, temp texture2D tex})
0:10 Function Parameters:
0:? Sequence
0:12 'g_tInputTexture_sampler' ( uniform sampler)
0:13 'g_tInputTexture' ( uniform texture2D)
0:12 move second child to first child ( temp sampler)
0:? 't.smpl' ( temp sampler)
0:12 'g_tInputTexture_sampler' ( uniform sampler)
0:13 move second child to first child ( temp texture2D)
0:? 't.tex' ( temp texture2D)
0:13 'g_tInputTexture' ( uniform texture2D)
0:14 Branch: Return with expression
0:14 't' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:18 Function Definition: @main( ( temp 4-component vector of float)
0:18 Function Parameters:
0:? Sequence
0:19 Sequence
0:19 Sequence
0:19 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 'g_tInputTexture_sampler' ( uniform sampler)
0:19 'g_tInputTexture' ( uniform texture2D)
0:19 move second child to first child ( temp sampler)
0:? 'tex1.smpl' ( temp sampler)
0:19 smpl: direct index for structure ( temp sampler)
0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 Constant:
0:19 0 (const int)
0:19 move second child to first child ( temp texture2D)
0:? 'tex1.tex' ( temp texture2D)
0:19 tex: direct index for structure ( temp texture2D)
0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:19 Constant:
0:19 1 (const int)
0:20 Sequence
0:20 Sequence
0:20 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex})
@@ -106,8 +151,8 @@ Shader version: 500
0:20 1 (const int)
0:21 Branch: Return with expression
0:21 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
0:? 'g_tInputTexture_sampler' ( uniform sampler)
0:? 'g_tInputTexture' ( uniform texture2D)
0:? 'tex1.smpl' ( temp sampler)
0:? 'tex1.tex' ( temp texture2D)
0:18 Function Definition: main( ( temp void)
0:18 Function Parameters:
0:? Sequence
@@ -121,12 +166,12 @@ Shader version: 500
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 60
// Id's are bound by 74
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 58
EntryPoint Vertex 4 "main" 72
Source HLSL 500
Name 4 "main"
Name 15 "lookUp(struct-FxaaTex-p1-t211;"
@@ -137,16 +182,21 @@ Shader version: 500
MemberName 17(FxaaTex) 1 "tex"
Name 19 "fillOpaque("
Name 22 "@main("
Name 36 "g_tInputTexture_sampler"
Name 37 "g_tInputTexture"
Name 39 "t"
Name 43 "flattenTemp"
Name 45 "tex2.smpl"
Name 50 "tex2.tex"
Name 58 "@entryPointOutput"
Decorate 36(g_tInputTexture_sampler) DescriptorSet 0
Decorate 37(g_tInputTexture) DescriptorSet 0
Decorate 58(@entryPointOutput) Location 0
Name 36 "t.smpl"
Name 37 "g_tInputTexture_sampler"
Name 39 "t.tex"
Name 40 "g_tInputTexture"
Name 43 "t"
Name 47 "flattenTemp"
Name 51 "tex1.smpl"
Name 56 "tex1.tex"
Name 60 "flattenTemp"
Name 62 "tex2.smpl"
Name 65 "tex2.tex"
Name 72 "@entryPointOutput"
Decorate 37(g_tInputTexture_sampler) DescriptorSet 0
Decorate 40(g_tInputTexture) DescriptorSet 0
Decorate 72(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeSampler
@@ -165,22 +215,27 @@ Shader version: 500
30: 8(float) Constant 1053609165
31: 28(fvec2) ConstantComposite 29 30
32: 8(float) Constant 0
36(g_tInputTexture_sampler): 7(ptr) Variable UniformConstant
37(g_tInputTexture): 10(ptr) Variable UniformConstant
38: TypePointer UniformConstant 17(FxaaTex)
39(t): 38(ptr) Variable UniformConstant
43(flattenTemp): 38(ptr) Variable UniformConstant
45(tex2.smpl): 7(ptr) Variable UniformConstant
46: TypeInt 32 1
47: 46(int) Constant 0
50(tex2.tex): 10(ptr) Variable UniformConstant
51: 46(int) Constant 1
57: TypePointer Output 11(fvec4)
58(@entryPointOutput): 57(ptr) Variable Output
36(t.smpl): 7(ptr) Variable UniformConstant
37(g_tInputTexture_sampler): 7(ptr) Variable UniformConstant
39(t.tex): 10(ptr) Variable UniformConstant
40(g_tInputTexture): 10(ptr) Variable UniformConstant
42: TypePointer UniformConstant 17(FxaaTex)
43(t): 42(ptr) Variable UniformConstant
47(flattenTemp): 42(ptr) Variable UniformConstant
51(tex1.smpl): 7(ptr) Variable UniformConstant
52: TypeInt 32 1
53: 52(int) Constant 0
56(tex1.tex): 10(ptr) Variable UniformConstant
57: 52(int) Constant 1
60(flattenTemp): 42(ptr) Variable UniformConstant
62(tex2.smpl): 7(ptr) Variable UniformConstant
65(tex2.tex): 10(ptr) Variable UniformConstant
71: TypePointer Output 11(fvec4)
72(@entryPointOutput): 71(ptr) Variable Output
4(main): 2 Function None 3
5: Label
59: 11(fvec4) FunctionCall 22(@main()
Store 58(@entryPointOutput) 59
73: 11(fvec4) FunctionCall 22(@main()
Store 72(@entryPointOutput) 73
Return
FunctionEnd
15(lookUp(struct-FxaaTex-p1-t211;): 11(fvec4) Function None 12
@@ -195,19 +250,33 @@ Shader version: 500
FunctionEnd
19(fillOpaque(): 17(FxaaTex) Function None 18
20: Label
40: 17(FxaaTex) Load 39(t)
ReturnValue 40
38: 6 Load 37(g_tInputTexture_sampler)
Store 36(t.smpl) 38
41: 9 Load 40(g_tInputTexture)
Store 39(t.tex) 41
44: 17(FxaaTex) Load 43(t)
ReturnValue 44
FunctionEnd
22(@main(): 11(fvec4) Function None 21
23: Label
44: 17(FxaaTex) FunctionCall 19(fillOpaque()
Store 43(flattenTemp) 44
48: 7(ptr) AccessChain 43(flattenTemp) 47
49: 6 Load 48
Store 45(tex2.smpl) 49
52: 10(ptr) AccessChain 43(flattenTemp) 51
53: 9 Load 52
Store 50(tex2.tex) 53
54: 11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 36(g_tInputTexture_sampler) 37(g_tInputTexture)
ReturnValue 54
48: 6 Load 37(g_tInputTexture_sampler)
49: 9 Load 40(g_tInputTexture)
50: 17(FxaaTex) CompositeConstruct 48 49
Store 47(flattenTemp) 50
54: 7(ptr) AccessChain 47(flattenTemp) 53
55: 6 Load 54
Store 51(tex1.smpl) 55
58: 10(ptr) AccessChain 47(flattenTemp) 57
59: 9 Load 58
Store 56(tex1.tex) 59
61: 17(FxaaTex) FunctionCall 19(fillOpaque()
Store 60(flattenTemp) 61
63: 7(ptr) AccessChain 60(flattenTemp) 53
64: 6 Load 63
Store 62(tex2.smpl) 64
66: 10(ptr) AccessChain 60(flattenTemp) 57
67: 9 Load 66
Store 65(tex2.tex) 67
68: 11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 51(tex1.smpl) 56(tex1.tex)
ReturnValue 68
FunctionEnd