Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
fe6689c6
Commit
fe6689c6
authored
Jun 26, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: support point mode.
parent
102328b7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
440 additions
and
12 deletions
+440
-12
hlsl.hull.3.tesc.out
Test/baseResults/hlsl.hull.3.tesc.out
+382
-0
hlsl.hull.3.tesc
Test/hlsl.hull.3.tesc
+39
-0
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+18
-12
No files found.
Test/baseResults/hlsl.hull.3.tesc.out
0 → 100755
View file @
fe6689c6
hlsl.hull.3.tesc
Shader version: 500
vertices = 4
vertex spacing = equal_spacing
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:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:26 Function Call: @main(struct-VS_OUT-vf31[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 ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-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 ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-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 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:? 'InvocationId' ( in uint InvocationID)
0:? 'pid' ( in uint PrimitiveID)
0:? 'pos' ( in 4-component vector of float Position)
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
Linked tessellation control stage:
Shader version: 500
vertices = 4
vertex spacing = equal_spacing
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:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:26 Function Call: @main(struct-VS_OUT-vf31[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 ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-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 ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-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 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:? 'InvocationId' ( in uint InvocationID)
0:? 'pid' ( in uint PrimitiveID)
0:? 'pos' ( in 4-component vector of float Position)
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 95
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 42 46 48 64 66 74 94
ExecutionMode 4 OutputVertices 4
ExecutionMode 4 Triangles
ExecutionMode 4 SpacingEqual
ExecutionMode 4 PointMode
Source HLSL 500
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 46 "@entryPointOutput"
Name 48 "InvocationId"
Name 50 "param"
Name 63 "@patchConstantResult"
Name 64 "pid"
Name 66 "pos"
Name 67 "param"
Name 69 "param"
Name 74 "@patchConstantOutput_edges"
Name 84 "output"
Name 92 "HS_CONSTANT_OUT"
Name 94 "@patchConstantOutput"
Decorate 42(ip) Location 0
Decorate 46(@entryPointOutput) Location 0
Decorate 48(InvocationId) BuiltIn InvocationId
Decorate 64(pid) BuiltIn PrimitiveId
Decorate 66(pos) BuiltIn Position
Decorate 74(@patchConstantOutput_edges) Patch
Decorate 74(@patchConstantOutput_edges) BuiltIn TessLevelOuter
Decorate 94(@patchConstantOutput) Patch
Decorate 94(@patchConstantOutput) Location 1
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: TypeArray 13(HS_OUT) 10
45: TypePointer Output 44
46(@entryPointOutput): 45(ptr) Variable Output
47: TypePointer Input 9(int)
48(InvocationId): 47(ptr) Variable Input
53: TypePointer Output 13(HS_OUT)
55: 9(int) Constant 1
56: 9(int) Constant 0
58: TypeBool
62: TypePointer Function 23(HS_CONSTANT_OUT)
64(pid): 47(ptr) Variable Input
65: TypePointer Input 19(fvec4)
66(pos): 65(ptr) Variable Input
72: TypeArray 6(float) 10
73: TypePointer Output 72
74(@patchConstantOutput_edges): 73(ptr) Variable Output
75: TypePointer Function 6(float)
78: TypePointer Output 6(float)
80: 31(int) Constant 1
85: 6(float) Constant 1073741824
87: 6(float) Constant 1090519040
92(HS_CONSTANT_OUT): TypeStruct
93: TypePointer Output 92(HS_CONSTANT_OUT)
94(@patchConstantOutput): 93(ptr) Variable Output
4(main): 2 Function None 3
5: Label
40(ip): 12(ptr) Variable Function
50(param): 12(ptr) Variable Function
63(@patchConstantResult): 62(ptr) Variable Function
67(param): 18(ptr) Variable Function
69(param): 20(ptr) Variable Function
43: 11 Load 42(ip)
Store 40(ip) 43
49: 9(int) Load 48(InvocationId)
51: 11 Load 40(ip)
Store 50(param) 51
52: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 50(param)
54: 53(ptr) AccessChain 46(@entryPointOutput) 49
Store 54 52
ControlBarrier 21 55 56
57: 9(int) Load 48(InvocationId)
59: 58(bool) IEqual 57 32
SelectionMerge 61 None
BranchConditional 59 60 61
60: Label
68: 9(int) Load 64(pid)
Store 67(param) 68
70: 19(fvec4) Load 66(pos)
Store 69(param) 70
71:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 67(param) 69(param)
Store 63(@patchConstantResult) 71
76: 75(ptr) AccessChain 63(@patchConstantResult) 32 32
77: 6(float) Load 76
79: 78(ptr) AccessChain 74(@patchConstantOutput_edges) 32
Store 79 77
81: 75(ptr) AccessChain 63(@patchConstantResult) 32 80
82: 6(float) Load 81
83: 78(ptr) AccessChain 74(@patchConstantOutput_edges) 80
Store 83 82
Branch 61
61: 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
84(output): 62(ptr) Variable Function
86: 75(ptr) AccessChain 84(output) 32 32
Store 86 85
88: 75(ptr) AccessChain 84(output) 32 80
Store 88 87
89:23(HS_CONSTANT_OUT) Load 84(output)
ReturnValue 89
FunctionEnd
Test/hlsl.hull.3.tesc
0 → 100644
View file @
fe6689c6
// ***
// 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("tri")]
[partitioning("integer")]
[outputtopology("point")]
[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;
}
gtests/Hlsl.FromFile.cpp
View file @
fe6689c6
...
...
@@ -143,6 +143,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.function.frag"
,
"main"
},
{
"hlsl.hull.1.tesc"
,
"main"
},
{
"hlsl.hull.2.tesc"
,
"main"
},
{
"hlsl.hull.3.tesc"
,
"main"
},
{
"hlsl.hull.void.tesc"
,
"main"
},
{
"hlsl.hull.ctrlpt-1.tesc"
,
"main"
},
{
"hlsl.hull.ctrlpt-2.tesc"
,
"main"
},
...
...
hlsl/hlslParseHelper.cpp
View file @
fe6689c6
...
...
@@ -1833,35 +1833,41 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
}
}
// Handle [outputtoplogy("...")]
// Handle [outputtop
o
logy("...")]
const
TIntermAggregate
*
topologyAttr
=
attributes
[
EatOutputTopology
];
if
(
topologyAttr
!=
nullptr
)
{
const
TConstUnion
&
topoType
=
topologyAttr
->
getSequence
()[
0
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
];
if
(
topoType
.
getType
()
!=
EbtString
)
{
error
(
loc
,
"invalid outputtoplogy"
,
""
,
""
);
error
(
loc
,
"invalid outputtop
o
logy"
,
""
,
""
);
}
else
{
TString
topologyStr
=
*
topoType
.
getSConst
();
std
::
transform
(
topologyStr
.
begin
(),
topologyStr
.
end
(),
topologyStr
.
begin
(),
::
tolower
);
TVertexOrder
topology
=
EvoNone
;
TVertexOrder
vertexOrder
=
EvoNone
;
TLayoutGeometry
primitive
=
ElgNone
;
if
(
topologyStr
==
"point"
)
{
topology
=
EvoNone
;
intermediate
.
setPointMode
()
;
}
else
if
(
topologyStr
==
"line"
)
{
topology
=
EvoNone
;
primitive
=
ElgIsolines
;
}
else
if
(
topologyStr
==
"triangle_cw"
)
{
topology
=
EvoCw
;
vertexOrder
=
EvoCw
;
primitive
=
ElgTriangles
;
}
else
if
(
topologyStr
==
"triangle_ccw"
)
{
topology
=
EvoCcw
;
vertexOrder
=
EvoCcw
;
primitive
=
ElgTriangles
;
}
else
{
error
(
loc
,
"unsupported outputtoplogy type"
,
topologyStr
.
c_str
(),
""
);
error
(
loc
,
"unsupported outputtop
o
logy type"
,
topologyStr
.
c_str
(),
""
);
}
if
(
topology
!=
EvoNone
)
{
if
(
!
intermediate
.
setVertexOrder
(
topology
))
{
error
(
loc
,
"cannot change previously set outputtopology"
,
TQualifier
::
getVertexOrderString
(
topology
),
""
);
if
(
vertexOrder
!=
EvoNone
)
{
if
(
!
intermediate
.
setVertexOrder
(
vertexOrder
))
{
error
(
loc
,
"cannot change previously set outputtopology"
,
TQualifier
::
getVertexOrderString
(
vertexOrder
),
""
);
}
}
if
(
primitive
!=
ElgNone
)
intermediate
.
setOutputPrimitive
(
primitive
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment