HLSL: Partially flatten hierarchies, instead of all or nothing.
Fixes #1092. Allows arrays of opaques to keep arrayness, unless needed by uniform array flattening. Can handle assignments of mixed amounts of flattening.
This commit is contained in:
parent
60e9161100
commit
41aa19953f
8 changed files with 741 additions and 163 deletions
150
Test/baseResults/hlsl.partialFlattenMixed.vert.out
Executable file
150
Test/baseResults/hlsl.partialFlattenMixed.vert.out
Executable file
|
|
@ -0,0 +1,150 @@
|
|||
hlsl.partialFlattenMixed.vert
|
||||
WARNING: AST will form illegal SPIR-V; need to transform to legalize
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:10 Function Definition: @main(vf4; ( temp 4-component vector of float)
|
||||
0:10 Function Parameters:
|
||||
0:10 'pos' ( in 4-component vector of float)
|
||||
0:? Sequence
|
||||
0:13 Sequence
|
||||
0:13 move second child to first child ( temp texture2D)
|
||||
0:13 direct index ( temp texture2D)
|
||||
0:? 'packed.membTex' ( temp 2-element array of texture2D)
|
||||
0:13 Constant:
|
||||
0:13 0 (const int)
|
||||
0:? 'tex[0]' ( uniform texture2D)
|
||||
0:13 move second child to first child ( temp texture2D)
|
||||
0:13 direct index ( temp texture2D)
|
||||
0:? 'packed.membTex' ( temp 2-element array of texture2D)
|
||||
0:13 Constant:
|
||||
0:13 1 (const int)
|
||||
0:? 'tex[1]' ( uniform texture2D)
|
||||
0:15 Branch: Return with expression
|
||||
0:15 'pos' ( in 4-component vector of float)
|
||||
0:10 Function Definition: main( ( temp void)
|
||||
0:10 Function Parameters:
|
||||
0:? Sequence
|
||||
0:10 move second child to first child ( temp 4-component vector of float)
|
||||
0:? 'pos' ( temp 4-component vector of float)
|
||||
0:? 'pos' (layout( location=0) in 4-component vector of float)
|
||||
0:10 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
0:10 Function Call: @main(vf4; ( temp 4-component vector of float)
|
||||
0:? 'pos' ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'tex[0]' ( uniform texture2D)
|
||||
0:? 'tex[1]' ( uniform texture2D)
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
0:? 'pos' (layout( location=0) in 4-component vector of float)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:10 Function Definition: @main(vf4; ( temp 4-component vector of float)
|
||||
0:10 Function Parameters:
|
||||
0:10 'pos' ( in 4-component vector of float)
|
||||
0:? Sequence
|
||||
0:13 Sequence
|
||||
0:13 move second child to first child ( temp texture2D)
|
||||
0:13 direct index ( temp texture2D)
|
||||
0:? 'packed.membTex' ( temp 2-element array of texture2D)
|
||||
0:13 Constant:
|
||||
0:13 0 (const int)
|
||||
0:? 'tex[0]' ( uniform texture2D)
|
||||
0:13 move second child to first child ( temp texture2D)
|
||||
0:13 direct index ( temp texture2D)
|
||||
0:? 'packed.membTex' ( temp 2-element array of texture2D)
|
||||
0:13 Constant:
|
||||
0:13 1 (const int)
|
||||
0:? 'tex[1]' ( uniform texture2D)
|
||||
0:15 Branch: Return with expression
|
||||
0:15 'pos' ( in 4-component vector of float)
|
||||
0:10 Function Definition: main( ( temp void)
|
||||
0:10 Function Parameters:
|
||||
0:? Sequence
|
||||
0:10 move second child to first child ( temp 4-component vector of float)
|
||||
0:? 'pos' ( temp 4-component vector of float)
|
||||
0:? 'pos' (layout( location=0) in 4-component vector of float)
|
||||
0:10 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
0:10 Function Call: @main(vf4; ( temp 4-component vector of float)
|
||||
0:? 'pos' ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'tex[0]' ( uniform texture2D)
|
||||
0:? 'tex[1]' ( uniform texture2D)
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
0:? 'pos' (layout( location=0) in 4-component vector of float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80002
|
||||
// Id's are bound by 42
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 35 38
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 11 "@main(vf4;"
|
||||
Name 10 "pos"
|
||||
Name 18 "packed.membTex"
|
||||
Name 22 "tex[0]"
|
||||
Name 27 "tex[1]"
|
||||
Name 33 "pos"
|
||||
Name 35 "pos"
|
||||
Name 38 "@entryPointOutput"
|
||||
Name 39 "param"
|
||||
Decorate 22(tex[0]) DescriptorSet 0
|
||||
Decorate 27(tex[1]) DescriptorSet 0
|
||||
Decorate 35(pos) Location 0
|
||||
Decorate 38(@entryPointOutput) BuiltIn Position
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
9: TypeFunction 7(fvec4) 8(ptr)
|
||||
13: TypeImage 6(float) 2D sampled format:Unknown
|
||||
14: TypeInt 32 0
|
||||
15: 14(int) Constant 2
|
||||
16: TypeArray 13 15
|
||||
17: TypePointer Function 16
|
||||
19: TypeInt 32 1
|
||||
20: 19(int) Constant 0
|
||||
21: TypePointer UniformConstant 13
|
||||
22(tex[0]): 21(ptr) Variable UniformConstant
|
||||
24: TypePointer Function 13
|
||||
26: 19(int) Constant 1
|
||||
27(tex[1]): 21(ptr) Variable UniformConstant
|
||||
34: TypePointer Input 7(fvec4)
|
||||
35(pos): 34(ptr) Variable Input
|
||||
37: TypePointer Output 7(fvec4)
|
||||
38(@entryPointOutput): 37(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
33(pos): 8(ptr) Variable Function
|
||||
39(param): 8(ptr) Variable Function
|
||||
36: 7(fvec4) Load 35(pos)
|
||||
Store 33(pos) 36
|
||||
40: 7(fvec4) Load 33(pos)
|
||||
Store 39(param) 40
|
||||
41: 7(fvec4) FunctionCall 11(@main(vf4;) 39(param)
|
||||
Store 38(@entryPointOutput) 41
|
||||
Return
|
||||
FunctionEnd
|
||||
11(@main(vf4;): 7(fvec4) Function None 9
|
||||
10(pos): 8(ptr) FunctionParameter
|
||||
12: Label
|
||||
18(packed.membTex): 17(ptr) Variable Function
|
||||
23: 13 Load 22(tex[0])
|
||||
25: 24(ptr) AccessChain 18(packed.membTex) 20
|
||||
Store 25 23
|
||||
28: 13 Load 27(tex[1])
|
||||
29: 24(ptr) AccessChain 18(packed.membTex) 26
|
||||
Store 29 28
|
||||
30: 7(fvec4) Load 10(pos)
|
||||
ReturnValue 30
|
||||
FunctionEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue