HLSL: handle split InputPatch templat type in patch constant functions

InputPatch parameters to patch constant functions were not using the
internal (temporary) variable type.  That could cause validation errors
if the input patch had a mixture of builtins and user qualified members.

This uses the entry point's internal form.

There is currently a limitation: if an InputPatch is used in a PCF,
it must also have appeared in the main entry point's parameter list.
That is not a limitation of HLSL.  Currently that situation is detected
and an "implemented" error results.  The limitation can be addressed,
but isn't yet in the current form of the PR.
This commit is contained in:
LoopDawg 2017-09-13 08:44:39 -06:00
parent a5d8616478
commit 4a145dbf45
8 changed files with 961 additions and 239 deletions

View File

@ -1,78 +1,240 @@
hlsl.hull.4.tesc
Shader version: 500
vertices = 3
vertex spacing = fractional_odd_spacing
triangle order = cw
0:? Sequence
0:14 Function Definition: @main( ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Function Parameters:
0:25 Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:25 Function Parameters:
0:25 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? Sequence
0:15 Sequence
0:15 move second child to first child ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:15 'output' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:15 Constant:
0:15 0.000000
0:15 0.000000
0:15 0.000000
0:15 0.000000
0:16 Branch: Return with expression
0:16 'output' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Function Definition: main( ( temp void)
0:14 Function Parameters:
0:26 Sequence
0:26 move second child to first child ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 Constant:
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:28 move second child to first child ( temp float)
0:28 fInsideTessFactor: direct index for structure ( temp float)
0:28 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:28 Constant:
0:28 1 (const int)
0:28 add ( temp float)
0:28 direct index ( temp float)
0:28 m_Position: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 3 (const int)
0:28 direct index ( temp float)
0:28 m_Normal: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 1 (const int)
0:28 Constant:
0:28 3 (const int)
0:30 Branch: Return with expression
0:30 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:39 Function Definition: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Parameters:
0:39 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 'cpid' ( in uint)
0:? Sequence
0:14 Sequence
0:14 move second child to first child ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Function Call: @main( ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 move second child to first child ( temp float)
0:14 direct index ( patch out float TessLevelOuter)
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:14 Constant:
0:14 0 (const int)
0:14 direct index ( temp float)
0:14 tessFactor: direct index for structure ( temp 3-element array of float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 0 (const int)
0:14 move second child to first child ( temp float)
0:14 direct index ( patch out float TessLevelOuter)
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:14 Constant:
0:14 1 (const int)
0:14 direct index ( temp float)
0:14 tessFactor: direct index for structure ( temp 3-element array of float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 1 (const int)
0:14 move second child to first child ( temp float)
0:14 direct index ( patch out float TessLevelOuter)
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:14 Constant:
0:14 2 (const int)
0:14 direct index ( temp float)
0:14 tessFactor: direct index for structure ( temp 3-element array of float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 2 (const int)
0:14 move second child to first child ( temp float)
0:14 coord: direct index for structure ( temp float)
0:14 indirect index (layout( location=0) out structure{ temp float coord})
0:14 '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp float coord})
0:? 'InvocationId' ( in uint InvocationID)
0:14 Constant:
0:14 0 (const int)
0:14 coord: direct index for structure ( temp float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 1 (const int)
0:40 Sequence
0:40 move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
0:40 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:40 Constant:
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:41 move second child to first child ( temp 4-component vector of float)
0:41 m_Position: direct index for structure ( temp 4-component vector of float)
0:41 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:41 Constant:
0:41 0 (const int)
0:41 Constant:
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:42 Branch: Return with expression
0:42 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Definition: main( ( temp void)
0:39 Function Parameters:
0:? Sequence
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 0 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 direct index ( in 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 0 (const int)
0:39 Constant:
0:39 1 (const int)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
0:39 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 0 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 1 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 direct index ( in 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 1 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 1 (const int)
0:39 Constant:
0:39 1 (const int)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
0:39 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 1 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 2 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 direct index ( in 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 2 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 2 (const int)
0:39 Constant:
0:39 1 (const int)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
0:39 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 2 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp uint)
0:? 'cpid' ( temp uint)
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'cpid' ( temp uint)
0:39 Constant:
0:39 0 (const int)
0:? Barrier ( temp void)
0:? Test condition and select ( temp void)
0:? Condition
0:? Compare Equal ( temp bool)
0:? '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 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Function Call: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? Sequence
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index ( temp float)
0:? fTessFactor: direct index for structure ( temp 3-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index ( temp float)
0:? fTessFactor: direct index for structure ( temp 3-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 2 (const int)
0:? direct index ( temp float)
0:? fTessFactor: direct index for structure ( temp 3-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 2 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelInner)
0:? '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
0:? Constant:
0:? 0 (const int)
0:? fInsideTessFactor: direct index for structure ( temp float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 1 (const int)
0:? Linker Objects
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp float coord})
0:? 'InvocationId' ( in uint InvocationID)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:? 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:? 'cpid' ( in uint InvocationID)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
Linked tessellation control stage:
@ -80,162 +242,440 @@ Linked tessellation control stage:
Shader version: 500
vertices = 3
vertex spacing = fractional_odd_spacing
triangle order = cw
0:? Sequence
0:14 Function Definition: @main( ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Function Parameters:
0:25 Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:25 Function Parameters:
0:25 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? Sequence
0:15 Sequence
0:15 move second child to first child ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:15 'output' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:15 Constant:
0:15 0.000000
0:15 0.000000
0:15 0.000000
0:15 0.000000
0:16 Branch: Return with expression
0:16 'output' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Function Definition: main( ( temp void)
0:14 Function Parameters:
0:26 Sequence
0:26 move second child to first child ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 Constant:
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:28 move second child to first child ( temp float)
0:28 fInsideTessFactor: direct index for structure ( temp float)
0:28 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:28 Constant:
0:28 1 (const int)
0:28 add ( temp float)
0:28 direct index ( temp float)
0:28 m_Position: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 3 (const int)
0:28 direct index ( temp float)
0:28 m_Normal: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 1 (const int)
0:28 Constant:
0:28 3 (const int)
0:30 Branch: Return with expression
0:30 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:39 Function Definition: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Parameters:
0:39 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 'cpid' ( in uint)
0:? Sequence
0:14 Sequence
0:14 move second child to first child ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Function Call: @main( ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 move second child to first child ( temp float)
0:14 direct index ( patch out float TessLevelOuter)
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:14 Constant:
0:14 0 (const int)
0:14 direct index ( temp float)
0:14 tessFactor: direct index for structure ( temp 3-element array of float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 0 (const int)
0:14 move second child to first child ( temp float)
0:14 direct index ( patch out float TessLevelOuter)
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:14 Constant:
0:14 1 (const int)
0:14 direct index ( temp float)
0:14 tessFactor: direct index for structure ( temp 3-element array of float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 1 (const int)
0:14 move second child to first child ( temp float)
0:14 direct index ( patch out float TessLevelOuter)
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:14 Constant:
0:14 2 (const int)
0:14 direct index ( temp float)
0:14 tessFactor: direct index for structure ( temp 3-element array of float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 2 (const int)
0:14 move second child to first child ( temp float)
0:14 coord: direct index for structure ( temp float)
0:14 indirect index (layout( location=0) out structure{ temp float coord})
0:14 '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp float coord})
0:? 'InvocationId' ( in uint InvocationID)
0:14 Constant:
0:14 0 (const int)
0:14 coord: direct index for structure ( temp float)
0:14 'flattenTemp' ( temp structure{ temp 3-element array of float tessFactor, temp float coord})
0:14 Constant:
0:14 1 (const int)
0:40 Sequence
0:40 move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
0:40 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:40 Constant:
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:41 move second child to first child ( temp 4-component vector of float)
0:41 m_Position: direct index for structure ( temp 4-component vector of float)
0:41 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:41 Constant:
0:41 0 (const int)
0:41 Constant:
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:42 Branch: Return with expression
0:42 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Definition: main( ( temp void)
0:39 Function Parameters:
0:? Sequence
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 0 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 direct index ( in 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 0 (const int)
0:39 Constant:
0:39 1 (const int)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
0:39 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 0 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 1 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 direct index ( in 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 1 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 1 (const int)
0:39 Constant:
0:39 1 (const int)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
0:39 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 1 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 2 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 direct index ( in 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 2 (const int)
0:39 move second child to first child ( temp 4-component vector of float)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 2 (const int)
0:39 Constant:
0:39 1 (const int)
0:39 m_Normal: direct index for structure ( temp 4-component vector of float)
0:39 direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
0:39 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:39 Constant:
0:39 2 (const int)
0:39 Constant:
0:39 0 (const int)
0:39 move second child to first child ( temp uint)
0:? 'cpid' ( temp uint)
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? 'cpid' ( temp uint)
0:39 Constant:
0:39 0 (const int)
0:? Barrier ( temp void)
0:? Test condition and select ( temp void)
0:? Condition
0:? Compare Equal ( temp bool)
0:? '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 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Function Call: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? Sequence
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index ( temp float)
0:? fTessFactor: direct index for structure ( temp 3-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index ( temp float)
0:? fTessFactor: direct index for structure ( temp 3-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 2 (const int)
0:? direct index ( temp float)
0:? fTessFactor: direct index for structure ( temp 3-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 2 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelInner)
0:? '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
0:? Constant:
0:? 0 (const int)
0:? fInsideTessFactor: direct index for structure ( temp float)
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:? Constant:
0:? 1 (const int)
0:? Linker Objects
0:? '@entryPointOutput.tessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp float coord})
0:? 'InvocationId' ( in uint InvocationID)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:? 'I.m_Position' ( in 3-element array of 4-component vector of float Position)
0:? 'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
0:? 'cpid' ( in uint InvocationID)
0:? '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
0:? '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 53
// Id's are bound by 127
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 27 46 48
EntryPoint TessellationControl 4 "main" 56 64 83 86 110 123
ExecutionMode 4 OutputVertices 3
ExecutionMode 4 Triangles
ExecutionMode 4 SpacingFractionalOdd
ExecutionMode 4 VertexOrderCw
Source HLSL 500
Name 4 "main"
Name 10 "HS_Output"
MemberName 10(HS_Output) 0 "tessFactor"
MemberName 10(HS_Output) 1 "coord"
Name 12 "@main("
Name 15 "output"
Name 22 "flattenTemp"
Name 27 "@entryPointOutput.tessFactor"
Name 43 "HS_Output"
MemberName 43(HS_Output) 0 "coord"
Name 46 "@entryPointOutput"
Name 48 "InvocationId"
Decorate 27(@entryPointOutput.tessFactor) Patch
Decorate 27(@entryPointOutput.tessFactor) BuiltIn TessLevelOuter
Decorate 46(@entryPointOutput) Location 0
Decorate 48(InvocationId) BuiltIn InvocationId
Name 8 "HS_Input"
MemberName 8(HS_Input) 0 "m_Position"
MemberName 8(HS_Input) 1 "m_Normal"
Name 14 "HS_Output"
MemberName 14(HS_Output) 0 "fTessFactor"
MemberName 14(HS_Output) 1 "fInsideTessFactor"
Name 17 "HS_ConstFunc(struct-HS_Input-vf4-vf41[3];"
Name 16 "I"
Name 20 "HS_Main_Output"
MemberName 20(HS_Main_Output) 0 "m_Position"
Name 24 "@main(struct-HS_Input-vf4-vf41[3];u1;"
Name 22 "I"
Name 23 "cpid"
Name 27 "O"
Name 45 "output"
Name 53 "I"
Name 56 "I.m_Position"
Name 61 "HS_Input"
MemberName 61(HS_Input) 0 "m_Normal"
Name 64 "I"
Name 81 "cpid"
Name 83 "cpid"
Name 86 "@entryPointOutput.m_Position"
Name 87 "param"
Name 89 "param"
Name 103 "@patchConstantResult"
Name 104 "param"
Name 110 "@patchConstantOutput.fTessFactor"
Name 123 "@patchConstantOutput.fInsideTessFactor"
Decorate 56(I.m_Position) BuiltIn Position
Decorate 64(I) Location 0
Decorate 83(cpid) BuiltIn InvocationId
Decorate 86(@entryPointOutput.m_Position) BuiltIn Position
Decorate 110(@patchConstantOutput.fTessFactor) Patch
Decorate 110(@patchConstantOutput.fTessFactor) BuiltIn TessLevelOuter
Decorate 123(@patchConstantOutput.fInsideTessFactor) Patch
Decorate 123(@patchConstantOutput.fInsideTessFactor) BuiltIn TessLevelInner
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 0
8: 7(int) Constant 3
9: TypeArray 6(float) 8
10(HS_Output): TypeStruct 9 6(float)
11: TypeFunction 10(HS_Output)
14: TypePointer Function 10(HS_Output)
16: 6(float) Constant 0
17: 9 ConstantComposite 16 16 16
18:10(HS_Output) ConstantComposite 17 16
24: 7(int) Constant 4
25: TypeArray 6(float) 24
26: TypePointer Output 25
27(@entryPointOutput.tessFactor): 26(ptr) Variable Output
28: TypeInt 32 1
29: 28(int) Constant 0
30: TypePointer Function 6(float)
33: TypePointer Output 6(float)
35: 28(int) Constant 1
39: 28(int) Constant 2
43(HS_Output): TypeStruct 6(float)
44: TypeArray 43(HS_Output) 8
45: TypePointer Output 44
46(@entryPointOutput): 45(ptr) Variable Output
47: TypePointer Input 7(int)
48(InvocationId): 47(ptr) Variable Input
7: TypeVector 6(float) 4
8(HS_Input): TypeStruct 7(fvec4) 7(fvec4)
9: TypeInt 32 0
10: 9(int) Constant 3
11: TypeArray 8(HS_Input) 10
12: TypePointer Function 11
13: TypeArray 6(float) 10
14(HS_Output): TypeStruct 13 6(float)
15: TypeFunction 14(HS_Output) 12(ptr)
19: TypePointer Function 9(int)
20(HS_Main_Output): TypeStruct 7(fvec4)
21: TypeFunction 20(HS_Main_Output) 12(ptr) 19(ptr)
26: TypePointer Function 14(HS_Output)
28: 6(float) Constant 0
29: 13 ConstantComposite 28 28 28
30:14(HS_Output) ConstantComposite 29 28
31: TypeInt 32 1
32: 31(int) Constant 1
33: 31(int) Constant 0
34: TypePointer Function 6(float)
44: TypePointer Function 20(HS_Main_Output)
46: 7(fvec4) ConstantComposite 28 28 28 28
47:20(HS_Main_Output) ConstantComposite 46
48: TypePointer Function 7(fvec4)
54: TypeArray 7(fvec4) 10
55: TypePointer Input 54
56(I.m_Position): 55(ptr) Variable Input
57: TypePointer Input 7(fvec4)
61(HS_Input): TypeStruct 7(fvec4)
62: TypeArray 61(HS_Input) 10
63: TypePointer Input 62
64(I): 63(ptr) Variable Input
74: 31(int) Constant 2
82: TypePointer Input 9(int)
83(cpid): 82(ptr) Variable Input
85: TypePointer Output 54
86(@entryPointOutput.m_Position): 85(ptr) Variable Output
93: TypePointer Output 7(fvec4)
95: 9(int) Constant 2
96: 9(int) Constant 1
97: 9(int) Constant 0
99: TypeBool
107: 9(int) Constant 4
108: TypeArray 6(float) 107
109: TypePointer Output 108
110(@patchConstantOutput.fTessFactor): 109(ptr) Variable Output
113: TypePointer Output 6(float)
121: TypeArray 6(float) 95
122: TypePointer Output 121
123(@patchConstantOutput.fInsideTessFactor): 122(ptr) Variable Output
4(main): 2 Function None 3
5: Label
22(flattenTemp): 14(ptr) Variable Function
23:10(HS_Output) FunctionCall 12(@main()
Store 22(flattenTemp) 23
31: 30(ptr) AccessChain 22(flattenTemp) 29 29
32: 6(float) Load 31
34: 33(ptr) AccessChain 27(@entryPointOutput.tessFactor) 29
Store 34 32
36: 30(ptr) AccessChain 22(flattenTemp) 29 35
37: 6(float) Load 36
38: 33(ptr) AccessChain 27(@entryPointOutput.tessFactor) 35
Store 38 37
40: 30(ptr) AccessChain 22(flattenTemp) 29 39
41: 6(float) Load 40
42: 33(ptr) AccessChain 27(@entryPointOutput.tessFactor) 39
Store 42 41
49: 7(int) Load 48(InvocationId)
50: 30(ptr) AccessChain 22(flattenTemp) 35
51: 6(float) Load 50
52: 33(ptr) AccessChain 46(@entryPointOutput) 49 29
Store 52 51
53(I): 12(ptr) Variable Function
81(cpid): 19(ptr) Variable Function
87(param): 12(ptr) Variable Function
89(param): 19(ptr) Variable Function
103(@patchConstantResult): 26(ptr) Variable Function
104(param): 12(ptr) Variable Function
58: 57(ptr) AccessChain 56(I.m_Position) 33
59: 7(fvec4) Load 58
60: 48(ptr) AccessChain 53(I) 33 33
Store 60 59
65: 57(ptr) AccessChain 64(I) 33 33
66: 7(fvec4) Load 65
67: 48(ptr) AccessChain 53(I) 33 32
Store 67 66
68: 57(ptr) AccessChain 56(I.m_Position) 32
69: 7(fvec4) Load 68
70: 48(ptr) AccessChain 53(I) 32 33
Store 70 69
71: 57(ptr) AccessChain 64(I) 32 33
72: 7(fvec4) Load 71
73: 48(ptr) AccessChain 53(I) 32 32
Store 73 72
75: 57(ptr) AccessChain 56(I.m_Position) 74
76: 7(fvec4) Load 75
77: 48(ptr) AccessChain 53(I) 74 33
Store 77 76
78: 57(ptr) AccessChain 64(I) 74 33
79: 7(fvec4) Load 78
80: 48(ptr) AccessChain 53(I) 74 32
Store 80 79
84: 9(int) Load 83(cpid)
Store 81(cpid) 84
88: 11 Load 53(I)
Store 87(param) 88
90: 9(int) Load 81(cpid)
Store 89(param) 90
91:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 87(param) 89(param)
92: 7(fvec4) CompositeExtract 91 0
94: 93(ptr) AccessChain 86(@entryPointOutput.m_Position) 33
Store 94 92
ControlBarrier 95 96 97
98: 9(int) Load 83(cpid)
100: 99(bool) IEqual 98 33
SelectionMerge 102 None
BranchConditional 100 101 102
101: Label
105: 11 Load 53(I)
Store 104(param) 105
106:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 104(param)
Store 103(@patchConstantResult) 106
111: 34(ptr) AccessChain 103(@patchConstantResult) 33 33
112: 6(float) Load 111
114: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 33
Store 114 112
115: 34(ptr) AccessChain 103(@patchConstantResult) 33 32
116: 6(float) Load 115
117: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 32
Store 117 116
118: 34(ptr) AccessChain 103(@patchConstantResult) 33 74
119: 6(float) Load 118
120: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 74
Store 120 119
124: 34(ptr) AccessChain 103(@patchConstantResult) 32
125: 6(float) Load 124
126: 113(ptr) AccessChain 123(@patchConstantOutput.fInsideTessFactor) 33
Store 126 125
Branch 102
102: Label
Return
FunctionEnd
12(@main():10(HS_Output) Function None 11
13: Label
15(output): 14(ptr) Variable Function
Store 15(output) 18
19:10(HS_Output) Load 15(output)
ReturnValue 19
17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];):14(HS_Output) Function None 15
16(I): 12(ptr) FunctionParameter
18: Label
27(O): 26(ptr) Variable Function
Store 27(O) 30
35: 34(ptr) AccessChain 16(I) 33 33 10
36: 6(float) Load 35
37: 34(ptr) AccessChain 16(I) 33 32 10
38: 6(float) Load 37
39: 6(float) FAdd 36 38
40: 34(ptr) AccessChain 27(O) 32
Store 40 39
41:14(HS_Output) Load 27(O)
ReturnValue 41
FunctionEnd
24(@main(struct-HS_Input-vf4-vf41[3];u1;):20(HS_Main_Output) Function None 21
22(I): 12(ptr) FunctionParameter
23(cpid): 19(ptr) FunctionParameter
25: Label
45(output): 44(ptr) Variable Function
Store 45(output) 47
49: 48(ptr) AccessChain 45(output) 33
Store 49 46
50:20(HS_Main_Output) Load 45(output)
ReturnValue 50
FunctionEnd

View File

@ -0,0 +1,190 @@
hlsl.hull.5.tesc
ERROR: 0:0: '' : unimplemented: PCF input patch without entry point input patch parameter
ERROR: 1 compilation errors. No code generated.
Shader version: 500
vertices = 3
vertex spacing = fractional_odd_spacing
triangle order = cw
ERROR: node is still EOpNull!
0:25 Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:25 Function Parameters:
0:25 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? Sequence
0:26 Sequence
0:26 move second child to first child ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 Constant:
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:28 move second child to first child ( temp float)
0:28 fInsideTessFactor: direct index for structure ( temp float)
0:28 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:28 Constant:
0:28 1 (const int)
0:28 add ( temp float)
0:28 direct index ( temp float)
0:28 m_Position: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 3 (const int)
0:28 direct index ( temp float)
0:28 m_Normal: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 1 (const int)
0:28 Constant:
0:28 3 (const int)
0:30 Branch: Return with expression
0:30 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:39 Function Definition: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Parameters:
0:39 'cpid' ( in uint)
0:? Sequence
0:40 Sequence
0:40 move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
0:40 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:40 Constant:
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:41 move second child to first child ( temp 4-component vector of float)
0:41 m_Position: direct index for structure ( temp 4-component vector of float)
0:41 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:41 Constant:
0:41 0 (const int)
0:41 Constant:
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:42 Branch: Return with expression
0:42 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Definition: main( ( temp void)
0:39 Function Parameters:
0:? Sequence
0:39 move second child to first child ( temp uint)
0:? 'cpid' ( temp uint)
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'cpid' ( temp uint)
0:39 Constant:
0:39 0 (const int)
0:? Linker Objects
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:? 'cpid' ( in uint InvocationID)
Linked tessellation control stage:
Shader version: 500
vertices = 3
vertex spacing = fractional_odd_spacing
triangle order = cw
ERROR: node is still EOpNull!
0:25 Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:25 Function Parameters:
0:25 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:? Sequence
0:26 Sequence
0:26 move second child to first child ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:26 Constant:
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:26 0.000000
0:28 move second child to first child ( temp float)
0:28 fInsideTessFactor: direct index for structure ( temp float)
0:28 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:28 Constant:
0:28 1 (const int)
0:28 add ( temp float)
0:28 direct index ( temp float)
0:28 m_Position: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 3 (const int)
0:28 direct index ( temp float)
0:28 m_Normal: direct index for structure ( temp 4-component vector of float)
0:28 direct index ( temp structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 1 (const int)
0:28 Constant:
0:28 3 (const int)
0:30 Branch: Return with expression
0:30 'O' ( temp structure{ temp 3-element array of float fTessFactor, temp float fInsideTessFactor})
0:39 Function Definition: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Parameters:
0:39 'cpid' ( in uint)
0:? Sequence
0:40 Sequence
0:40 move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
0:40 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:40 Constant:
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:40 0.000000
0:41 move second child to first child ( temp 4-component vector of float)
0:41 m_Position: direct index for structure ( temp 4-component vector of float)
0:41 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:41 Constant:
0:41 0 (const int)
0:41 Constant:
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:41 0.000000
0:42 Branch: Return with expression
0:42 'output' ( temp structure{ temp 4-component vector of float m_Position})
0:39 Function Definition: main( ( temp void)
0:39 Function Parameters:
0:? Sequence
0:39 move second child to first child ( temp uint)
0:? 'cpid' ( temp uint)
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'cpid' ( temp uint)
0:39 Constant:
0:39 0 (const int)
0:? Linker Objects
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:? 'cpid' ( in uint InvocationID)
SPIR-V is not generated for failed compile or link

View File

@ -82,7 +82,7 @@ triangle order = cw
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor})
0:? Function Call: PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor})
0:? 'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
0:? 'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
0:? 'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
0:? Sequence
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
@ -291,7 +291,7 @@ triangle order = cw
0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor})
0:? Function Call: PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor})
0:? 'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
0:? 'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
0:? 'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
0:? Sequence
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
@ -568,7 +568,7 @@ triangle order = cw
87: 30(ptr) AccessChain 67(pcf_out) 81
Store 87 86
90: 20 Load 67(pcf_out)
91: 11 Load 42(i)
91: 11 Load 40(i)
92:22(hs_pcf_t) FunctionCall 26(PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3];) 90 91
Store 89(@patchConstantResult) 92
98: 97(ptr) AccessChain 89(@patchConstantResult) 29 29

View File

@ -1,17 +1,43 @@
// Test mixed output structure: user and builtin members. Hull shaders involve extra
// logic in this case, over and above e.g. pixel or vertex stages, which is related to
// the implicit array dimension.
struct HS_Output
{
float tessFactor[3] : SV_TessFactor;
float coord : TEXCOORD0;
};
// Test mixed InputPatch structure: user and builtin members. Hull shaders involve extra
// logic in this case due to patch constant function call synthesis.
[domain("tri")]
[outputcontrolpoints(3)]
HS_Output main ( )
// This example tests the main EP and the PCF EP both having an input patch.
struct HS_Main_Output
{
HS_Output output = (HS_Output)0;
return output;
float4 m_Position : SV_POSITION ;
};
struct HS_Output
{
float fTessFactor [ 3 ] : SV_TessFactor ;
float fInsideTessFactor : SV_InsideTessFactor ;
};
struct HS_Input
{
float4 m_Position : SV_POSITION;
float4 m_Normal : TEXCOORD2;
};
HS_Output HS_ConstFunc ( InputPatch < HS_Input , 3 > I )
{
HS_Output O = (HS_Output)0;
O.fInsideTessFactor = I [ 0 ].m_Position.w + I [ 0 ].m_Normal.w;
return O;
}
[ domain ( "tri" ) ]
[ partitioning ( "fractional_odd" ) ]
[ outputtopology ( "triangle_cw" ) ]
[ patchconstantfunc ( "HS_ConstFunc" ) ]
[ outputcontrolpoints ( 3 ) ]
HS_Main_Output main( InputPatch < HS_Input , 3 > I , uint cpid : SV_OutputControlPointID )
{
HS_Main_Output output = ( HS_Main_Output ) 0 ;
output.m_Position = 0;
return output ;
}

43
Test/hlsl.hull.5.tesc Normal file
View File

@ -0,0 +1,43 @@
// Test mixed InputPatch structure: user and builtin members. Hull shaders involve extra
// logic in this case due to patch constant function call synthesis.
// This example tests the PCF EP having an InputPatch, but the main EP does not.
struct HS_Main_Output
{
float4 m_Position : SV_POSITION ;
};
struct HS_Output
{
float fTessFactor [ 3 ] : SV_TessFactor ;
float fInsideTessFactor : SV_InsideTessFactor ;
};
struct HS_Input
{
float4 m_Position : SV_POSITION;
float4 m_Normal : TEXCOORD2;
};
HS_Output HS_ConstFunc ( InputPatch < HS_Input , 3 > I )
{
HS_Output O = (HS_Output)0;
O.fInsideTessFactor = I [ 0 ].m_Position.w + I [ 0 ].m_Normal.w;
return O;
}
[ domain ( "tri" ) ]
[ partitioning ( "fractional_odd" ) ]
[ outputtopology ( "triangle_cw" ) ]
[ patchconstantfunc ( "HS_ConstFunc" ) ]
[ outputcontrolpoints ( 3 ) ]
HS_Main_Output main( uint cpid : SV_OutputControlPointID )
{
HS_Main_Output output = ( HS_Main_Output ) 0 ;
output.m_Position = 0;
return output ;
}

View File

@ -165,6 +165,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.hull.2.tesc", "main"},
{"hlsl.hull.3.tesc", "main"},
{"hlsl.hull.4.tesc", "main"},
{"hlsl.hull.5.tesc", "main"},
{"hlsl.hull.void.tesc", "main"},
{"hlsl.hull.ctrlpt-1.tesc", "main"},
{"hlsl.hull.ctrlpt-2.tesc", "main"},

View File

@ -1999,6 +1999,11 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
TParameter& param = userFunction[i];
argVars.push_back(makeInternalVariable(*param.name, *param.type));
argVars.back()->getWritableType().getQualifier().makeTemporary();
// Track the input patch, which is the only non-builtin supported by hull shader PCF.
if (param.getDeclaredBuiltIn() == EbvInputPatch)
inputPatch = argVars.back();
TIntermSymbol* arg = intermediate.addSymbol(*argVars.back());
handleFunctionArgument(&callee, callingArgs, arg);
if (param.type->getQualifier().isParamInput()) {
@ -2218,9 +2223,6 @@ void HlslParseContext::remapEntryPointIO(TFunction& function, TVariable*& return
synthesizeEditedInput(paramType);
TVariable* argAsGlobal = makeIoVariable(function[i].name->c_str(), paramType, EvqVaryingIn);
inputs.push_back(argAsGlobal);
if (function[i].getDeclaredBuiltIn() == EbvInputPatch)
inputPatch = argAsGlobal;
}
if (paramType.getQualifier().isParamOutput()) {
TVariable* argAsGlobal = makeIoVariable(function[i].name->c_str(), paramType, EvqVaryingOut);
@ -9066,19 +9068,12 @@ TIntermSymbol* HlslParseContext::findTessLinkageSymbol(TBuiltInVariable biType)
return intermediate.addSymbol(*it->second->getAsVariable());
}
// Finalization step: Add patch constant function invocation
void HlslParseContext::addPatchConstantInvocation()
// Find the patch constant function (issues error, returns nullptr if not found)
const TFunction* HlslParseContext::findPatchConstantFunction(const TSourceLoc& loc)
{
TSourceLoc loc;
loc.init();
// If there's no patch constant function, or we're not a HS, do nothing.
if (patchConstantFunctionName.empty() || language != EShLangTessControl)
return;
if (symbolTable.isFunctionNameVariable(patchConstantFunctionName)) {
error(loc, "can't use variable in patch constant function", patchConstantFunctionName.c_str(), "");
return;
return nullptr;
}
const TString mangledName = patchConstantFunctionName + "(";
@ -9092,7 +9087,7 @@ void HlslParseContext::addPatchConstantInvocation()
// allow any disambiguation of overloads.
if (candidateList.empty()) {
error(loc, "patch constant function not found", patchConstantFunctionName.c_str(), "");
return;
return nullptr;
}
// Based on directed experiments, it appears that if there are overloaded patchconstantfunctions,
@ -9100,9 +9095,22 @@ void HlslParseContext::addPatchConstantInvocation()
// out if there is more than one candidate.
if (candidateList.size() > 1) {
error(loc, "ambiguous patch constant function", patchConstantFunctionName.c_str(), "");
return;
return nullptr;
}
return candidateList[0];
}
// Finalization step: Add patch constant function invocation
void HlslParseContext::addPatchConstantInvocation()
{
TSourceLoc loc;
loc.init();
// If there's no patch constant function, or we're not a HS, do nothing.
if (patchConstantFunctionName.empty() || language != EShLangTessControl)
return;
// Look for built-in variables in a function's parameter list.
const auto findBuiltIns = [&](const TFunction& function, std::set<tInterstageIoData>& builtIns) {
for (int p=0; p<function.getParamCount(); ++p) {
@ -9167,7 +9175,13 @@ void HlslParseContext::addPatchConstantInvocation()
//
// 5/5B. Call the PCF inside an if test for (invocation id == 0).
TFunction& patchConstantFunction = const_cast<TFunction&>(*candidateList[0]);
TFunction* patchConstantFunctionPtr = const_cast<TFunction*>(findPatchConstantFunction(loc));
if (patchConstantFunctionPtr == nullptr)
return;
TFunction& patchConstantFunction = *patchConstantFunctionPtr;
const int pcfParamCount = patchConstantFunction.getParamCount();
TIntermSymbol* invocationIdSym = findTessLinkageSymbol(EbvInvocationId);
TIntermSequence& epBodySeq = entryPointFunctionBody->getAsAggregate()->getSequence();
@ -9248,10 +9262,9 @@ void HlslParseContext::addPatchConstantInvocation()
// ================ Step 1B: Argument synthesis ================
// Create pcfArguments for synthesis of patchconstantfunction invocation
// TODO: handle struct or array inputs
{
for (int p=0; p<pcfParamCount; ++p) {
TIntermSymbol* inputArg = nullptr;
TIntermTyped* inputArg = nullptr;
if (p == outPatchParam) {
if (perCtrlPtVar == nullptr) {
@ -9265,6 +9278,11 @@ void HlslParseContext::addPatchConstantInvocation()
// find which built-in it is
const TBuiltInVariable biType = patchConstantFunction[p].getDeclaredBuiltIn();
if (biType == EbvInputPatch && inputPatch == nullptr) {
error(loc, "unimplemented: PCF input patch without entry point input patch parameter", "", "");
return;
}
inputArg = findTessLinkageSymbol(biType);
if (inputArg == nullptr) {

View File

@ -316,6 +316,9 @@ protected:
static bool isClipOrCullDistance(const TQualifier& qual) { return isClipOrCullDistance(qual.builtIn); }
static bool isClipOrCullDistance(const TType& type) { return isClipOrCullDistance(type.getQualifier()); }
// Find the patch constant function (issues error, returns nullptr if not found)
const TFunction* findPatchConstantFunction(const TSourceLoc& loc);
// Pass through to base class after remembering built-in mappings.
using TParseContextBase::trackLinkage;
void trackLinkage(TSymbol& variable) override;
@ -415,7 +418,8 @@ protected:
};
TMap<tInterstageIoData, TVariable*> splitBuiltIns; // split built-ins, indexed by built-in type.
TVariable* inputPatch;
TVariable* inputPatch; // input patch is special for PCF: it's the only non-builtin PCF input,
// and is handled as a pseudo-builtin.
unsigned int nextInLocation;
unsigned int nextOutLocation;