add SpecConstantOpModeGuard to GlslangToSpvTraverser::visitSymbol()
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 147a4bd..6a86e21 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -778,6 +778,10 @@
//
void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
{
+ SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
+ if (symbol->getType().getQualifier().isSpecConstant())
+ spec_constant_op_mode_setter.turnOnSpecConstantOpMode();
+
// getSymbolId() will set up all the IO decorations on the first call.
// Formal function parameters were mapped during makeFunctions().
spv::Id id = getSymbolId(symbol);
diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out
index 98925df..a6c5993 100644
--- a/Test/baseResults/spv.specConstantOperations.vert.out
+++ b/Test/baseResults/spv.specConstantOperations.vert.out
@@ -112,15 +112,15 @@
98: 68(ivec4) ConstantComposite 97 97 97 97
99: 68(ivec4) SpecConstantOp 198 71 98
100: 25(int) Constant 0
+ 101: 6(int) SpecConstantOp 81 67 0
102: TypeVector 6(int) 2
+ 103: 102(ivec2) SpecConstantOp 79 67 67 1(GLSL.std.450) 0
104: TypeVector 6(int) 3
+ 105: 104(ivec3) SpecConstantOp 79 67 67 2 1(GLSL.std.450) 0
+ 106: 65(ivec4) SpecConstantOp 79 67 67 1(GLSL.std.450) 2 0 3
4(main): 2 Function None 3
5: Label
Return
- 101: 6(int) CompositeExtract 67 0
- 103: 102(ivec2) VectorShuffle 67 67 1 0
- 105: 104(ivec3) VectorShuffle 67 67 2 1 0
- 106: 65(ivec4) VectorShuffle 67 67 1 2 0 3
FunctionEnd
8(non_const_array_size_from_spec_const(): 6(int) Function None 7
9: Label