OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SKSL_GLSLCODEGENERATOR | 8 #ifndef SKSL_GLSLCODEGENERATOR |
9 #define SKSL_GLSLCODEGENERATOR | 9 #define SKSL_GLSLCODEGENERATOR |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 int fVersion; | 48 int fVersion; |
49 enum { | 49 enum { |
50 kGL_Standard, | 50 kGL_Standard, |
51 kGLES_Standard | 51 kGLES_Standard |
52 } fStandard; | 52 } fStandard; |
53 bool fIsCoreProfile; | 53 bool fIsCoreProfile; |
54 bool fUsesPrecisionModifiers; | 54 bool fUsesPrecisionModifiers; |
55 bool fMustDeclareFragmentShaderOutput; | 55 bool fMustDeclareFragmentShaderOutput; |
56 // The Tegra3 compiler will sometimes never return if we have min(abs(x), y) | 56 // The Tegra3 compiler will sometimes never return if we have min(abs(x), y) |
57 bool fCanUseMinAndAbsTogether; | 57 bool fCanUseMinAndAbsTogether; |
| 58 // On Intel GPU there is an issue where it misinterprets an atan argument (s
econd argument only, |
| 59 // apparently) of the form "-<expr>" as an int, so we rewrite it as "-1.0 *
<expr>" to avoid |
| 60 // this problem |
| 61 bool fMustForceNegatedAtanParamToFloat; |
58 }; | 62 }; |
59 | 63 |
60 /** | 64 /** |
61 * Converts a Program into GLSL code. | 65 * Converts a Program into GLSL code. |
62 */ | 66 */ |
63 class GLSLCodeGenerator : public CodeGenerator { | 67 class GLSLCodeGenerator : public CodeGenerator { |
64 public: | 68 public: |
65 enum Precedence { | 69 enum Precedence { |
66 kParentheses_Precedence = 1, | 70 kParentheses_Precedence = 1, |
67 kPostfix_Precedence = 2, | 71 kPostfix_Precedence = 2, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 bool fAtLineStart; | 184 bool fAtLineStart; |
181 // Keeps track of which struct types we have written. Given that we are unli
kely to ever write | 185 // Keeps track of which struct types we have written. Given that we are unli
kely to ever write |
182 // more than one or two structs per shader, a simple linear search will be f
aster than anything | 186 // more than one or two structs per shader, a simple linear search will be f
aster than anything |
183 // fancier. | 187 // fancier. |
184 std::vector<const Type*> fWrittenStructs; | 188 std::vector<const Type*> fWrittenStructs; |
185 }; | 189 }; |
186 | 190 |
187 } | 191 } |
188 | 192 |
189 #endif | 193 #endif |
OLD | NEW |