glslang/Test/baseResults/hlsl.clipdistance-8.vert.out
LoopDawg 307b6507b3 HLSL: handle multiple clip/cull semantic IDs
HLSL allows several variables to be declared.  There are packing rules involved:
e.g, a float3 and a float1 can be packed into a single array[4], while for a
float3 and another float3, the second one will skip the third array entry to
avoid straddling

This is implements that ability.  Because there can be multiple variables involved,
and the final output array will often be a different type altogether (to fuse
the values into a single destination), a new variable is synthesized, unlike the prior
clip/cull support which used the declared variable.  The new variable name is
taken from one of the declared ones, so the old tests are unchanged.

Several new tests are added to test various packing scenarios.

Only two semantic IDs are supported: 0, and 1, per HLSL rules.  This is
encapsulated in

     static const int maxClipCullRegs = 2;

and the algorithm (probably :) ) generalizes to larger values, although there
are a few issues around how HLSL would pack (e.g, would 4 scalars be packed into
a single HLSL float4 out reg?  Probably, and this algorithm assumes so).
2017-07-26 11:18:09 -06:00

343 lines
18 KiB
Plaintext

hlsl.clipdistance-8.vert
Shader version: 500
0:? Sequence
0:8 Function Definition: @main( ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Function Parameters:
0:? Sequence
0:10 move second child to first child ( temp 4-component vector of float)
0:10 Position: direct index for structure ( temp 4-component vector of float)
0:10 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:10 Constant:
0:10 0 (const int)
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:12 move second child to first child ( temp float)
0:12 direct index ( temp float)
0:12 clip0: direct index for structure ( temp 3-component vector of float)
0:12 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:12 Constant:
0:12 1 (const int)
0:12 Constant:
0:12 0 (const int)
0:12 Constant:
0:12 0.000000
0:13 move second child to first child ( temp float)
0:13 direct index ( temp float)
0:13 clip0: direct index for structure ( temp 3-component vector of float)
0:13 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 1.000000
0:14 move second child to first child ( temp float)
0:14 direct index ( temp float)
0:14 clip0: direct index for structure ( temp 3-component vector of float)
0:14 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:14 Constant:
0:14 1 (const int)
0:14 Constant:
0:14 2 (const int)
0:14 Constant:
0:14 2.000000
0:17 move second child to first child ( temp float)
0:17 clip1: direct index for structure ( temp float)
0:17 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:17 Constant:
0:17 2 (const int)
0:17 Constant:
0:17 3.000000
0:19 Branch: Return with expression
0:19 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Function Definition: main( ( temp void)
0:8 Function Parameters:
0:? Sequence
0:8 Sequence
0:8 move second child to first child ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Function Call: @main( ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput_Position' ( out 4-component vector of float Position)
0:8 Position: direct index for structure ( temp 4-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 0 (const int)
0:? Sequence
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 0 (const int)
0:8 direct index ( temp float)
0:8 clip0: direct index for structure ( temp 3-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 0 (const int)
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 1 (const int)
0:8 direct index ( temp float)
0:8 clip0: direct index for structure ( temp 3-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 1 (const int)
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 2 (const int)
0:8 direct index ( temp float)
0:8 clip0: direct index for structure ( temp 3-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 2 (const int)
0:? Sequence
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 3 (const int)
0:8 clip1: direct index for structure ( temp float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 2 (const int)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{})
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
Linked vertex stage:
Shader version: 500
0:? Sequence
0:8 Function Definition: @main( ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Function Parameters:
0:? Sequence
0:10 move second child to first child ( temp 4-component vector of float)
0:10 Position: direct index for structure ( temp 4-component vector of float)
0:10 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:10 Constant:
0:10 0 (const int)
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:12 move second child to first child ( temp float)
0:12 direct index ( temp float)
0:12 clip0: direct index for structure ( temp 3-component vector of float)
0:12 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:12 Constant:
0:12 1 (const int)
0:12 Constant:
0:12 0 (const int)
0:12 Constant:
0:12 0.000000
0:13 move second child to first child ( temp float)
0:13 direct index ( temp float)
0:13 clip0: direct index for structure ( temp 3-component vector of float)
0:13 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 1.000000
0:14 move second child to first child ( temp float)
0:14 direct index ( temp float)
0:14 clip0: direct index for structure ( temp 3-component vector of float)
0:14 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:14 Constant:
0:14 1 (const int)
0:14 Constant:
0:14 2 (const int)
0:14 Constant:
0:14 2.000000
0:17 move second child to first child ( temp float)
0:17 clip1: direct index for structure ( temp float)
0:17 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:17 Constant:
0:17 2 (const int)
0:17 Constant:
0:17 3.000000
0:19 Branch: Return with expression
0:19 'Output' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Function Definition: main( ( temp void)
0:8 Function Parameters:
0:? Sequence
0:8 Sequence
0:8 move second child to first child ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Function Call: @main( ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput_Position' ( out 4-component vector of float Position)
0:8 Position: direct index for structure ( temp 4-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 0 (const int)
0:? Sequence
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 0 (const int)
0:8 direct index ( temp float)
0:8 clip0: direct index for structure ( temp 3-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 0 (const int)
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 1 (const int)
0:8 direct index ( temp float)
0:8 clip0: direct index for structure ( temp 3-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 1 (const int)
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 2 (const int)
0:8 direct index ( temp float)
0:8 clip0: direct index for structure ( temp 3-component vector of float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 2 (const int)
0:? Sequence
0:8 move second child to first child ( temp float)
0:8 direct index ( temp float)
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
0:8 Constant:
0:8 3 (const int)
0:8 clip1: direct index for structure ( temp float)
0:8 'flattenTemp' ( temp structure{ temp 4-component vector of float Position, temp 3-component vector of float clip0, temp float clip1})
0:8 Constant:
0:8 2 (const int)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{})
0:? '@entryPointOutput_clip1' ( out 4-element array of float ClipDistance)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 65
Capability Shader
Capability ClipDistance
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 41 47 64
Source HLSL 500
Name 4 "main"
Name 9 "VS_OUTPUT"
MemberName 9(VS_OUTPUT) 0 "Position"
MemberName 9(VS_OUTPUT) 1 "clip0"
MemberName 9(VS_OUTPUT) 2 "clip1"
Name 11 "@main("
Name 14 "Output"
Name 38 "flattenTemp"
Name 41 "@entryPointOutput_Position"
Name 47 "@entryPointOutput_clip1"
Name 62 "VS_OUTPUT"
Name 64 "@entryPointOutput"
Decorate 41(@entryPointOutput_Position) BuiltIn Position
Decorate 47(@entryPointOutput_clip1) BuiltIn ClipDistance
Decorate 64(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeVector 6(float) 3
9(VS_OUTPUT): TypeStruct 7(fvec4) 8(fvec3) 6(float)
10: TypeFunction 9(VS_OUTPUT)
13: TypePointer Function 9(VS_OUTPUT)
15: TypeInt 32 1
16: 15(int) Constant 0
17: 6(float) Constant 0
18: 7(fvec4) ConstantComposite 17 17 17 17
19: TypePointer Function 7(fvec4)
21: 15(int) Constant 1
22: TypeInt 32 0
23: 22(int) Constant 0
24: TypePointer Function 6(float)
26: 6(float) Constant 1065353216
27: 22(int) Constant 1
29: 6(float) Constant 1073741824
30: 22(int) Constant 2
32: 15(int) Constant 2
33: 6(float) Constant 1077936128
40: TypePointer Output 7(fvec4)
41(@entryPointOutput_Position): 40(ptr) Variable Output
44: 22(int) Constant 4
45: TypeArray 6(float) 44
46: TypePointer Output 45
47(@entryPointOutput_clip1): 46(ptr) Variable Output
50: TypePointer Output 6(float)
58: 15(int) Constant 3
62(VS_OUTPUT): TypeStruct
63: TypePointer Output 62(VS_OUTPUT)
64(@entryPointOutput): 63(ptr) Variable Output
4(main): 2 Function None 3
5: Label
38(flattenTemp): 13(ptr) Variable Function
39:9(VS_OUTPUT) FunctionCall 11(@main()
Store 38(flattenTemp) 39
42: 19(ptr) AccessChain 38(flattenTemp) 16
43: 7(fvec4) Load 42
Store 41(@entryPointOutput_Position) 43
48: 24(ptr) AccessChain 38(flattenTemp) 21 23
49: 6(float) Load 48
51: 50(ptr) AccessChain 47(@entryPointOutput_clip1) 16
Store 51 49
52: 24(ptr) AccessChain 38(flattenTemp) 21 27
53: 6(float) Load 52
54: 50(ptr) AccessChain 47(@entryPointOutput_clip1) 21
Store 54 53
55: 24(ptr) AccessChain 38(flattenTemp) 21 30
56: 6(float) Load 55
57: 50(ptr) AccessChain 47(@entryPointOutput_clip1) 32
Store 57 56
59: 24(ptr) AccessChain 38(flattenTemp) 32
60: 6(float) Load 59
61: 50(ptr) AccessChain 47(@entryPointOutput_clip1) 58
Store 61 60
Return
FunctionEnd
11(@main():9(VS_OUTPUT) Function None 10
12: Label
14(Output): 13(ptr) Variable Function
20: 19(ptr) AccessChain 14(Output) 16
Store 20 18
25: 24(ptr) AccessChain 14(Output) 21 23
Store 25 17
28: 24(ptr) AccessChain 14(Output) 21 27
Store 28 26
31: 24(ptr) AccessChain 14(Output) 21 30
Store 31 29
34: 24(ptr) AccessChain 14(Output) 32
Store 34 33
35:9(VS_OUTPUT) Load 14(Output)
ReturnValue 35
FunctionEnd