SPV non-functional: minor readability improvements for texturing.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index e4280a3..39b4ea6 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -643,9 +643,9 @@
{
// This should list qualifiers that simultaneous satisfy:
// - struct members can inherit from a struct declaration
- // - effect decorations on the struct members (note smooth does not, and expecting something like volatile to effect the whole object)
+ // - affect decorations on the struct members (note smooth does not, and expecting something like volatile to effect the whole object)
// - are not part of the offset/st430/etc or row/column-major layout
- return qualifier.invariant || qualifier.nopersp || qualifier.flat || qualifier.centroid || qualifier.patch || qualifier.sample || qualifier.hasLocation();
+ return qualifier.invariant || qualifier.hasLocation();
}
//
@@ -1913,8 +1913,10 @@
addMemberDecoration(spvType, member, TranslatePrecisionDecoration(glslangType));
// Add interpolation and auxiliary storage decorations only to top-level members of Input and Output storage classes
if (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut) {
- addMemberDecoration(spvType, member, TranslateInterpolationDecoration(subQualifier));
- addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(subQualifier));
+ if (type.getBasicType() == glslang::EbtBlock) {
+ addMemberDecoration(spvType, member, TranslateInterpolationDecoration(subQualifier));
+ addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(subQualifier));
+ }
}
addMemberDecoration(spvType, member, TranslateInvariantDecoration(subQualifier));
@@ -2606,14 +2608,16 @@
++extraArgs;
} else if (sampler.shadow) {
std::vector<spv::Id> indexes;
- int comp;
+ int dRefComp;
if (cracked.proj)
- comp = 2; // "The resulting 3rd component of P in the shadow forms is used as Dref"
+ dRefComp = 2; // "The resulting 3rd component of P in the shadow forms is used as Dref"
else
- comp = builder.getNumComponents(params.coords) - 1;
- indexes.push_back(comp);
+ dRefComp = builder.getNumComponents(params.coords) - 1;
+ indexes.push_back(dRefComp);
params.Dref = builder.createCompositeExtract(params.coords, builder.getScalarTypeId(builder.getTypeId(params.coords)), indexes);
}
+
+ // lod
if (cracked.lod) {
params.lod = arguments[2];
++extraArgs;
@@ -2621,15 +2625,21 @@
// we need to invent the default lod for an explicit lod instruction for a non-fragment stage
noImplicitLod = true;
}
+
+ // multisample
if (sampler.ms) {
params.sample = arguments[2]; // For MS, "sample" should be specified
++extraArgs;
}
+
+ // gradient
if (cracked.grad) {
params.gradX = arguments[2 + extraArgs];
params.gradY = arguments[3 + extraArgs];
extraArgs += 2;
}
+
+ // offset and offsets
if (cracked.offset) {
params.offset = arguments[2 + extraArgs];
++extraArgs;
@@ -2637,25 +2647,33 @@
params.offsets = arguments[2 + extraArgs];
++extraArgs;
}
+
+ // lod clamp
if (cracked.lodClamp) {
params.lodClamp = arguments[2 + extraArgs];
++extraArgs;
}
+
+ // sparse
if (sparse) {
params.texelOut = arguments[2 + extraArgs];
++extraArgs;
}
+
+ // bias
if (bias) {
params.bias = arguments[2 + extraArgs];
++extraArgs;
}
+
+ // gather component
if (cracked.gather && ! sampler.shadow) {
// default component is 0, if missing, otherwise an argument
if (2 + extraArgs < (int)arguments.size()) {
- params.comp = arguments[2 + extraArgs];
+ params.component = arguments[2 + extraArgs];
++extraArgs;
} else {
- params.comp = builder.makeIntConstant(0);
+ params.component = builder.makeIntConstant(0);
}
}
diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp
index 152a463..ee9642b 100644
--- a/SPIRV/SpvBuilder.cpp
+++ b/SPIRV/SpvBuilder.cpp
@@ -1430,10 +1430,10 @@
bool explicitLod = false;
texArgs[numArgs++] = parameters.sampler;
texArgs[numArgs++] = parameters.coords;
- if (parameters.Dref)
+ if (parameters.Dref != NoResult)
texArgs[numArgs++] = parameters.Dref;
- if (parameters.comp)
- texArgs[numArgs++] = parameters.comp;
+ if (parameters.component != NoResult)
+ texArgs[numArgs++] = parameters.component;
//
// Set up the optional arguments
diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h
index 01cd603..4ae2835 100755
--- a/SPIRV/SpvBuilder.h
+++ b/SPIRV/SpvBuilder.h
@@ -321,7 +321,7 @@
Id gradX;
Id gradY;
Id sample;
- Id comp;
+ Id component;
Id texelOut;
Id lodClamp;
};
diff --git a/Test/baseResults/spv.430.vert.out b/Test/baseResults/spv.430.vert.out
index d5332d2..07dc1a7 100755
--- a/Test/baseResults/spv.430.vert.out
+++ b/Test/baseResults/spv.430.vert.out
@@ -63,9 +63,6 @@
Decorate 55(sampb2) Binding 5
Decorate 56(sampb4) DescriptorSet 0
Decorate 56(sampb4) Binding 31
- MemberDecorate 60(SS) 0 Flat
- MemberDecorate 60(SS) 1 Flat
- MemberDecorate 60(SS) 2 Flat
Decorate 62(var) Location 0
MemberDecorate 63(MS) 0 Location 17
Decorate 63(MS) Block
diff --git a/Test/baseResults/spv.layoutNested.vert.out b/Test/baseResults/spv.layoutNested.vert.out
index 4f3d67c..2d6f559 100644
--- a/Test/baseResults/spv.layoutNested.vert.out
+++ b/Test/baseResults/spv.layoutNested.vert.out
@@ -7,12 +7,12 @@
// Module Version 10000
// Generated by (magic number): 80001
-// Id's are bound by 67
+// Id's are bound by 66
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
- EntryPoint Vertex 4 "main" 63 66
+ EntryPoint Vertex 4 "main" 62 65
Source GLSL 450
Name 4 "main"
Name 14 "S"
@@ -82,16 +82,12 @@
MemberName 58(bBt3) 0 "ntcol"
MemberName 58(bBt3) 1 "ntrow"
Name 60 "bBtn3"
- Name 61 "S"
- MemberName 61(S) 0 "a"
- MemberName 61(S) 1 "b"
- MemberName 61(S) 2 "c"
- Name 63 "sout"
- Name 64 "S"
- MemberName 64(S) 0 "a"
- MemberName 64(S) 1 "b"
- MemberName 64(S) 2 "c"
- Name 66 "soutinv"
+ Name 62 "sout"
+ Name 63 "S"
+ MemberName 63(S) 0 "a"
+ MemberName 63(S) 1 "b"
+ MemberName 63(S) 2 "c"
+ Name 65 "soutinv"
Decorate 13 ArrayStride 32
MemberDecorate 14(S) 0 Offset 0
MemberDecorate 14(S) 1 ColMajor
@@ -166,13 +162,10 @@
Decorate 58(bBt3) BufferBlock
Decorate 60(bBtn3) DescriptorSet 1
Decorate 60(bBtn3) Binding 0
- MemberDecorate 61(S) 0 Flat
- MemberDecorate 61(S) 1 Flat
- MemberDecorate 61(S) 2 Flat
- MemberDecorate 64(S) 0 Invariant
- MemberDecorate 64(S) 1 Invariant
- MemberDecorate 64(S) 2 Invariant
- Decorate 66(soutinv) Invariant
+ MemberDecorate 63(S) 0 Invariant
+ MemberDecorate 63(S) 1 Invariant
+ MemberDecorate 63(S) 2 Invariant
+ Decorate 65(soutinv) Invariant
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@@ -230,12 +223,11 @@
58(bBt3): TypeStruct 49(Nestor) 54(Nestor)
59: TypePointer Uniform 58(bBt3)
60(bBtn3): 59(ptr) Variable Uniform
- 61(S): TypeStruct 8(ivec3) 13 7(int)
- 62: TypePointer Output 61(S)
- 63(sout): 62(ptr) Variable Output
- 64(S): TypeStruct 8(ivec3) 13 7(int)
- 65: TypePointer Output 64(S)
- 66(soutinv): 65(ptr) Variable Output
+ 61: TypePointer Output 29(S)
+ 62(sout): 61(ptr) Variable Output
+ 63(S): TypeStruct 8(ivec3) 13 7(int)
+ 64: TypePointer Output 63(S)
+ 65(soutinv): 64(ptr) Variable Output
4(main): 2 Function None 3
5: Label
Return
diff --git a/Test/baseResults/spv.localAggregates.frag.out b/Test/baseResults/spv.localAggregates.frag.out
index cd8afed..2d464de 100755
--- a/Test/baseResults/spv.localAggregates.frag.out
+++ b/Test/baseResults/spv.localAggregates.frag.out
@@ -7,12 +7,12 @@
// Module Version 10000
// Generated by (magic number): 80001
-// Id's are bound by 143
+// Id's are bound by 136
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
- EntryPoint Fragment 4 "main" 18 43 93 101 111 138 142
+ EntryPoint Fragment 4 "main" 15 40 90 98 108 134 135
ExecutionMode 4 OriginUpperLeft
Source GLSL 400
Name 4 "main"
@@ -25,59 +25,27 @@
MemberName 10(s2) 2 "s1_1"
MemberName 10(s2) 3 "bleh"
Name 12 "locals2"
- Name 13 "s1"
- MemberName 13(s1) 0 "i"
- MemberName 13(s1) 1 "f"
- Name 14 "s2"
- MemberName 14(s2) 0 "i"
- MemberName 14(s2) 1 "f"
- MemberName 14(s2) 2 "s1_1"
- MemberName 14(s2) 3 "bleh"
- Name 15 "s1"
- MemberName 15(s1) 0 "i"
- MemberName 15(s1) 1 "f"
- Name 16 "s3"
- MemberName 16(s3) 0 "s2_1"
- MemberName 16(s3) 1 "i"
- MemberName 16(s3) 2 "f"
- MemberName 16(s3) 3 "s1_1"
- Name 18 "foo3"
- Name 39 "localFArray"
- Name 43 "coord"
- Name 52 "localIArray"
- Name 71 "x"
- Name 73 "localArray"
- Name 78 "i"
- Name 87 "a"
- Name 93 "condition"
- Name 101 "color"
- Name 111 "gl_FragColor"
- Name 131 "samp2D"
- Name 136 "s1"
- MemberName 136(s1) 0 "i"
- MemberName 136(s1) 1 "f"
- Name 138 "foo"
- Name 139 "s1"
- MemberName 139(s1) 0 "i"
- MemberName 139(s1) 1 "f"
- Name 140 "s2"
- MemberName 140(s2) 0 "i"
- MemberName 140(s2) 1 "f"
- MemberName 140(s2) 2 "s1_1"
- MemberName 140(s2) 3 "bleh"
- Name 142 "foo2"
- MemberDecorate 16(s3) 0 Flat
- MemberDecorate 16(s3) 1 Flat
- MemberDecorate 16(s3) 2 Flat
- MemberDecorate 16(s3) 3 Flat
- Decorate 93(condition) Flat
- Decorate 131(samp2D) DescriptorSet 0
- MemberDecorate 136(s1) 0 Flat
- MemberDecorate 136(s1) 1 Flat
- MemberDecorate 140(s2) 0 Flat
- MemberDecorate 140(s2) 1 Flat
- MemberDecorate 140(s2) 2 Flat
- MemberDecorate 140(s2) 3 Flat
+ Name 13 "s3"
+ MemberName 13(s3) 0 "s2_1"
+ MemberName 13(s3) 1 "i"
+ MemberName 13(s3) 2 "f"
+ MemberName 13(s3) 3 "s1_1"
+ Name 15 "foo3"
+ Name 36 "localFArray"
+ Name 40 "coord"
+ Name 49 "localIArray"
+ Name 68 "x"
+ Name 70 "localArray"
+ Name 75 "i"
+ Name 84 "a"
+ Name 90 "condition"
+ Name 98 "color"
+ Name 108 "gl_FragColor"
+ Name 128 "samp2D"
+ Name 134 "foo"
+ Name 135 "foo2"
+ Decorate 90(condition) Flat
+ Decorate 128(samp2D) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@@ -86,171 +54,164 @@
9: TypeVector 7(float) 4
10(s2): TypeStruct 6(int) 7(float) 8(s1) 9(fvec4)
11: TypePointer Function 10(s2)
- 13(s1): TypeStruct 6(int) 7(float)
- 14(s2): TypeStruct 6(int) 7(float) 13(s1) 9(fvec4)
- 15(s1): TypeStruct 6(int) 7(float)
- 16(s3): TypeStruct 14(s2) 6(int) 7(float) 15(s1)
- 17: TypePointer Input 16(s3)
- 18(foo3): 17(ptr) Variable Input
- 19: 6(int) Constant 0
- 20: TypePointer Input 14(s2)
- 23: TypePointer Input 6(int)
- 26: TypeBool
- 30: 6(int) Constant 2
- 31: 6(int) Constant 1
- 32: 7(float) Constant 1065353216
- 33: TypePointer Function 7(float)
- 35: TypeInt 32 0
- 36: 35(int) Constant 16
- 37: TypeArray 7(float) 36
- 38: TypePointer Function 37
- 40: 6(int) Constant 4
- 41: TypeVector 7(float) 2
- 42: TypePointer Input 41(fvec2)
- 43(coord): 42(ptr) Variable Input
- 44: 35(int) Constant 0
- 45: TypePointer Input 7(float)
- 49: 35(int) Constant 8
- 50: TypeArray 6(int) 49
- 51: TypePointer Function 50
- 55: TypePointer Function 6(int)
- 72: 6(int) Constant 5
- 85: 6(int) Constant 16
- 89: 7(float) Constant 0
- 93(condition): 23(ptr) Variable Input
- 99: 6(int) Constant 3
- 100: TypePointer Input 9(fvec4)
- 101(color): 100(ptr) Variable Input
- 103: TypePointer Function 9(fvec4)
- 105: 35(int) Constant 1
- 108: 35(int) Constant 2
- 110: TypePointer Output 9(fvec4)
-111(gl_FragColor): 110(ptr) Variable Output
- 128: TypeImage 7(float) 2D sampled format:Unknown
- 129: TypeSampledImage 128
- 130: TypePointer UniformConstant 129
- 131(samp2D): 130(ptr) Variable UniformConstant
- 136(s1): TypeStruct 6(int) 7(float)
- 137: TypePointer Input 136(s1)
- 138(foo): 137(ptr) Variable Input
- 139(s1): TypeStruct 6(int) 7(float)
- 140(s2): TypeStruct 6(int) 7(float) 139(s1) 9(fvec4)
- 141: TypePointer Input 140(s2)
- 142(foo2): 141(ptr) Variable Input
+ 13(s3): TypeStruct 10(s2) 6(int) 7(float) 8(s1)
+ 14: TypePointer Input 13(s3)
+ 15(foo3): 14(ptr) Variable Input
+ 16: 6(int) Constant 0
+ 17: TypePointer Input 10(s2)
+ 20: TypePointer Input 6(int)
+ 23: TypeBool
+ 27: 6(int) Constant 2
+ 28: 6(int) Constant 1
+ 29: 7(float) Constant 1065353216
+ 30: TypePointer Function 7(float)
+ 32: TypeInt 32 0
+ 33: 32(int) Constant 16
+ 34: TypeArray 7(float) 33
+ 35: TypePointer Function 34
+ 37: 6(int) Constant 4
+ 38: TypeVector 7(float) 2
+ 39: TypePointer Input 38(fvec2)
+ 40(coord): 39(ptr) Variable Input
+ 41: 32(int) Constant 0
+ 42: TypePointer Input 7(float)
+ 46: 32(int) Constant 8
+ 47: TypeArray 6(int) 46
+ 48: TypePointer Function 47
+ 52: TypePointer Function 6(int)
+ 69: 6(int) Constant 5
+ 82: 6(int) Constant 16
+ 86: 7(float) Constant 0
+ 90(condition): 20(ptr) Variable Input
+ 96: 6(int) Constant 3
+ 97: TypePointer Input 9(fvec4)
+ 98(color): 97(ptr) Variable Input
+ 100: TypePointer Function 9(fvec4)
+ 102: 32(int) Constant 1
+ 105: 32(int) Constant 2
+ 107: TypePointer Output 9(fvec4)
+108(gl_FragColor): 107(ptr) Variable Output
+ 125: TypeImage 7(float) 2D sampled format:Unknown
+ 126: TypeSampledImage 125
+ 127: TypePointer UniformConstant 126
+ 128(samp2D): 127(ptr) Variable UniformConstant
+ 133: TypePointer Input 8(s1)
+ 134(foo): 133(ptr) Variable Input
+ 135(foo2): 17(ptr) Variable Input
4(main): 2 Function None 3
5: Label
12(locals2): 11(ptr) Variable Function
- 39(localFArray): 38(ptr) Variable Function
- 52(localIArray): 51(ptr) Variable Function
- 71(x): 55(ptr) Variable Function
- 73(localArray): 38(ptr) Variable Function
- 78(i): 55(ptr) Variable Function
- 87(a): 38(ptr) Variable Function
- 21: 20(ptr) AccessChain 18(foo3) 19
- 22: 14(s2) Load 21
- Store 12(locals2) 22
- 24: 23(ptr) AccessChain 18(foo3) 19 19
- 25: 6(int) Load 24
- 27: 26(bool) SGreaterThan 25 19
- SelectionMerge 29 None
- BranchConditional 27 28 57
- 28: Label
- 34: 33(ptr) AccessChain 12(locals2) 30 31
- Store 34 32
- 46: 45(ptr) AccessChain 43(coord) 44
- 47: 7(float) Load 46
- 48: 33(ptr) AccessChain 39(localFArray) 40
- Store 48 47
- 53: 23(ptr) AccessChain 18(foo3) 19 19
- 54: 6(int) Load 53
- 56: 55(ptr) AccessChain 52(localIArray) 30
- Store 56 54
- Branch 29
- 57: Label
- 58: 45(ptr) AccessChain 43(coord) 44
- 59: 7(float) Load 58
- 60: 33(ptr) AccessChain 12(locals2) 30 31
- Store 60 59
- 61: 33(ptr) AccessChain 39(localFArray) 40
- Store 61 32
- 62: 55(ptr) AccessChain 52(localIArray) 30
- Store 62 19
- Branch 29
- 29: Label
- 63: 55(ptr) AccessChain 52(localIArray) 30
- 64: 6(int) Load 63
- 65: 26(bool) IEqual 64 19
- SelectionMerge 67 None
- BranchConditional 65 66 67
- 66: Label
- 68: 33(ptr) AccessChain 39(localFArray) 40
- 69: 7(float) Load 68
- 70: 7(float) FAdd 69 32
- Store 68 70
- Branch 67
- 67: Label
- Store 71(x) 72
- 74: 6(int) Load 71(x)
- 75: 45(ptr) AccessChain 43(coord) 44
- 76: 7(float) Load 75
- 77: 33(ptr) AccessChain 73(localArray) 74
- Store 77 76
- Store 78(i) 19
- Branch 79
- 79: Label
- LoopMerge 81 82 None
- Branch 83
- 83: Label
- 84: 6(int) Load 78(i)
- 86: 26(bool) SLessThan 84 85
- BranchConditional 86 80 81
- 80: Label
- 88: 6(int) Load 78(i)
- 90: 33(ptr) AccessChain 87(a) 88
- Store 90 89
- Branch 82
- 82: Label
- 91: 6(int) Load 78(i)
- 92: 6(int) IAdd 91 31
- Store 78(i) 92
+ 36(localFArray): 35(ptr) Variable Function
+ 49(localIArray): 48(ptr) Variable Function
+ 68(x): 52(ptr) Variable Function
+ 70(localArray): 35(ptr) Variable Function
+ 75(i): 52(ptr) Variable Function
+ 84(a): 35(ptr) Variable Function
+ 18: 17(ptr) AccessChain 15(foo3) 16
+ 19: 10(s2) Load 18
+ Store 12(locals2) 19
+ 21: 20(ptr) AccessChain 15(foo3) 16 16
+ 22: 6(int) Load 21
+ 24: 23(bool) SGreaterThan 22 16
+ SelectionMerge 26 None
+ BranchConditional 24 25 54
+ 25: Label
+ 31: 30(ptr) AccessChain 12(locals2) 27 28
+ Store 31 29
+ 43: 42(ptr) AccessChain 40(coord) 41
+ 44: 7(float) Load 43
+ 45: 30(ptr) AccessChain 36(localFArray) 37
+ Store 45 44
+ 50: 20(ptr) AccessChain 15(foo3) 16 16
+ 51: 6(int) Load 50
+ 53: 52(ptr) AccessChain 49(localIArray) 27
+ Store 53 51
+ Branch 26
+ 54: Label
+ 55: 42(ptr) AccessChain 40(coord) 41
+ 56: 7(float) Load 55
+ 57: 30(ptr) AccessChain 12(locals2) 27 28
+ Store 57 56
+ 58: 30(ptr) AccessChain 36(localFArray) 37
+ Store 58 29
+ 59: 52(ptr) AccessChain 49(localIArray) 27
+ Store 59 16
+ Branch 26
+ 26: Label
+ 60: 52(ptr) AccessChain 49(localIArray) 27
+ 61: 6(int) Load 60
+ 62: 23(bool) IEqual 61 16
+ SelectionMerge 64 None
+ BranchConditional 62 63 64
+ 63: Label
+ 65: 30(ptr) AccessChain 36(localFArray) 37
+ 66: 7(float) Load 65
+ 67: 7(float) FAdd 66 29
+ Store 65 67
+ Branch 64
+ 64: Label
+ Store 68(x) 69
+ 71: 6(int) Load 68(x)
+ 72: 42(ptr) AccessChain 40(coord) 41
+ 73: 7(float) Load 72
+ 74: 30(ptr) AccessChain 70(localArray) 71
+ Store 74 73
+ Store 75(i) 16
+ Branch 76
+ 76: Label
+ LoopMerge 78 79 None
+ Branch 80
+ 80: Label
+ 81: 6(int) Load 75(i)
+ 83: 23(bool) SLessThan 81 82
+ BranchConditional 83 77 78
+ 77: Label
+ 85: 6(int) Load 75(i)
+ 87: 30(ptr) AccessChain 84(a) 85
+ Store 87 86
Branch 79
- 81: Label
- 94: 6(int) Load 93(condition)
- 95: 26(bool) IEqual 94 31
- SelectionMerge 97 None
- BranchConditional 95 96 97
- 96: Label
- 98: 37 Load 73(localArray)
- Store 87(a) 98
- Branch 97
- 97: Label
- 102: 9(fvec4) Load 101(color)
- 104: 103(ptr) AccessChain 12(locals2) 99
- Store 104 102
- 106: 45(ptr) AccessChain 43(coord) 105
- 107: 7(float) Load 106
- 109: 33(ptr) AccessChain 12(locals2) 99 108
- Store 109 107
- 112: 103(ptr) AccessChain 12(locals2) 99
- 113: 9(fvec4) Load 112
- 114: 33(ptr) AccessChain 39(localFArray) 40
- 115: 7(float) Load 114
- 116: 33(ptr) AccessChain 12(locals2) 30 31
- 117: 7(float) Load 116
- 118: 7(float) FAdd 115 117
- 119: 6(int) Load 71(x)
- 120: 33(ptr) AccessChain 73(localArray) 119
- 121: 7(float) Load 120
- 122: 7(float) FAdd 118 121
- 123: 6(int) Load 71(x)
- 124: 33(ptr) AccessChain 87(a) 123
- 125: 7(float) Load 124
- 126: 7(float) FAdd 122 125
- 127: 9(fvec4) VectorTimesScalar 113 126
- 132: 129 Load 131(samp2D)
- 133: 41(fvec2) Load 43(coord)
- 134: 9(fvec4) ImageSampleImplicitLod 132 133
- 135: 9(fvec4) FMul 127 134
- Store 111(gl_FragColor) 135
+ 79: Label
+ 88: 6(int) Load 75(i)
+ 89: 6(int) IAdd 88 28
+ Store 75(i) 89
+ Branch 76
+ 78: Label
+ 91: 6(int) Load 90(condition)
+ 92: 23(bool) IEqual 91 28
+ SelectionMerge 94 None
+ BranchConditional 92 93 94
+ 93: Label
+ 95: 34 Load 70(localArray)
+ Store 84(a) 95
+ Branch 94
+ 94: Label
+ 99: 9(fvec4) Load 98(color)
+ 101: 100(ptr) AccessChain 12(locals2) 96
+ Store 101 99
+ 103: 42(ptr) AccessChain 40(coord) 102
+ 104: 7(float) Load 103
+ 106: 30(ptr) AccessChain 12(locals2) 96 105
+ Store 106 104
+ 109: 100(ptr) AccessChain 12(locals2) 96
+ 110: 9(fvec4) Load 109
+ 111: 30(ptr) AccessChain 36(localFArray) 37
+ 112: 7(float) Load 111
+ 113: 30(ptr) AccessChain 12(locals2) 27 28
+ 114: 7(float) Load 113
+ 115: 7(float) FAdd 112 114
+ 116: 6(int) Load 68(x)
+ 117: 30(ptr) AccessChain 70(localArray) 116
+ 118: 7(float) Load 117
+ 119: 7(float) FAdd 115 118
+ 120: 6(int) Load 68(x)
+ 121: 30(ptr) AccessChain 84(a) 120
+ 122: 7(float) Load 121
+ 123: 7(float) FAdd 119 122
+ 124: 9(fvec4) VectorTimesScalar 110 123
+ 129: 126 Load 128(samp2D)
+ 130: 38(fvec2) Load 40(coord)
+ 131: 9(fvec4) ImageSampleImplicitLod 129 130
+ 132: 9(fvec4) FMul 124 131
+ Store 108(gl_FragColor) 132
Return
FunctionEnd
diff --git a/Test/baseResults/spv.variableArrayIndex.frag.out b/Test/baseResults/spv.variableArrayIndex.frag.out
index 43df45f..b84b5ba 100755
--- a/Test/baseResults/spv.variableArrayIndex.frag.out
+++ b/Test/baseResults/spv.variableArrayIndex.frag.out
@@ -7,12 +7,12 @@
// Module Version 10000
// Generated by (magic number): 80001
-// Id's are bound by 97
+// Id's are bound by 93
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
- EntryPoint Fragment 4 "main" 10 21 37 40 58 67
+ EntryPoint Fragment 4 "main" 10 20 34 36 54 63
ExecutionMode 4 OriginUpperLeft
Source GLSL 400
Name 4 "main"
@@ -25,43 +25,21 @@
MemberName 14(lunarStruct2) 0 "i"
MemberName 14(lunarStruct2) 1 "f"
MemberName 14(lunarStruct2) 2 "s1_1"
- Name 18 "lunarStruct1"
- MemberName 18(lunarStruct1) 0 "i"
- MemberName 18(lunarStruct1) 1 "f"
- Name 19 "lunarStruct3"
- MemberName 19(lunarStruct3) 0 "s2_1"
- MemberName 19(lunarStruct3) 1 "i"
- MemberName 19(lunarStruct3) 2 "f"
- MemberName 19(lunarStruct3) 3 "s1_1"
- Name 21 "foo3"
- Name 31 "scale"
- Name 32 "lunarStruct1"
- MemberName 32(lunarStruct1) 0 "i"
- MemberName 32(lunarStruct1) 1 "f"
- Name 33 "lunarStruct2"
- MemberName 33(lunarStruct2) 0 "i"
- MemberName 33(lunarStruct2) 1 "f"
- MemberName 33(lunarStruct2) 2 "s1_1"
- Name 37 "foo2"
- Name 38 "lunarStruct1"
- MemberName 38(lunarStruct1) 0 "i"
- MemberName 38(lunarStruct1) 1 "f"
- Name 40 "foo"
- Name 58 "gl_FragColor"
- Name 63 "samp2D"
- Name 67 "coord"
- Name 73 "constructed"
+ Name 18 "lunarStruct3"
+ MemberName 18(lunarStruct3) 0 "s2_1"
+ MemberName 18(lunarStruct3) 1 "i"
+ MemberName 18(lunarStruct3) 2 "f"
+ MemberName 18(lunarStruct3) 3 "s1_1"
+ Name 20 "foo3"
+ Name 30 "scale"
+ Name 34 "foo2"
+ Name 36 "foo"
+ Name 54 "gl_FragColor"
+ Name 59 "samp2D"
+ Name 63 "coord"
+ Name 69 "constructed"
Decorate 10(Count) Flat
- MemberDecorate 19(lunarStruct3) 0 Flat
- MemberDecorate 19(lunarStruct3) 1 Flat
- MemberDecorate 19(lunarStruct3) 2 Flat
- MemberDecorate 19(lunarStruct3) 3 Flat
- MemberDecorate 33(lunarStruct2) 0 Flat
- MemberDecorate 33(lunarStruct2) 1 Flat
- MemberDecorate 33(lunarStruct2) 2 Flat
- MemberDecorate 38(lunarStruct1) 0 Flat
- MemberDecorate 38(lunarStruct1) 1 Flat
- Decorate 63(samp2D) DescriptorSet 0
+ Decorate 59(samp2D) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@@ -74,99 +52,95 @@
15: TypeInt 32 0
16: 15(int) Constant 3
17: TypeArray 14(lunarStruct2) 16
-18(lunarStruct1): TypeStruct 6(int) 12(float)
-19(lunarStruct3): TypeStruct 17 6(int) 12(float) 18(lunarStruct1)
- 20: TypePointer Input 19(lunarStruct3)
- 21(foo3): 20(ptr) Variable Input
- 22: 6(int) Constant 0
- 23: 6(int) Constant 1
- 26: TypeBool
- 30: TypePointer Function 12(float)
-32(lunarStruct1): TypeStruct 6(int) 12(float)
-33(lunarStruct2): TypeStruct 6(int) 12(float) 32(lunarStruct1)
- 34: 15(int) Constant 5
- 35: TypeArray 33(lunarStruct2) 34
- 36: TypePointer Input 35
- 37(foo2): 36(ptr) Variable Input
-38(lunarStruct1): TypeStruct 6(int) 12(float)
- 39: TypePointer Input 38(lunarStruct1)
- 40(foo): 39(ptr) Variable Input
- 45: 6(int) Constant 2
- 50: TypePointer Input 12(float)
- 56: TypeVector 12(float) 4
- 57: TypePointer Output 56(fvec4)
-58(gl_FragColor): 57(ptr) Variable Output
- 60: TypeImage 12(float) 2D sampled format:Unknown
- 61: TypeSampledImage 60
- 62: TypePointer UniformConstant 61
- 63(samp2D): 62(ptr) Variable UniformConstant
- 65: TypeVector 12(float) 2
- 66: TypePointer Input 65(fvec2)
- 67(coord): 66(ptr) Variable Input
- 71: TypeArray 65(fvec2) 16
- 72: TypePointer Function 71
- 77: 12(float) Constant 1065353216
- 78: 12(float) Constant 1073741824
- 79: 65(fvec2) ConstantComposite 77 78
- 83: TypePointer Function 65(fvec2)
+18(lunarStruct3): TypeStruct 17 6(int) 12(float) 13(lunarStruct1)
+ 19: TypePointer Input 18(lunarStruct3)
+ 20(foo3): 19(ptr) Variable Input
+ 21: 6(int) Constant 0
+ 22: 6(int) Constant 1
+ 25: TypeBool
+ 29: TypePointer Function 12(float)
+ 31: 15(int) Constant 5
+ 32: TypeArray 14(lunarStruct2) 31
+ 33: TypePointer Input 32
+ 34(foo2): 33(ptr) Variable Input
+ 35: TypePointer Input 13(lunarStruct1)
+ 36(foo): 35(ptr) Variable Input
+ 41: 6(int) Constant 2
+ 46: TypePointer Input 12(float)
+ 52: TypeVector 12(float) 4
+ 53: TypePointer Output 52(fvec4)
+54(gl_FragColor): 53(ptr) Variable Output
+ 56: TypeImage 12(float) 2D sampled format:Unknown
+ 57: TypeSampledImage 56
+ 58: TypePointer UniformConstant 57
+ 59(samp2D): 58(ptr) Variable UniformConstant
+ 61: TypeVector 12(float) 2
+ 62: TypePointer Input 61(fvec2)
+ 63(coord): 62(ptr) Variable Input
+ 67: TypeArray 61(fvec2) 16
+ 68: TypePointer Function 67
+ 73: 12(float) Constant 1065353216
+ 74: 12(float) Constant 1073741824
+ 75: 61(fvec2) ConstantComposite 73 74
+ 79: TypePointer Function 61(fvec2)
4(main): 2 Function None 3
5: Label
8(iLocal): 7(ptr) Variable Function
- 31(scale): 30(ptr) Variable Function
- 73(constructed): 72(ptr) Variable Function
+ 30(scale): 29(ptr) Variable Function
+ 69(constructed): 68(ptr) Variable Function
11: 6(int) Load 10(Count)
Store 8(iLocal) 11
- 24: 9(ptr) AccessChain 21(foo3) 22 23 22
- 25: 6(int) Load 24
- 27: 26(bool) SGreaterThan 25 22
- SelectionMerge 29 None
- BranchConditional 27 28 53
- 28: Label
- 41: 9(ptr) AccessChain 40(foo) 22
- 42: 6(int) Load 41
- 43: 9(ptr) AccessChain 21(foo3) 22 42 22
- 44: 6(int) Load 43
- 46: 6(int) IAdd 44 45
- 47: 6(int) Load 8(iLocal)
- 48: 6(int) IAdd 47 23
- Store 8(iLocal) 48
- 49: 6(int) IAdd 46 48
- 51: 50(ptr) AccessChain 37(foo2) 49 45 23
- 52: 12(float) Load 51
- Store 31(scale) 52
- Branch 29
- 53: Label
- 54: 50(ptr) AccessChain 21(foo3) 22 22 45 23
- 55: 12(float) Load 54
- Store 31(scale) 55
- Branch 29
- 29: Label
- 59: 12(float) Load 31(scale)
- 64: 61 Load 63(samp2D)
- 68: 65(fvec2) Load 67(coord)
- 69: 56(fvec4) ImageSampleImplicitLod 64 68
- 70: 56(fvec4) VectorTimesScalar 69 59
- Store 58(gl_FragColor) 70
- 74: 65(fvec2) Load 67(coord)
- 75: 12(float) Load 31(scale)
- 76: 65(fvec2) CompositeConstruct 75 75
- 80: 71 CompositeConstruct 74 76 79
- Store 73(constructed) 80
- 81: 9(ptr) AccessChain 40(foo) 22
- 82: 6(int) Load 81
- 84: 83(ptr) AccessChain 73(constructed) 82
- 85: 65(fvec2) Load 84
- 86: 9(ptr) AccessChain 40(foo) 22
- 87: 6(int) Load 86
- 88: 83(ptr) AccessChain 73(constructed) 87
- 89: 65(fvec2) Load 88
- 90: 12(float) CompositeExtract 85 0
- 91: 12(float) CompositeExtract 85 1
- 92: 12(float) CompositeExtract 89 0
- 93: 12(float) CompositeExtract 89 1
- 94: 56(fvec4) CompositeConstruct 90 91 92 93
- 95: 56(fvec4) Load 58(gl_FragColor)
- 96: 56(fvec4) FAdd 95 94
- Store 58(gl_FragColor) 96
+ 23: 9(ptr) AccessChain 20(foo3) 21 22 21
+ 24: 6(int) Load 23
+ 26: 25(bool) SGreaterThan 24 21
+ SelectionMerge 28 None
+ BranchConditional 26 27 49
+ 27: Label
+ 37: 9(ptr) AccessChain 36(foo) 21
+ 38: 6(int) Load 37
+ 39: 9(ptr) AccessChain 20(foo3) 21 38 21
+ 40: 6(int) Load 39
+ 42: 6(int) IAdd 40 41
+ 43: 6(int) Load 8(iLocal)
+ 44: 6(int) IAdd 43 22
+ Store 8(iLocal) 44
+ 45: 6(int) IAdd 42 44
+ 47: 46(ptr) AccessChain 34(foo2) 45 41 22
+ 48: 12(float) Load 47
+ Store 30(scale) 48
+ Branch 28
+ 49: Label
+ 50: 46(ptr) AccessChain 20(foo3) 21 21 41 22
+ 51: 12(float) Load 50
+ Store 30(scale) 51
+ Branch 28
+ 28: Label
+ 55: 12(float) Load 30(scale)
+ 60: 57 Load 59(samp2D)
+ 64: 61(fvec2) Load 63(coord)
+ 65: 52(fvec4) ImageSampleImplicitLod 60 64
+ 66: 52(fvec4) VectorTimesScalar 65 55
+ Store 54(gl_FragColor) 66
+ 70: 61(fvec2) Load 63(coord)
+ 71: 12(float) Load 30(scale)
+ 72: 61(fvec2) CompositeConstruct 71 71
+ 76: 67 CompositeConstruct 70 72 75
+ Store 69(constructed) 76
+ 77: 9(ptr) AccessChain 36(foo) 21
+ 78: 6(int) Load 77
+ 80: 79(ptr) AccessChain 69(constructed) 78
+ 81: 61(fvec2) Load 80
+ 82: 9(ptr) AccessChain 36(foo) 21
+ 83: 6(int) Load 82
+ 84: 79(ptr) AccessChain 69(constructed) 83
+ 85: 61(fvec2) Load 84
+ 86: 12(float) CompositeExtract 81 0
+ 87: 12(float) CompositeExtract 81 1
+ 88: 12(float) CompositeExtract 85 0
+ 89: 12(float) CompositeExtract 85 1
+ 90: 52(fvec4) CompositeConstruct 86 87 88 89
+ 91: 52(fvec4) Load 54(gl_FragColor)
+ 92: 52(fvec4) FAdd 91 90
+ Store 54(gl_FragColor) 92
Return
FunctionEnd