WIP: HLSL: Add GS support
This PR adds: [maxvertexcount(n)] attributes point/line/triangle/lineadj/triangleadj qualifiers PointStream/LineStream/TriangleStream templatized types Append method on above template types RestartStrip method on above template types.
This commit is contained in:
201
Test/baseResults/hlsl.basic.geom.out
Normal file
201
Test/baseResults/hlsl.basic.geom.out
Normal file
@@ -0,0 +1,201 @@
|
||||
hlsl.basic.geom
|
||||
Shader version: 450
|
||||
invocations = -1
|
||||
max_vertices = 4
|
||||
input primitive = triangles
|
||||
output primitive = line_strip
|
||||
0:? Sequence
|
||||
0:16 Function Definition: main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
|
||||
0:16 Function Parameters:
|
||||
0:16 'VertexID' (layout(location=0 ) in 3-element array of uint)
|
||||
0:16 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:16 'OutputStream' (out structure{temp float myfloat, temp int something})
|
||||
0:? Sequence
|
||||
0:19 move second child to first child (temp float)
|
||||
0:19 myfloat: direct index for structure (temp float)
|
||||
0:19 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:19 Constant:
|
||||
0:19 0 (const int)
|
||||
0:19 Convert uint to float (temp float)
|
||||
0:19 add (temp uint)
|
||||
0:19 add (temp uint)
|
||||
0:19 direct index (layout(location=3 ) temp uint)
|
||||
0:19 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:19 Constant:
|
||||
0:19 0 (const int)
|
||||
0:19 direct index (layout(location=3 ) temp uint)
|
||||
0:19 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:19 Constant:
|
||||
0:19 1 (const int)
|
||||
0:19 direct index (layout(location=3 ) temp uint)
|
||||
0:19 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:19 Constant:
|
||||
0:19 2 (const int)
|
||||
0:20 move second child to first child (temp int)
|
||||
0:20 something: direct index for structure (temp int)
|
||||
0:20 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:20 Constant:
|
||||
0:20 1 (const int)
|
||||
0:20 Convert uint to int (temp int)
|
||||
0:20 direct index (layout(location=0 ) temp uint)
|
||||
0:20 'VertexID' (layout(location=0 ) in 3-element array of uint)
|
||||
0:20 Constant:
|
||||
0:20 0 (const int)
|
||||
0:22 Sequence
|
||||
0:22 move second child to first child (temp structure{temp float myfloat, temp int something})
|
||||
0:22 'OutputStream' (out structure{temp float myfloat, temp int something})
|
||||
0:22 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:22 EmitVertex (temp void)
|
||||
0:23 Sequence
|
||||
0:23 move second child to first child (temp structure{temp float myfloat, temp int something})
|
||||
0:23 'OutputStream' (out structure{temp float myfloat, temp int something})
|
||||
0:23 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:23 EmitVertex (temp void)
|
||||
0:24 EndPrimitive (temp void)
|
||||
0:? Linker Objects
|
||||
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
|
||||
0:? 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:? 'myfloat' (layout(location=0 ) out float)
|
||||
0:? 'something' (layout(location=1 ) out int)
|
||||
|
||||
|
||||
Linked geometry stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
invocations = 1
|
||||
max_vertices = 4
|
||||
input primitive = triangles
|
||||
output primitive = line_strip
|
||||
0:? Sequence
|
||||
0:16 Function Definition: main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
|
||||
0:16 Function Parameters:
|
||||
0:16 'VertexID' (layout(location=0 ) in 3-element array of uint)
|
||||
0:16 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:16 'OutputStream' (out structure{temp float myfloat, temp int something})
|
||||
0:? Sequence
|
||||
0:19 move second child to first child (temp float)
|
||||
0:19 myfloat: direct index for structure (temp float)
|
||||
0:19 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:19 Constant:
|
||||
0:19 0 (const int)
|
||||
0:19 Convert uint to float (temp float)
|
||||
0:19 add (temp uint)
|
||||
0:19 add (temp uint)
|
||||
0:19 direct index (layout(location=3 ) temp uint)
|
||||
0:19 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:19 Constant:
|
||||
0:19 0 (const int)
|
||||
0:19 direct index (layout(location=3 ) temp uint)
|
||||
0:19 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:19 Constant:
|
||||
0:19 1 (const int)
|
||||
0:19 direct index (layout(location=3 ) temp uint)
|
||||
0:19 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:19 Constant:
|
||||
0:19 2 (const int)
|
||||
0:20 move second child to first child (temp int)
|
||||
0:20 something: direct index for structure (temp int)
|
||||
0:20 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:20 Constant:
|
||||
0:20 1 (const int)
|
||||
0:20 Convert uint to int (temp int)
|
||||
0:20 direct index (layout(location=0 ) temp uint)
|
||||
0:20 'VertexID' (layout(location=0 ) in 3-element array of uint)
|
||||
0:20 Constant:
|
||||
0:20 0 (const int)
|
||||
0:22 Sequence
|
||||
0:22 move second child to first child (temp structure{temp float myfloat, temp int something})
|
||||
0:22 'OutputStream' (out structure{temp float myfloat, temp int something})
|
||||
0:22 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:22 EmitVertex (temp void)
|
||||
0:23 Sequence
|
||||
0:23 move second child to first child (temp structure{temp float myfloat, temp int something})
|
||||
0:23 'OutputStream' (out structure{temp float myfloat, temp int something})
|
||||
0:23 'Vert' (temp structure{temp float myfloat, temp int something})
|
||||
0:23 EmitVertex (temp void)
|
||||
0:24 EndPrimitive (temp void)
|
||||
0:? Linker Objects
|
||||
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
|
||||
0:? 'test' (layout(location=3 ) in 3-element array of uint)
|
||||
0:? 'myfloat' (layout(location=0 ) out float)
|
||||
0:? 'something' (layout(location=1 ) out int)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 45
|
||||
|
||||
Capability Geometry
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Geometry 4 "main" 16 31 38 42 44
|
||||
ExecutionMode 4 Triangles
|
||||
ExecutionMode 4 Invocations 1
|
||||
ExecutionMode 4 OutputLineStrip
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Name 4 "main"
|
||||
Name 8 "PSInput"
|
||||
MemberName 8(PSInput) 0 "myfloat"
|
||||
MemberName 8(PSInput) 1 "something"
|
||||
Name 10 "Vert"
|
||||
Name 16 "test"
|
||||
Name 31 "VertexID"
|
||||
Name 38 "OutputStream"
|
||||
Name 42 "myfloat"
|
||||
Name 44 "something"
|
||||
Decorate 16(test) Location 3
|
||||
Decorate 31(VertexID) Location 0
|
||||
Decorate 42(myfloat) Location 0
|
||||
Decorate 44(something) Location 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeInt 32 1
|
||||
8(PSInput): TypeStruct 6(float) 7(int)
|
||||
9: TypePointer Function 8(PSInput)
|
||||
11: 7(int) Constant 0
|
||||
12: TypeInt 32 0
|
||||
13: 12(int) Constant 3
|
||||
14: TypeArray 12(int) 13
|
||||
15: TypePointer Input 14
|
||||
16(test): 15(ptr) Variable Input
|
||||
17: TypePointer Input 12(int)
|
||||
20: 7(int) Constant 1
|
||||
24: 7(int) Constant 2
|
||||
29: TypePointer Function 6(float)
|
||||
31(VertexID): 15(ptr) Variable Input
|
||||
35: TypePointer Function 7(int)
|
||||
37: TypePointer Output 8(PSInput)
|
||||
38(OutputStream): 37(ptr) Variable Output
|
||||
41: TypePointer Output 6(float)
|
||||
42(myfloat): 41(ptr) Variable Output
|
||||
43: TypePointer Output 7(int)
|
||||
44(something): 43(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
10(Vert): 9(ptr) Variable Function
|
||||
18: 17(ptr) AccessChain 16(test) 11
|
||||
19: 12(int) Load 18
|
||||
21: 17(ptr) AccessChain 16(test) 20
|
||||
22: 12(int) Load 21
|
||||
23: 12(int) IAdd 19 22
|
||||
25: 17(ptr) AccessChain 16(test) 24
|
||||
26: 12(int) Load 25
|
||||
27: 12(int) IAdd 23 26
|
||||
28: 6(float) ConvertUToF 27
|
||||
30: 29(ptr) AccessChain 10(Vert) 11
|
||||
Store 30 28
|
||||
32: 17(ptr) AccessChain 31(VertexID) 11
|
||||
33: 12(int) Load 32
|
||||
34: 7(int) Bitcast 33
|
||||
36: 35(ptr) AccessChain 10(Vert) 20
|
||||
Store 36 34
|
||||
39: 8(PSInput) Load 10(Vert)
|
||||
Store 38(OutputStream) 39
|
||||
EmitVertex
|
||||
40: 8(PSInput) Load 10(Vert)
|
||||
Store 38(OutputStream) 40
|
||||
EmitVertex
|
||||
EndPrimitive
|
||||
Return
|
||||
FunctionEnd
|
||||
25
Test/hlsl.basic.geom
Normal file
25
Test/hlsl.basic.geom
Normal file
@@ -0,0 +1,25 @@
|
||||
struct PSInput
|
||||
{
|
||||
float myfloat : SOME_SEMANTIC;
|
||||
int something : ANOTHER_SEMANTIC;
|
||||
};
|
||||
|
||||
struct nametest {
|
||||
int Append; // these are valid names even though they are also method names.
|
||||
int RestartStrip; // ...
|
||||
};
|
||||
|
||||
[maxvertexcount(4)]
|
||||
void main(triangle in uint VertexID[3] : VertexID,
|
||||
triangle uint test[3] : FOO,
|
||||
inout LineStream<PSInput> OutputStream)
|
||||
{
|
||||
PSInput Vert;
|
||||
|
||||
Vert.myfloat = test[0] + test[1] + test[2];
|
||||
Vert.something = VertexID[0];
|
||||
|
||||
OutputStream.Append(Vert);
|
||||
OutputStream.Append(Vert);
|
||||
OutputStream.RestartStrip();
|
||||
}
|
||||
Reference in New Issue
Block a user