HLSL: HS return is arrayed to match SPIR-V semantics

HLSL HS outputs a per ctrl point value, and the DS reads an array
of that type.  (It also has a per patch frequency).  The per-ctrl-pt
frequency is arrayed on just one side, as opposed to SPIR-V which
is arrayed on both.  To match semantics, the compiler creates an
array behind the scenes and indexes it by invocation ID, assigning
the HS return value to it.
This commit is contained in:
steve-lunarg 2017-03-22 18:39:25 -06:00
parent 7afe1344ca
commit e752f463c5
6 changed files with 477 additions and 382 deletions

View file

@ -27,7 +27,9 @@ vertices = 3
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
0:26 move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
0:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:26 Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? Barrier ( temp void)
@ -43,7 +45,7 @@ vertices = 3
0:33 Function Definition: PCF( ( temp void)
0:33 Function Parameters:
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
@ -79,7 +81,9 @@ vertices = 3
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
0:26 move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
0:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:26 Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? Barrier ( temp void)
@ -95,18 +99,18 @@ vertices = 3
0:33 Function Definition: PCF( ( temp void)
0:33 Function Parameters:
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 51
// Id's are bound by 55
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 33 36 44
EntryPoint TessellationControl 4 "main" 33 37 39
ExecutionMode 4 OutputVertices 3
Name 4 "main"
Name 8 "VS_OUT"
@ -119,12 +123,12 @@ vertices = 3
Name 21 "output"
Name 31 "ip"
Name 33 "ip"
Name 36 "@entryPointOutput"
Name 37 "param"
Name 44 "InvocationId"
Name 37 "@entryPointOutput"
Name 39 "InvocationId"
Name 41 "param"
Decorate 33(ip) Location 0
Decorate 36(@entryPointOutput) Location 0
Decorate 44(InvocationId) BuiltIn InvocationId
Decorate 37(@entryPointOutput) Location 0
Decorate 39(InvocationId) BuiltIn InvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -142,33 +146,37 @@ vertices = 3
24: TypePointer Function 7(fvec3)
32: TypePointer Input 11
33(ip): 32(ptr) Variable Input
35: TypePointer Output 13(HS_OUT)
36(@entryPointOutput): 35(ptr) Variable Output
40: 9(int) Constant 2
41: 9(int) Constant 1
42: 9(int) Constant 0
43: TypePointer Input 9(int)
44(InvocationId): 43(ptr) Variable Input
46: TypeBool
35: TypeArray 13(HS_OUT) 10
36: TypePointer Output 35
37(@entryPointOutput): 36(ptr) Variable Output
38: TypePointer Input 9(int)
39(InvocationId): 38(ptr) Variable Input
44: TypePointer Output 13(HS_OUT)
46: 9(int) Constant 2
47: 9(int) Constant 1
48: 9(int) Constant 0
50: TypeBool
4(main): 2 Function None 3
5: Label
31(ip): 12(ptr) Variable Function
37(param): 12(ptr) Variable Function
41(param): 12(ptr) Variable Function
34: 11 Load 33(ip)
Store 31(ip) 34
38: 11 Load 31(ip)
Store 37(param) 38
39: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 37(param)
Store 36(@entryPointOutput) 39
ControlBarrier 40 41 42
45: 9(int) Load 44(InvocationId)
47: 46(bool) IEqual 45 23
SelectionMerge 49 None
BranchConditional 47 48 49
48: Label
50: 2 FunctionCall 18(PCF()
Branch 49
49: Label
40: 9(int) Load 39(InvocationId)
42: 11 Load 31(ip)
Store 41(param) 42
43: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 41(param)
45: 44(ptr) AccessChain 37(@entryPointOutput) 40
Store 45 43
ControlBarrier 46 47 48
49: 9(int) Load 39(InvocationId)
51: 50(bool) IEqual 49 23
SelectionMerge 53 None
BranchConditional 51 52 53
52: Label
54: 2 FunctionCall 18(PCF()
Branch 53
53: Label
Return
FunctionEnd
16(@main(struct-VS_OUT-vf31[3];): 13(HS_OUT) Function None 14