HLSL: support per control point patch const fn invocation
This PR emulates per control point inputs to patch constant functions. Without either an extension to look across SIMD lanes or a dedicated stage, the emulation must use separate invocations of the wrapped entry point to obtain the per control point values. This is provided since shaders are wanting this functionality now, but such an extension is not yet available. Entry point arguments qualified as an invocation ID are replaced by the current control point number when calling the wrapped entry point. There is no particular optimization for the case of the entry point not having such an input but the PCF still accepting ctrl pt frequency data. It'll work, but anyway makes no so much sense. The wrapped entry point must return the per control point data by value. At this time it is not supported as an output parameter.
This commit is contained in:
parent
e434ad923e
commit
9cee73e028
7 changed files with 815 additions and 68 deletions
|
|
@ -46,8 +46,8 @@ vertices = 4
|
|||
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:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -58,8 +58,8 @@ vertices = 4
|
|||
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:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -102,7 +102,8 @@ vertices = 4
|
|||
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)
|
||||
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
|
||||
|
||||
Linked tessellation control stage:
|
||||
|
|
@ -155,8 +156,8 @@ vertices = 4
|
|||
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:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -167,8 +168,8 @@ vertices = 4
|
|||
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:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -211,16 +212,17 @@ vertices = 4
|
|||
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)
|
||||
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 87
|
||||
// Id's are bound by 90
|
||||
|
||||
Capability Tessellation
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 4 "main" 42 45 52 60 62 69
|
||||
EntryPoint TessellationControl 4 "main" 42 45 52 60 62 69 89
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Name 4 "main"
|
||||
Name 8 "VS_OUT"
|
||||
|
|
@ -247,12 +249,17 @@ vertices = 4
|
|||
Name 65 "param"
|
||||
Name 69 "@patchConstantOutput_edges"
|
||||
Name 79 "output"
|
||||
Name 87 "HS_CONSTANT_OUT"
|
||||
Name 89 "@patchConstantOutput"
|
||||
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) Patch
|
||||
Decorate 69(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 89(@patchConstantOutput) Patch
|
||||
Decorate 89(@patchConstantOutput) Location 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
|
|
@ -295,6 +302,9 @@ vertices = 4
|
|||
75: 31(int) Constant 1
|
||||
80: 6(float) Constant 1073741824
|
||||
82: 6(float) Constant 1090519040
|
||||
87(HS_CONSTANT_OUT): TypeStruct
|
||||
88: TypePointer Output 87(HS_CONSTANT_OUT)
|
||||
89(@patchConstantOutput): 88(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
40(ip): 12(ptr) Variable Function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue