Generate vector constructions more efficiently when sizes match

When two vectors are the same size, there is no need to extract the
components and construct a new vector.
This commit is contained in:
Arcady Goldmints-Orlov 2024-06-21 14:07:50 -04:00 committed by arcady-lunarg
parent 2d8b71fc63
commit 33d517470e
13 changed files with 1777 additions and 1867 deletions

View file

@ -2,7 +2,7 @@ spv.debuginfo.glsl.frag
Validation failed
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 881
// Id's are bound by 877
Capability Shader
Capability ImageQuery
@ -350,8 +350,8 @@ void main()
Name 794 "R"
Name 804 "NdotR"
Name 814 "spec"
Name 865 "param"
Name 870 "param"
Name 861 "param"
Name 866 "param"
Decorate 177(samplerShadowMap) DescriptorSet 0
Decorate 177(samplerShadowMap) Binding 5
MemberDecorate 405(Light) 0 Offset 0
@ -624,10 +624,10 @@ void main()
821: 16(float) Constant 1098907648
826: 16(float) Constant 1075838976
831: 7(int) Constant 184
843: 96(int) Constant 2
860: 7(int) Constant 188
869: 7(int) Constant 190
876: 7(int) Constant 193
839: 96(int) Constant 2
856: 7(int) Constant 188
865: 7(int) Constant 190
872: 7(int) Constant 193
14(main): 4 Function None 5
15: Label
475(fragPos): 75(ptr) Variable Function
@ -653,8 +653,8 @@ void main()
794(R): 75(ptr) Variable Function
804(NdotR): 25(ptr) Variable Function
814(spec): 75(ptr) Variable Function
865(param): 75(ptr) Variable Function
870(param): 75(ptr) Variable Function
861(param): 75(ptr) Variable Function
866(param): 75(ptr) Variable Function
107: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44
108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 104 104 12 12
Store 101(global_var) 106
@ -931,56 +931,52 @@ void main()
835: 73(fvec3) VectorTimesScalar 833 834
836: 16(float) Load 767(heightAttenuation)
837: 73(fvec3) VectorTimesScalar 835 836
838: 16(float) CompositeExtract 837 0
839: 16(float) CompositeExtract 837 1
840: 16(float) CompositeExtract 837 2
841: 73(fvec3) CompositeConstruct 838 839 840
842: 96(int) Load 654(i)
844: 678(ptr) AccessChain 431(ubo) 290 842 843
845: 19(fvec4) Load 844
846: 73(fvec3) VectorShuffle 845 845 0 1 2
847: 73(fvec3) FMul 841 846
848: 19(fvec4) Load 512(albedo)
849: 73(fvec3) VectorShuffle 848 848 0 1 2
850: 73(fvec3) FMul 847 849
851: 73(fvec3) Load 636(fragcolor)
852: 73(fvec3) FAdd 851 850
Store 636(fragcolor) 852
838: 96(int) Load 654(i)
840: 678(ptr) AccessChain 431(ubo) 290 838 839
841: 19(fvec4) Load 840
842: 73(fvec3) VectorShuffle 841 841 0 1 2
843: 73(fvec3) FMul 837 842
844: 19(fvec4) Load 512(albedo)
845: 73(fvec3) VectorShuffle 844 844 0 1 2
846: 73(fvec3) FMul 843 845
847: 73(fvec3) Load 636(fragcolor)
848: 73(fvec3) FAdd 847 846
Store 636(fragcolor) 848
Branch 662
662: Label
854: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
855: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 656 656 12 12
853: 96(int) Load 654(i)
856: 96(int) IAdd 853 290
Store 654(i) 856
850: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
851: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 656 656 12 12
849: 96(int) Load 654(i)
852: 96(int) IAdd 849 290
Store 654(i) 852
Branch 659
661: Label
858: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
859: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 860 860 12 12
857: 524(ptr) AccessChain 431(ubo) 843
861: 96(int) Load 857
862: 139(bool) SGreaterThan 861 106
SelectionMerge 864 None
BranchConditional 862 863 864
863: Label
867: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
868: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 869 869 12 12
866: 73(fvec3) Load 636(fragcolor)
Store 865(param) 866
871: 73(fvec3) Load 475(fragPos)
Store 870(param) 871
872: 73(fvec3) FunctionCall 81(shadow(vf3;vf3;) 865(param) 870(param)
Store 636(fragcolor) 872
Branch 864
864: Label
874: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
875: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 876 876 12 12
873: 73(fvec3) Load 636(fragcolor)
877: 16(float) CompositeExtract 873 0
878: 16(float) CompositeExtract 873 1
879: 16(float) CompositeExtract 873 2
880: 19(fvec4) CompositeConstruct 877 878 879 115
Store 546(outFragColor) 880
854: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
855: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 856 856 12 12
853: 524(ptr) AccessChain 431(ubo) 839
857: 96(int) Load 853
858: 139(bool) SGreaterThan 857 106
SelectionMerge 860 None
BranchConditional 858 859 860
859: Label
863: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
864: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 865 865 12 12
862: 73(fvec3) Load 636(fragcolor)
Store 861(param) 862
867: 73(fvec3) Load 475(fragPos)
Store 866(param) 867
868: 73(fvec3) FunctionCall 81(shadow(vf3;vf3;) 861(param) 866(param)
Store 636(fragcolor) 868
Branch 860
860: Label
870: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 94
871: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 41 872 872 12 12
869: 73(fvec3) Load 636(fragcolor)
873: 16(float) CompositeExtract 869 0
874: 16(float) CompositeExtract 869 1
875: 16(float) CompositeExtract 869 2
876: 19(fvec4) CompositeConstruct 873 874 875 115
Store 546(outFragColor) 876
Return
FunctionEnd
37(textureProj(vf4;f1;vf2;): 16(float) Function None 32