Add basic HS/DS implementation.

This obsoletes WIP PR #704, which was built on the pre entry point wrapping master.  New version
here uses entry point wrapping.

This is a limited implementation of tessellation shaders.  In particular, the following are not functional,
and will be added as separate stages to reduce the size of each PR.

* patchconstantfunctions accepting per-control-point input values, such as
  const OutputPatch <hs_out_t, 3> cpv are not implemented.

* patchconstantfunctions whose signature requires an aggregate input type such as
  a structure containing builtin variables.  Code to synthesize such calls is not
  yet present.

These restrictions will be relaxed as soon as possible.  Simple cases can compile now: see for example
Test/hulsl.hull.1.tesc - e.g, writing to inner and outer tessellation factors.

PCF invocation is synthesized as an entry point epilogue protected behind a barrier and a test on
invocation ID == 0.  If there is an existing invocation ID variable it will be used, otherwise one is
added to the linkage.  The PCF and the shader EP interfaces are unioned and builtins appearing in
the PCF but not the EP are also added to the linkage and synthesized as shader inputs.
Parameter matching to (eventually arbitrary) PCF signatures is by builtin variable type.  Any user
variables in the PCF signature will result in an error.  Overloaded PCF functions will also result in
an error.

[domain()], [partitioning()], [outputtopology()], [outputcontrolpoints()], and [patchconstantfunction()]
attributes to the shader entry point are in place, with the exception of the Pow2 partitioning mode.
This commit is contained in:
steve-lunarg
2017-01-07 08:54:10 -07:00
parent 8e711b84bd
commit 858c928ac7
18 changed files with 1562 additions and 11 deletions

View File

