1 // 2 // Copyright (c) 2002-2013 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 #ifndef COMPILER_TRANSLATOR_TRANSLATORHLSL_H_ 8 #define COMPILER_TRANSLATOR_TRANSLATORHLSL_H_ 9 10 #include "compiler/translator/Compiler.h" 11 12 namespace sh 13 { 14 15 class TranslatorHLSL : public TCompiler 16 { 17 public: 18 TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output); getAsTranslatorHLSL()19 TranslatorHLSL *getAsTranslatorHLSL() override { return this; } 20 21 bool hasUniformBlock(const std::string &interfaceBlockName) const; 22 unsigned int getUniformBlockRegister(const std::string &interfaceBlockName) const; 23 24 const std::map<std::string, unsigned int> *getUniformRegisterMap() const; 25 26 protected: 27 void translate(TIntermBlock *root, 28 ShCompileOptions compileOptions, 29 PerformanceDiagnostics *perfDiagnostics) override; 30 bool shouldFlattenPragmaStdglInvariantAll() override; 31 32 // collectVariables needs to be run always so registers can be assigned. shouldCollectVariables(ShCompileOptions compileOptions)33 bool shouldCollectVariables(ShCompileOptions compileOptions) override { return true; } 34 35 std::map<std::string, unsigned int> mUniformBlockRegisterMap; 36 std::map<std::string, unsigned int> mUniformRegisterMap; 37 }; 38 39 } // namespace sh 40 41 #endif // COMPILER_TRANSLATOR_TRANSLATORHLSL_H_ 42