glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out
Arseny Kapoulkine 112e2858cf SPIRV: Simplify matrix->matrix constructor
When constructing a matrix from another matrix with smaller dimensions,
there's no need to extract the scalars out of columns and rebuild the
resulting matrix from scalars - instead, we can just construct shorter
vectors with OpShuffle and combine them to the final result.

This keeps the common casts such as mat3(mat4) in vector registers,
which may improve performance for some GPUs, and cleans up output of
translation tools like SPIRV-Cross.

Fixes #1412.
2018-07-05 15:55:12 -07:00

405 lines
25 KiB
Plaintext

hlsl.cbuffer-identifier.vert
WARNING: 0:29: '' : mul() matrix size mismatch
Shader version: 500
0:? Sequence
0:22 Function Definition: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Function Parameters:
0:22 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:? Sequence
0:23 Sequence
0:23 move second child to first child ( temp int)
0:23 'ConstantBuffer' ( temp int)
0:23 Constant:
0:23 42 (const int)
0:25 Sequence
0:25 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:25 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:25 Constant:
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:26 move second child to first child ( temp 4-component vector of float)
0:26 Pos: direct index for structure ( temp 4-component vector of float)
0:26 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:26 Constant:
0:26 0 (const int)
0:26 matrix-times-vector ( temp 4-component vector of float)
0:26 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:26 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:26 Constant:
0:26 0 (const uint)
0:26 Pos: direct index for structure ( temp 4-component vector of float)
0:26 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:26 Constant:
0:26 0 (const int)
0:27 move second child to first child ( temp 4-component vector of float)
0:27 Pos: direct index for structure ( temp 4-component vector of float)
0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:27 Constant:
0:27 0 (const int)
0:27 matrix-times-vector ( temp 4-component vector of float)
0:27 View: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:27 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:27 Constant:
0:27 1 (const uint)
0:27 Pos: direct index for structure ( temp 4-component vector of float)
0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:27 Constant:
0:27 0 (const int)
0:28 move second child to first child ( temp 4-component vector of float)
0:28 Pos: direct index for structure ( temp 4-component vector of float)
0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:28 Constant:
0:28 0 (const int)
0:28 matrix-times-vector ( temp 4-component vector of float)
0:28 Projection: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:28 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:28 Constant:
0:28 2 (const uint)
0:28 Pos: direct index for structure ( temp 4-component vector of float)
0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:28 Constant:
0:28 0 (const int)
0:29 move second child to first child ( temp 3-component vector of float)
0:29 Norm: direct index for structure ( temp 3-component vector of float)
0:29 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:29 Constant:
0:29 1 (const int)
0:29 Construct vec3 ( temp 3-component vector of float)
0:29 matrix-times-vector ( temp 4-component vector of float)
0:29 Construct mat3x4 ( uniform 3X4 matrix of float)
0:29 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:29 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:29 Constant:
0:29 0 (const uint)
0:29 Norm: direct index for structure ( temp 3-component vector of float)
0:29 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:29 Constant:
0:29 1 (const int)
0:31 Branch: Return with expression
0:31 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Function Definition: main( ( temp void)
0:22 Function Parameters:
0:? Sequence
0:22 Sequence
0:22 move second child to first child ( temp 4-component vector of float)
0:22 Pos: direct index for structure ( temp 4-component vector of float)
0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 0 (const int)
0:? 'input.Pos' (layout( location=0) in 4-component vector of float)
0:22 move second child to first child ( temp 3-component vector of float)
0:22 Norm: direct index for structure ( temp 3-component vector of float)
0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 1 (const int)
0:? 'input.Norm' (layout( location=1) in 3-component vector of float)
0:22 Sequence
0:22 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Function Call: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position)
0:22 Pos: direct index for structure ( temp 4-component vector of float)
0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 0 (const int)
0:22 move second child to first child ( temp 3-component vector of float)
0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float)
0:22 Norm: direct index for structure ( temp 3-component vector of float)
0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 1 (const int)
0:? Linker Objects
0:? 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position)
0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float)
0:? 'input.Pos' (layout( location=0) in 4-component vector of float)
0:? 'input.Norm' (layout( location=1) in 3-component vector of float)
Linked vertex stage:
Shader version: 500
0:? Sequence
0:22 Function Definition: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Function Parameters:
0:22 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:? Sequence
0:23 Sequence
0:23 move second child to first child ( temp int)
0:23 'ConstantBuffer' ( temp int)
0:23 Constant:
0:23 42 (const int)
0:25 Sequence
0:25 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:25 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:25 Constant:
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:25 0.000000
0:26 move second child to first child ( temp 4-component vector of float)
0:26 Pos: direct index for structure ( temp 4-component vector of float)
0:26 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:26 Constant:
0:26 0 (const int)
0:26 matrix-times-vector ( temp 4-component vector of float)
0:26 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:26 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:26 Constant:
0:26 0 (const uint)
0:26 Pos: direct index for structure ( temp 4-component vector of float)
0:26 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:26 Constant:
0:26 0 (const int)
0:27 move second child to first child ( temp 4-component vector of float)
0:27 Pos: direct index for structure ( temp 4-component vector of float)
0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:27 Constant:
0:27 0 (const int)
0:27 matrix-times-vector ( temp 4-component vector of float)
0:27 View: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:27 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:27 Constant:
0:27 1 (const uint)
0:27 Pos: direct index for structure ( temp 4-component vector of float)
0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:27 Constant:
0:27 0 (const int)
0:28 move second child to first child ( temp 4-component vector of float)
0:28 Pos: direct index for structure ( temp 4-component vector of float)
0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:28 Constant:
0:28 0 (const int)
0:28 matrix-times-vector ( temp 4-component vector of float)
0:28 Projection: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:28 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:28 Constant:
0:28 2 (const uint)
0:28 Pos: direct index for structure ( temp 4-component vector of float)
0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:28 Constant:
0:28 0 (const int)
0:29 move second child to first child ( temp 3-component vector of float)
0:29 Norm: direct index for structure ( temp 3-component vector of float)
0:29 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:29 Constant:
0:29 1 (const int)
0:29 Construct vec3 ( temp 3-component vector of float)
0:29 matrix-times-vector ( temp 4-component vector of float)
0:29 Construct mat3x4 ( uniform 3X4 matrix of float)
0:29 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
0:29 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:29 Constant:
0:29 0 (const uint)
0:29 Norm: direct index for structure ( temp 3-component vector of float)
0:29 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:29 Constant:
0:29 1 (const int)
0:31 Branch: Return with expression
0:31 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Function Definition: main( ( temp void)
0:22 Function Parameters:
0:? Sequence
0:22 Sequence
0:22 move second child to first child ( temp 4-component vector of float)
0:22 Pos: direct index for structure ( temp 4-component vector of float)
0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 0 (const int)
0:? 'input.Pos' (layout( location=0) in 4-component vector of float)
0:22 move second child to first child ( temp 3-component vector of float)
0:22 Norm: direct index for structure ( temp 3-component vector of float)
0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 1 (const int)
0:? 'input.Norm' (layout( location=1) in 3-component vector of float)
0:22 Sequence
0:22 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Function Call: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position)
0:22 Pos: direct index for structure ( temp 4-component vector of float)
0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 0 (const int)
0:22 move second child to first child ( temp 3-component vector of float)
0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float)
0:22 Norm: direct index for structure ( temp 3-component vector of float)
0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm})
0:22 Constant:
0:22 1 (const int)
0:? Linker Objects
0:? 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection})
0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position)
0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float)
0:? 'input.Pos' (layout( location=0) in 4-component vector of float)
0:? 'input.Norm' (layout( location=1) in 3-component vector of float)
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 93
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 74 78 86 90
Source HLSL 500
Name 4 "main"
Name 9 "VS_INPUT"
MemberName 9(VS_INPUT) 0 "Pos"
MemberName 9(VS_INPUT) 1 "Norm"
Name 11 "PS_INPUT"
MemberName 11(PS_INPUT) 0 "Pos"
MemberName 11(PS_INPUT) 1 "Norm"
Name 14 "@main(struct-VS_INPUT-vf4-vf31;"
Name 13 "input"
Name 18 "ConstantBuffer"
Name 21 "output"
Name 28 "C"
MemberName 28(C) 0 "World"
MemberName 28(C) 1 "View"
MemberName 28(C) 2 "Projection"
Name 30 ""
Name 72 "input"
Name 74 "input.Pos"
Name 78 "input.Norm"
Name 81 "flattenTemp"
Name 82 "param"
Name 86 "@entryPointOutput.Pos"
Name 90 "@entryPointOutput.Norm"
MemberDecorate 28(C) 0 RowMajor
MemberDecorate 28(C) 0 Offset 0
MemberDecorate 28(C) 0 MatrixStride 16
MemberDecorate 28(C) 1 RowMajor
MemberDecorate 28(C) 1 Offset 64
MemberDecorate 28(C) 1 MatrixStride 16
MemberDecorate 28(C) 2 RowMajor
MemberDecorate 28(C) 2 Offset 128
MemberDecorate 28(C) 2 MatrixStride 16
Decorate 28(C) Block
Decorate 30 DescriptorSet 0
Decorate 30 Binding 0
Decorate 74(input.Pos) Location 0
Decorate 78(input.Norm) Location 1
Decorate 86(@entryPointOutput.Pos) BuiltIn Position
Decorate 90(@entryPointOutput.Norm) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeVector 6(float) 3
9(VS_INPUT): TypeStruct 7(fvec4) 8(fvec3)
10: TypePointer Function 9(VS_INPUT)
11(PS_INPUT): TypeStruct 7(fvec4) 8(fvec3)
12: TypeFunction 11(PS_INPUT) 10(ptr)
16: TypeInt 32 1
17: TypePointer Function 16(int)
19: 16(int) Constant 42
20: TypePointer Function 11(PS_INPUT)
22: 6(float) Constant 0
23: 7(fvec4) ConstantComposite 22 22 22 22
24: 8(fvec3) ConstantComposite 22 22 22
25:11(PS_INPUT) ConstantComposite 23 24
26: 16(int) Constant 0
27: TypeMatrix 7(fvec4) 4
28(C): TypeStruct 27 27 27
29: TypePointer Uniform 28(C)
30: 29(ptr) Variable Uniform
31: TypePointer Uniform 27
34: TypePointer Function 7(fvec4)
39: 16(int) Constant 1
46: 16(int) Constant 2
55: TypeMatrix 7(fvec4) 3
60: TypePointer Function 8(fvec3)
73: TypePointer Input 7(fvec4)
74(input.Pos): 73(ptr) Variable Input
77: TypePointer Input 8(fvec3)
78(input.Norm): 77(ptr) Variable Input
85: TypePointer Output 7(fvec4)
86(@entryPointOutput.Pos): 85(ptr) Variable Output
89: TypePointer Output 8(fvec3)
90(@entryPointOutput.Norm): 89(ptr) Variable Output
4(main): 2 Function None 3
5: Label
72(input): 10(ptr) Variable Function
81(flattenTemp): 20(ptr) Variable Function
82(param): 10(ptr) Variable Function
75: 7(fvec4) Load 74(input.Pos)
76: 34(ptr) AccessChain 72(input) 26
Store 76 75
79: 8(fvec3) Load 78(input.Norm)
80: 60(ptr) AccessChain 72(input) 39
Store 80 79
83: 9(VS_INPUT) Load 72(input)
Store 82(param) 83
84:11(PS_INPUT) FunctionCall 14(@main(struct-VS_INPUT-vf4-vf31;) 82(param)
Store 81(flattenTemp) 84
87: 34(ptr) AccessChain 81(flattenTemp) 26
88: 7(fvec4) Load 87
Store 86(@entryPointOutput.Pos) 88
91: 60(ptr) AccessChain 81(flattenTemp) 39
92: 8(fvec3) Load 91
Store 90(@entryPointOutput.Norm) 92
Return
FunctionEnd
14(@main(struct-VS_INPUT-vf4-vf31;):11(PS_INPUT) Function None 12
13(input): 10(ptr) FunctionParameter
15: Label
18(ConstantBuffer): 17(ptr) Variable Function
21(output): 20(ptr) Variable Function
Store 18(ConstantBuffer) 19
Store 21(output) 25
32: 31(ptr) AccessChain 30 26
33: 27 Load 32
35: 34(ptr) AccessChain 13(input) 26
36: 7(fvec4) Load 35
37: 7(fvec4) MatrixTimesVector 33 36
38: 34(ptr) AccessChain 21(output) 26
Store 38 37
40: 31(ptr) AccessChain 30 39
41: 27 Load 40
42: 34(ptr) AccessChain 21(output) 26
43: 7(fvec4) Load 42
44: 7(fvec4) MatrixTimesVector 41 43
45: 34(ptr) AccessChain 21(output) 26
Store 45 44
47: 31(ptr) AccessChain 30 46
48: 27 Load 47
49: 34(ptr) AccessChain 21(output) 26
50: 7(fvec4) Load 49
51: 7(fvec4) MatrixTimesVector 48 50
52: 34(ptr) AccessChain 21(output) 26
Store 52 51
53: 31(ptr) AccessChain 30 26
54: 27 Load 53
56: 7(fvec4) CompositeExtract 54 0
57: 7(fvec4) CompositeExtract 54 1
58: 7(fvec4) CompositeExtract 54 2
59: 55 CompositeConstruct 56 57 58
61: 60(ptr) AccessChain 13(input) 39
62: 8(fvec3) Load 61
63: 7(fvec4) MatrixTimesVector 59 62
64: 6(float) CompositeExtract 63 0
65: 6(float) CompositeExtract 63 1
66: 6(float) CompositeExtract 63 2
67: 8(fvec3) CompositeConstruct 64 65 66
68: 60(ptr) AccessChain 21(output) 39
Store 68 67
69:11(PS_INPUT) Load 21(output)
ReturnValue 69
FunctionEnd