~gabriel1984sibiu/minitube/qt5.6

« back to all changes in this revision

Viewing changes to src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp

  • Committer: Grevutiu Gabriel
  • Date: 2017-06-13 08:43:17 UTC
  • Revision ID: gabriel1984sibiu@gmail.com-20170613084317-ek0zqe0u9g3ocvi8
OriginalĀ upstreamĀ code

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
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.
 
5
//
 
6
 
 
7
#include "compiler/translator/InitializeParseContext.h"
 
8
 
 
9
#include "common/tls.h"
 
10
 
 
11
#include <assert.h>
 
12
 
 
13
TLSIndex GlobalParseContextIndex = TLS_INVALID_INDEX;
 
14
 
 
15
bool InitializeParseContextIndex()
 
16
{
 
17
    assert(GlobalParseContextIndex == TLS_INVALID_INDEX);
 
18
 
 
19
    GlobalParseContextIndex = CreateTLSIndex();
 
20
    return GlobalParseContextIndex != TLS_INVALID_INDEX;
 
21
}
 
22
 
 
23
void FreeParseContextIndex()
 
24
{
 
25
    assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
 
26
 
 
27
    DestroyTLSIndex(GlobalParseContextIndex);
 
28
    GlobalParseContextIndex = TLS_INVALID_INDEX;
 
29
}
 
30
 
 
31
void SetGlobalParseContext(TParseContext* context)
 
32
{
 
33
    assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
 
34
    SetTLSValue(GlobalParseContextIndex, context);
 
35
}
 
36
 
 
37
TParseContext* GetGlobalParseContext()
 
38
{
 
39
    assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
 
40
    return static_cast<TParseContext*>(GetTLSValue(GlobalParseContextIndex));
 
41
}
 
42