1 | // |
---|---|
2 | // Copyright (c) 2002-2010 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_UTIL_H_ |
8 | #define COMPILER_TRANSLATOR_UTIL_H_ |
9 | |
10 | #include <stack> |
11 | |
12 | #include <GLSLANG/ShaderLang.h> |
13 | #include "angle_gl.h" |
14 | |
15 | #include "compiler/translator/HashNames.h" |
16 | #include "compiler/translator/ImmutableString.h" |
17 | #include "compiler/translator/Operator.h" |
18 | #include "compiler/translator/Types.h" |
19 | |
20 | // If overflow happens, clamp the value to UINT_MIN or UINT_MAX. |
21 | // Return false if overflow happens. |
22 | bool atoi_clamp(const char *str, unsigned int *value); |
23 | |
24 | namespace sh |
25 | { |
26 | class TIntermBlock; |
27 | class TSymbolTable; |
28 | class TIntermTyped; |
29 | |
30 | float NumericLexFloat32OutOfRangeToInfinity(const std::string &str); |
31 | |
32 | // strtof_clamp is like strtof but |
33 | // 1. it forces C locale, i.e. forcing '.' as decimal point. |
34 | // 2. it sets the value to infinity if overflow happens. |
35 | // 3. str should be guaranteed to be in the valid format for a floating point number as defined |
36 | // by the grammar in the ESSL 3.00.6 spec section 4.1.4. |
37 | // Return false if overflow happens. |
38 | bool strtof_clamp(const std::string &str, float *value); |
39 | |
40 | GLenum GLVariableType(const TType &type); |
41 | GLenum GLVariablePrecision(const TType &type); |
42 | bool IsVaryingIn(TQualifier qualifier); |
43 | bool IsVaryingOut(TQualifier qualifier); |
44 | bool IsVarying(TQualifier qualifier); |
45 | bool IsGeometryShaderInput(GLenum shaderType, TQualifier qualifier); |
46 | InterpolationType GetInterpolationType(TQualifier qualifier); |
47 | |
48 | // Returns array brackets including size with outermost array size first, as specified in GLSL ES |
49 | // 3.10 section 4.1.9. |
50 | ImmutableString ArrayString(const TType &type); |
51 | |
52 | ImmutableString GetTypeName(const TType &type, ShHashFunction64 hashFunction, NameMap *nameMap); |
53 | |
54 | TType GetShaderVariableBasicType(const sh::ShaderVariable &var); |
55 | |
56 | void DeclareGlobalVariable(TIntermBlock *root, const TVariable *variable); |
57 | |
58 | bool IsBuiltinOutputVariable(TQualifier qualifier); |
59 | bool IsBuiltinFragmentInputVariable(TQualifier qualifier); |
60 | bool CanBeInvariantESSL1(TQualifier qualifier); |
61 | bool CanBeInvariantESSL3OrGreater(TQualifier qualifier); |
62 | bool IsOutputESSL(ShShaderOutput output); |
63 | bool IsOutputGLSL(ShShaderOutput output); |
64 | bool IsOutputHLSL(ShShaderOutput output); |
65 | bool IsOutputVulkan(ShShaderOutput output); |
66 | |
67 | bool IsInShaderStorageBlock(TIntermTyped *node); |
68 | |
69 | GLenum GetImageInternalFormatType(TLayoutImageInternalFormat iifq); |
70 | } // namespace sh |
71 | |
72 | #endif // COMPILER_TRANSLATOR_UTIL_H_ |
73 |