2
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
3
// Use of this source code is governed by a BSD-style license that can be
4
// found in the LICENSE file.
7
#include "compiler/translator/InitializeParseContext.h"
9
#include "common/tls.h"
13
TLSIndex GlobalParseContextIndex = TLS_INVALID_INDEX;
15
bool InitializeParseContextIndex()
17
assert(GlobalParseContextIndex == TLS_INVALID_INDEX);
19
GlobalParseContextIndex = CreateTLSIndex();
20
return GlobalParseContextIndex != TLS_INVALID_INDEX;
23
void FreeParseContextIndex()
25
assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
27
DestroyTLSIndex(GlobalParseContextIndex);
28
GlobalParseContextIndex = TLS_INVALID_INDEX;
31
void SetGlobalParseContext(TParseContext* context)
33
assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
34
SetTLSValue(GlobalParseContextIndex, context);
37
TParseContext* GetGlobalParseContext()
39
assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
40
return static_cast<TParseContext*>(GetTLSValue(GlobalParseContextIndex));