summaryrefslogtreecommitdiffstats
path: root/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.h
blob: 669e5674763022fb3114fca485b604f8c80e0d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// AtomicCounterFunctionHLSL: Class for writing implementation of atomic counter functions into HLSL
// output.
//

#ifndef COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_
#define COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_

#include <map>

#include "compiler/translator/Common.h"
#include "compiler/translator/ImmutableString.h"

namespace sh
{

class TInfoSinkBase;
struct TLayoutQualifier;

class AtomicCounterFunctionHLSL final : angle::NonCopyable
{
  public:
    AtomicCounterFunctionHLSL(bool forceResolution);

    ImmutableString useAtomicCounterFunction(const ImmutableString &name);

    void atomicCounterFunctionHeader(TInfoSinkBase &out);

  private:
    enum class AtomicCounterFunction
    {
        LOAD,
        INCREMENT,
        DECREMENT,
        INVALID
    };

    std::map<ImmutableString, AtomicCounterFunction> mAtomicCounterFunctions;
    bool mForceResolution;
};

ImmutableString getAtomicCounterNameForBinding(int binding);

}  // namespace sh

#endif  // COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_