Generate separate stores for partially swizzled memory stores

Full vector and fully specified vector swizzle stores are not affected by this change, only partial swizzles ie swizzles with fewer components than the vector being stored to.

Previously the vector being stored to loaded and any components not specified in the swizzle were used to create a full store to the vector.

While this change generates more SPIR-V instructions, it is necessary for correctness.

Fixes #2518.
This commit is contained in:
Jeremy Hayes 2021-07-16 15:07:16 -06:00
parent 9158061398
commit 6d5b40f051
50 changed files with 31343 additions and 26594 deletions

View file

@ -1,27 +1,27 @@
remap.uniformarray.none.frag
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 53
// Id's are bound by 60
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 14 25 35 47
EntryPoint Fragment 4 "main" 14 25 43 54
ExecutionMode 4 OriginUpperLeft
Source GLSL 140
Name 4 "main"
Name 9 "texColor"
Name 14 "color"
Name 25 "inColor"
Name 35 "alpha"
Name 47 "gl_FragColor"
Name 52 "texSampler2D"
Name 43 "alpha"
Name 54 "gl_FragColor"
Name 59 "texSampler2D"
Decorate 14(color) Location 1
Decorate 25(inColor) Location 0
Decorate 35(alpha) Location 7
Decorate 47(gl_FragColor) Location 0
Decorate 52(texSampler2D) DescriptorSet 0
Decorate 52(texSampler2D) Binding 0
Decorate 43(alpha) Location 7
Decorate 54(gl_FragColor) Location 0
Decorate 59(texSampler2D) DescriptorSet 0
Decorate 59(texSampler2D) Binding 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -38,20 +38,23 @@ remap.uniformarray.none.frag
23: TypeVector 6(float) 3
24: TypePointer Input 23(fvec3)
25(inColor): 24(ptr) Variable Input
32: 10(int) Constant 16
33: TypeArray 6(float) 32
34: TypePointer Input 33
35(alpha): 34(ptr) Variable Input
36: 15(int) Constant 12
37: TypePointer Input 6(float)
40: 10(int) Constant 3
41: TypePointer Function 6(float)
46: TypePointer Output 7(fvec4)
47(gl_FragColor): 46(ptr) Variable Output
49: TypeImage 6(float) 2D sampled format:Unknown
50: TypeSampledImage 49
51: TypePointer UniformConstant 50
52(texSampler2D): 51(ptr) Variable UniformConstant
30: 10(int) Constant 0
31: TypePointer Function 6(float)
34: 10(int) Constant 1
37: 10(int) Constant 2
40: 10(int) Constant 16
41: TypeArray 6(float) 40
42: TypePointer Input 41
43(alpha): 42(ptr) Variable Input
44: 15(int) Constant 12
45: TypePointer Input 6(float)
48: 10(int) Constant 3
53: TypePointer Output 7(fvec4)
54(gl_FragColor): 53(ptr) Variable Output
56: TypeImage 6(float) 2D sampled format:Unknown
57: TypeSampledImage 56
58: TypePointer UniformConstant 57
59(texSampler2D): 58(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(texColor): 8(ptr) Variable Function
@ -65,17 +68,23 @@ remap.uniformarray.none.frag
27: 7(fvec4) Load 9(texColor)
28: 23(fvec3) VectorShuffle 27 27 0 1 2
29: 23(fvec3) FAdd 28 26
30: 7(fvec4) Load 9(texColor)
31: 7(fvec4) VectorShuffle 30 29 4 5 6 3
Store 9(texColor) 31
38: 37(ptr) AccessChain 35(alpha) 36
39: 6(float) Load 38
42: 41(ptr) AccessChain 9(texColor) 40
43: 6(float) Load 42
44: 6(float) FAdd 43 39
45: 41(ptr) AccessChain 9(texColor) 40
Store 45 44
48: 7(fvec4) Load 9(texColor)
Store 47(gl_FragColor) 48
32: 31(ptr) AccessChain 9(texColor) 30
33: 6(float) CompositeExtract 29 0
Store 32 33
35: 31(ptr) AccessChain 9(texColor) 34
36: 6(float) CompositeExtract 29 1
Store 35 36
38: 31(ptr) AccessChain 9(texColor) 37
39: 6(float) CompositeExtract 29 2
Store 38 39
46: 45(ptr) AccessChain 43(alpha) 44
47: 6(float) Load 46
49: 31(ptr) AccessChain 9(texColor) 48
50: 6(float) Load 49
51: 6(float) FAdd 50 47
52: 31(ptr) AccessChain 9(texColor) 48
Store 52 51
55: 7(fvec4) Load 9(texColor)
Store 54(gl_FragColor) 55
Return
FunctionEnd