add SpecConstantOpModeGuard to GlslangToSpvTraverser::visitSymbol()

This commit is contained in:
qining 2016-04-06 14:42:01 -04:00
parent 408876600f
commit 75d1d80109
2 changed files with 8 additions and 4 deletions

View File

@ -778,6 +778,10 @@ TGlslangToSpvTraverser::~TGlslangToSpvTraverser()
//
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);

View File

@ -112,15 +112,15 @@ Linked vertex stage:
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