1 // 2 // Copyright 2018 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 // AtomicCounterFunctionHLSL: Class for writing implementation of atomic counter functions into HLSL 7 // output. 8 // 9 10 #ifndef COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_ 11 #define COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_ 12 13 #include <map> 14 15 #include "compiler/translator/Common.h" 16 #include "compiler/translator/ImmutableString.h" 17 18 namespace sh 19 { 20 21 class TInfoSinkBase; 22 struct TLayoutQualifier; 23 24 class AtomicCounterFunctionHLSL final : angle::NonCopyable 25 { 26 public: 27 AtomicCounterFunctionHLSL(bool forceResolution); 28 29 ImmutableString useAtomicCounterFunction(const ImmutableString &name); 30 31 void atomicCounterFunctionHeader(TInfoSinkBase &out); 32 33 private: 34 enum class AtomicCounterFunction 35 { 36 LOAD, 37 INCREMENT, 38 DECREMENT, 39 INVALID 40 }; 41 42 std::map<ImmutableString, AtomicCounterFunction> mAtomicCounterFunctions; 43 bool mForceResolution; 44 }; 45 46 ImmutableString getAtomicCounterNameForBinding(int binding); 47 48 } // namespace sh 49 50 #endif // COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_ 51