@@ -0,0 +1,359 @@
hlsl.hull.1.tesc
Shader version: 450
vertices = 4
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[4];u1; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:26 'm_cpid' (in uint)
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-element array of structure{temp 3-component vector of float cpoint})
0:26 move second child to first child (temp uint)
0:? 'm_cpid' (temp uint)
0:? 'm_cpid' (in uint InvocationID)
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 Function Call: @main(struct-VS_OUT-vf31[4];u1; (temp structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'm_cpid' (temp uint)
0:? Barrier (temp void)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'm_cpid' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Sequence
0:? move second child to first child (temp structure{temp 2-element array of float edges})
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Function Call: PCF(u1; (temp structure{temp 2-element array of float edges})
0:? 'pid' (in uint PrimitiveID)
0:? Sequence
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:33 Function Definition: PCF(u1; (temp structure{temp 2-element array of float edges})
0:33 Function Parameters:
0:33 'pid' (in uint)
0:? Sequence
0:36 move second child to first child (temp float)
0:36 direct index (temp float)
0:36 edges: direct index for structure (temp 2-element array of float)
0:36 'output' (temp structure{temp 2-element array of float edges})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 2.000000
0:37 move second child to first child (temp float)
0:37 direct index (temp float)
0:37 edges: direct index for structure (temp 2-element array of float)
0:37 'output' (temp structure{temp 2-element array of float edges})
0:37 Constant:
0:37 0 (const int)
0:37 Constant:
0:37 1 (const int)
0:37 Constant:
0:37 8.000000
0:38 Branch: Return with expression
0:38 'output' (temp structure{temp 2-element array of float edges})
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'm_cpid' (in uint InvocationID)
0:? 'pid' (in uint PrimitiveID)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
Linked tessellation control stage:
Shader version: 450
vertices = 4
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[4];u1; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:26 'm_cpid' (in uint)
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-element array of structure{temp 3-component vector of float cpoint})
0:26 move second child to first child (temp uint)
0:? 'm_cpid' (temp uint)
0:? 'm_cpid' (in uint InvocationID)
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 Function Call: @main(struct-VS_OUT-vf31[4];u1; (temp structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'm_cpid' (temp uint)
0:? Barrier (temp void)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'm_cpid' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Sequence
0:? move second child to first child (temp structure{temp 2-element array of float edges})
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Function Call: PCF(u1; (temp structure{temp 2-element array of float edges})
0:? 'pid' (in uint PrimitiveID)
0:? Sequence
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:33 Function Definition: PCF(u1; (temp structure{temp 2-element array of float edges})
0:33 Function Parameters:
0:33 'pid' (in uint)
0:? Sequence
0:36 move second child to first child (temp float)
0:36 direct index (temp float)
0:36 edges: direct index for structure (temp 2-element array of float)
0:36 'output' (temp structure{temp 2-element array of float edges})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 2.000000
0:37 move second child to first child (temp float)
0:37 direct index (temp float)
0:37 edges: direct index for structure (temp 2-element array of float)
0:37 'output' (temp structure{temp 2-element array of float edges})
0:37 Constant:
0:37 0 (const int)
0:37 Constant:
0:37 1 (const int)
0:37 Constant:
0:37 8.000000
0:38 Branch: Return with expression
0:38 'output' (temp structure{temp 2-element array of float edges})
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'm_cpid' (in uint InvocationID)
0:? 'pid' (in uint PrimitiveID)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 85
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 40 44 47 62 67
ExecutionMode 4 OutputVertices 4
Name 4 "main"
Name 8 "VS_OUT"
MemberName 8(VS_OUT) 0 "cpoint"
Name 14 "HS_OUT"
MemberName 14(HS_OUT) 0 "cpoint"
Name 18 "@main(struct-VS_OUT-vf31[4];u1;"
Name 16 "ip"
Name 17 "m_cpid"
Name 22 "HS_CONSTANT_OUT"
MemberName 22(HS_CONSTANT_OUT) 0 "edges"
Name 25 "PCF(u1;"
Name 24 "pid"
Name 28 "output"
Name 38 "ip"
Name 40 "ip"
Name 42 "m_cpid"
Name 44 "m_cpid"
Name 47 "@entryPointOutput"
Name 48 "param"
Name 50 "param"
Name 61 "@patchConstantResult"
Name 62 "pid"
Name 63 "param"
Name 67 "@patchConstantOutput_edges"
Name 77 "output"
Decorate 40(ip) Location 0
Decorate 44(m_cpid) BuiltIn InvocationId
Decorate 47(@entryPointOutput) Location 0
Decorate 62(pid) BuiltIn PrimitiveId
Decorate 67(@patchConstantOutput_edges) BuiltIn TessLevelOuter
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8(VS_OUT): TypeStruct 7(fvec3)
9: TypeInt 32 0
10: 9(int) Constant 4
11: TypeArray 8(VS_OUT) 10
12: TypePointer Function 11
13: TypePointer Function 9(int)
14(HS_OUT): TypeStruct 7(fvec3)
15: TypeFunction 14(HS_OUT) 12(ptr) 13(ptr)
20: 9(int) Constant 2
21: TypeArray 6(float) 20
22(HS_CONSTANT_OUT): TypeStruct 21
23: TypeFunction 22(HS_CONSTANT_OUT) 13(ptr)
27: TypePointer Function 14(HS_OUT)
29: TypeInt 32 1
30: 29(int) Constant 0
31: TypePointer Function 7(fvec3)
39: TypePointer Input 11
40(ip): 39(ptr) Variable Input
43: TypePointer Input 9(int)
44(m_cpid): 43(ptr) Variable Input
46: TypePointer Output 14(HS_OUT)
47(@entryPointOutput): 46(ptr) Variable Output
53: 9(int) Constant 1
54: 9(int) Constant 0
56: TypeBool
60: TypePointer Function 22(HS_CONSTANT_OUT)
62(pid): 43(ptr) Variable Input
66: TypePointer Output 21
67(@patchConstantOutput_edges): 66(ptr) Variable Output
68: TypePointer Function 6(float)
71: TypePointer Output 6(float)
73: 29(int) Constant 1
78: 6(float) Constant 1073741824
80: 6(float) Constant 1090519040
4(main): 2 Function None 3
5: Label
38(ip): 12(ptr) Variable Function
42(m_cpid): 13(ptr) Variable Function
48(param): 12(ptr) Variable Function
50(param): 13(ptr) Variable Function
61(@patchConstantResult): 60(ptr) Variable Function
63(param): 13(ptr) Variable Function
41: 11 Load 40(ip)
Store 38(ip) 41
45: 9(int) Load 44(m_cpid)
Store 42(m_cpid) 45
49: 11 Load 38(ip)
Store 48(param) 49
51: 9(int) Load 42(m_cpid)
Store 50(param) 51
52: 14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 48(param) 50(param)
Store 47(@entryPointOutput) 52
ControlBarrier 20 53 54
55: 9(int) Load 44(m_cpid)
57: 56(bool) IEqual 55 30
SelectionMerge 59 None
BranchConditional 57 58 59
58: Label
64: 9(int) Load 62(pid)
Store 63(param) 64
65:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 63(param)
Store 61(@patchConstantResult) 65
69: 68(ptr) AccessChain 61(@patchConstantResult) 30 30
70: 6(float) Load 69
72: 71(ptr) AccessChain 67(@patchConstantOutput_edges) 30
Store 72 70
74: 68(ptr) AccessChain 61(@patchConstantResult) 30 73
75: 6(float) Load 74
76: 71(ptr) AccessChain 67(@patchConstantOutput_edges) 73
Store 76 75
Branch 59
59: Label
Return
FunctionEnd
18(@main(struct-VS_OUT-vf31[4];u1;): 14(HS_OUT) Function None 15
16(ip): 12(ptr) FunctionParameter
17(m_cpid): 13(ptr) FunctionParameter
19: Label
28(output): 27(ptr) Variable Function
32: 31(ptr) AccessChain 16(ip) 30 30
33: 7(fvec3) Load 32
34: 31(ptr) AccessChain 28(output) 30
Store 34 33
35: 14(HS_OUT) Load 28(output)
ReturnValue 35
FunctionEnd
25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23
24(pid): 13(ptr) FunctionParameter
26: Label
77(output): 60(ptr) Variable Function
79: 68(ptr) AccessChain 77(output) 30 30
Store 79 78
81: 68(ptr) AccessChain 77(output) 30 73
Store 81 80
82:22(HS_CONSTANT_OUT) Load 77(output)
ReturnValue 82
FunctionEnd

View File

@@ -0,0 +1,357 @@
hlsl.hull.2.tesc
Shader version: 450
vertices = 4
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[4]; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-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 Function Call: @main(struct-VS_OUT-vf31[4]; (temp structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? Barrier (temp void)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'InvocationId' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Sequence
0:? move second child to first child (temp structure{temp 2-element array of float edges})
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Function Call: PCF(u1;vf4; (temp structure{temp 2-element array of float edges})
0:? 'pid' (in uint PrimitiveID)
0:? 'pos' (in 4-component vector of float Position)
0:? Sequence
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:33 Function Definition: PCF(u1;vf4; (temp structure{temp 2-element array of float edges})
0:33 Function Parameters:
0:33 'pid' (in uint)
0:33 'pos' (in 4-component vector of float)
0:? Sequence
0:36 move second child to first child (temp float)
0:36 direct index (temp float)
0:36 edges: direct index for structure (temp 2-element array of float)
0:36 'output' (temp structure{temp 2-element array of float edges})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 2.000000
0:37 move second child to first child (temp float)
0:37 direct index (temp float)
0:37 edges: direct index for structure (temp 2-element array of float)
0:37 'output' (temp structure{temp 2-element array of float edges})
0:37 Constant:
0:37 0 (const int)
0:37 Constant:
0:37 1 (const int)
0:37 Constant:
0:37 8.000000
0:38 Branch: Return with expression
0:38 'output' (temp structure{temp 2-element array of float edges})
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'pid' (in uint PrimitiveID)
0:? 'pos' (in 4-component vector of float Position)
0:? 'InvocationId' (in uint InvocationID)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
Linked tessellation control stage:
Shader version: 450
vertices = 4
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[4]; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 4-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-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 Function Call: @main(struct-VS_OUT-vf31[4]; (temp structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 4-element array of structure{temp 3-component vector of float cpoint})
0:? Barrier (temp void)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'InvocationId' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Sequence
0:? move second child to first child (temp structure{temp 2-element array of float edges})
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Function Call: PCF(u1;vf4; (temp structure{temp 2-element array of float edges})
0:? 'pid' (in uint PrimitiveID)
0:? 'pos' (in 4-component vector of float Position)
0:? Sequence
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child (temp float)
0:? direct index (out float TessLevelOuter)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index (temp float)
0:? edges: direct index for structure (temp 2-element array of float)
0:? '@patchConstantResult' (temp structure{temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:33 Function Definition: PCF(u1;vf4; (temp structure{temp 2-element array of float edges})
0:33 Function Parameters:
0:33 'pid' (in uint)
0:33 'pos' (in 4-component vector of float)
0:? Sequence
0:36 move second child to first child (temp float)
0:36 direct index (temp float)
0:36 edges: direct index for structure (temp 2-element array of float)
0:36 'output' (temp structure{temp 2-element array of float edges})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 2.000000
0:37 move second child to first child (temp float)
0:37 direct index (temp float)
0:37 edges: direct index for structure (temp 2-element array of float)
0:37 'output' (temp structure{temp 2-element array of float edges})
0:37 Constant:
0:37 0 (const int)
0:37 Constant:
0:37 1 (const int)
0:37 Constant:
0:37 8.000000
0:38 Branch: Return with expression
0:38 'output' (temp structure{temp 2-element array of float edges})
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 4-element array of structure{temp 3-component vector of float cpoint})
0:? 'pid' (in uint PrimitiveID)
0:? 'pos' (in 4-component vector of float Position)
0:? 'InvocationId' (in uint InvocationID)
0:? '@patchConstantOutput_edges' (out 2-element array of float TessLevelOuter)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 87
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 42 45 52 60 62 69
ExecutionMode 4 OutputVertices 4
Name 4 "main"
Name 8 "VS_OUT"
MemberName 8(VS_OUT) 0 "cpoint"
Name 13 "HS_OUT"
MemberName 13(HS_OUT) 0 "cpoint"
Name 16 "@main(struct-VS_OUT-vf31[4];"
Name 15 "ip"
Name 23 "HS_CONSTANT_OUT"
MemberName 23(HS_CONSTANT_OUT) 0 "edges"
Name 27 "PCF(u1;vf4;"
Name 25 "pid"
Name 26 "pos"
Name 30 "output"
Name 40 "ip"
Name 42 "ip"
Name 45 "@entryPointOutput"
Name 46 "param"
Name 52 "InvocationId"
Name 59 "@patchConstantResult"
Name 60 "pid"
Name 62 "pos"
Name 63 "param"
Name 65 "param"
Name 69 "@patchConstantOutput_edges"
Name 79 "output"
Decorate 42(ip) Location 0
Decorate 45(@entryPointOutput) Location 0
Decorate 52(InvocationId) BuiltIn InvocationId
Decorate 60(pid) BuiltIn PrimitiveId
Decorate 62(pos) BuiltIn Position
Decorate 69(@patchConstantOutput_edges) BuiltIn TessLevelOuter
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8(VS_OUT): TypeStruct 7(fvec3)
9: TypeInt 32 0
10: 9(int) Constant 4
11: TypeArray 8(VS_OUT) 10
12: TypePointer Function 11
13(HS_OUT): TypeStruct 7(fvec3)
14: TypeFunction 13(HS_OUT) 12(ptr)
18: TypePointer Function 9(int)
19: TypeVector 6(float) 4
20: TypePointer Function 19(fvec4)
21: 9(int) Constant 2
22: TypeArray 6(float) 21
23(HS_CONSTANT_OUT): TypeStruct 22
24: TypeFunction 23(HS_CONSTANT_OUT) 18(ptr) 20(ptr)
29: TypePointer Function 13(HS_OUT)
31: TypeInt 32 1
32: 31(int) Constant 0
33: TypePointer Function 7(fvec3)
41: TypePointer Input 11
42(ip): 41(ptr) Variable Input
44: TypePointer Output 13(HS_OUT)
45(@entryPointOutput): 44(ptr) Variable Output
49: 9(int) Constant 1
50: 9(int) Constant 0
51: TypePointer Input 9(int)
52(InvocationId): 51(ptr) Variable Input
54: TypeBool
58: TypePointer Function 23(HS_CONSTANT_OUT)
60(pid): 51(ptr) Variable Input
61: TypePointer Input 19(fvec4)
62(pos): 61(ptr) Variable Input
68: TypePointer Output 22
69(@patchConstantOutput_edges): 68(ptr) Variable Output
70: TypePointer Function 6(float)
73: TypePointer Output 6(float)
75: 31(int) Constant 1
80: 6(float) Constant 1073741824
82: 6(float) Constant 1090519040
4(main): 2 Function None 3
5: Label
40(ip): 12(ptr) Variable Function
46(param): 12(ptr) Variable Function
59(@patchConstantResult): 58(ptr) Variable Function
63(param): 18(ptr) Variable Function
65(param): 20(ptr) Variable Function
43: 11 Load 42(ip)
Store 40(ip) 43
47: 11 Load 40(ip)
Store 46(param) 47
48: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 46(param)
Store 45(@entryPointOutput) 48
ControlBarrier 21 49 50
53: 9(int) Load 52(InvocationId)
55: 54(bool) IEqual 53 32
SelectionMerge 57 None
BranchConditional 55 56 57
56: Label
64: 9(int) Load 60(pid)
Store 63(param) 64
66: 19(fvec4) Load 62(pos)
Store 65(param) 66
67:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 63(param) 65(param)
Store 59(@patchConstantResult) 67
71: 70(ptr) AccessChain 59(@patchConstantResult) 32 32
72: 6(float) Load 71
74: 73(ptr) AccessChain 69(@patchConstantOutput_edges) 32
Store 74 72
76: 70(ptr) AccessChain 59(@patchConstantResult) 32 75
77: 6(float) Load 76
78: 73(ptr) AccessChain 69(@patchConstantOutput_edges) 75
Store 78 77
Branch 57
57: Label
Return
FunctionEnd
16(@main(struct-VS_OUT-vf31[4];): 13(HS_OUT) Function None 14
15(ip): 12(ptr) FunctionParameter
17: Label
30(output): 29(ptr) Variable Function
34: 33(ptr) AccessChain 15(ip) 32 32
35: 7(fvec3) Load 34
36: 33(ptr) AccessChain 30(output) 32
Store 36 35
37: 13(HS_OUT) Load 30(output)
ReturnValue 37
FunctionEnd
27(PCF(u1;vf4;):23(HS_CONSTANT_OUT) Function None 24
25(pid): 18(ptr) FunctionParameter
26(pos): 20(ptr) FunctionParameter
28: Label
79(output): 58(ptr) Variable Function
81: 70(ptr) AccessChain 79(output) 32 32
Store 81 80
83: 70(ptr) AccessChain 79(output) 32 75
Store 83 82
84:23(HS_CONSTANT_OUT) Load 79(output)
ReturnValue 84
FunctionEnd

View File

@@ -0,0 +1,186 @@
hlsl.hull.void.tesc
Shader version: 450
vertices = 3
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[3]; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 3-element array of structure{temp 3-component vector of float cpoint})
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 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)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'InvocationId' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Function Call: PCF( (temp void)
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:? 'ip' (layout(location=0 ) in 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'InvocationId' (in uint InvocationID)
Linked tessellation control stage:
Shader version: 450
vertices = 3
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[3]; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 3-element array of structure{temp 3-component vector of float cpoint})
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 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)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'InvocationId' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Function Call: PCF( (temp void)
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:? '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
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 33 36 44
ExecutionMode 4 OutputVertices 3
Name 4 "main"
Name 8 "VS_OUT"
MemberName 8(VS_OUT) 0 "cpoint"
Name 13 "HS_OUT"
MemberName 13(HS_OUT) 0 "cpoint"
Name 16 "@main(struct-VS_OUT-vf31[3];"
Name 15 "ip"
Name 18 "PCF("
Name 21 "output"
Name 31 "ip"
Name 33 "ip"
Name 36 "@entryPointOutput"
Name 37 "param"
Name 44 "InvocationId"
Decorate 33(ip) Location 0
Decorate 36(@entryPointOutput) Location 0
Decorate 44(InvocationId) BuiltIn InvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8(VS_OUT): TypeStruct 7(fvec3)
9: TypeInt 32 0
10: 9(int) Constant 3
11: TypeArray 8(VS_OUT) 10
12: TypePointer Function 11
13(HS_OUT): TypeStruct 7(fvec3)
14: TypeFunction 13(HS_OUT) 12(ptr)
20: TypePointer Function 13(HS_OUT)
22: TypeInt 32 1
23: 22(int) Constant 0
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
4(main): 2 Function None 3
5: Label
31(ip): 12(ptr) Variable Function
37(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
Return
FunctionEnd
16(@main(struct-VS_OUT-vf31[3];): 13(HS_OUT) Function None 14
15(ip): 12(ptr) FunctionParameter
17: Label
21(output): 20(ptr) Variable Function
25: 24(ptr) AccessChain 15(ip) 23 23
26: 7(fvec3) Load 25
27: 24(ptr) AccessChain 21(output) 23
Store 27 26
28: 13(HS_OUT) Load 21(output)
ReturnValue 28
FunctionEnd
18(PCF(): 2 Function None 3
19: Label
Return
FunctionEnd

39
Test/hlsl.hull.1.tesc Normal file
View File

@@ -0,0 +1,39 @@
// ***
// invocation ID coming from input to entry point
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("isoline")]
[partitioning("integer")]
[outputtopology("line")]
[outputcontrolpoints(4)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 4> ip, uint m_cpid : SV_OutputControlPointID)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
HS_CONSTANT_OUT PCF(uint pid : SV_PrimitiveId)
{
HS_CONSTANT_OUT output;
output.edges[0] = 2.0f;
output.edges[1] = 8.0f;
return output;
}

39
Test/hlsl.hull.2.tesc Normal file
View File

@@ -0,0 +1,39 @@
// ***
// invocation ID coming from synthesized variable
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("isoline")]
[partitioning("integer")]
[outputtopology("line")]
[outputcontrolpoints(4)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 4> ip)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
HS_CONSTANT_OUT PCF(uint pid : SV_PrimitiveId, float4 pos : SV_Position)
{
HS_CONSTANT_OUT output;
output.edges[0] = 2.0f;
output.edges[1] = 8.0f;
return output;
}

34
Test/hlsl.hull.void.tesc Normal file
View File

@@ -0,0 +1,34 @@
// ***
// void patchconstantfunction input and return
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("tri")]
[partitioning("fractional_even")]
[outputtopology("line")]
[outputcontrolpoints(3)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 3> ip)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
void PCF()
{
}