OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 }; | 59 }; |
60 | 60 |
61 // Mapping between variable name and info. | 61 // Mapping between variable name and info. |
62 typedef base::hash_map<std::string, VariableInfo> VariableMap; | 62 typedef base::hash_map<std::string, VariableInfo> VariableMap; |
63 // Mapping between hashed name and original name. | 63 // Mapping between hashed name and original name. |
64 typedef base::hash_map<std::string, std::string> NameMap; | 64 typedef base::hash_map<std::string, std::string> NameMap; |
65 | 65 |
66 // Initializes the translator. | 66 // Initializes the translator. |
67 // Must be called once before using the translator object. | 67 // Must be called once before using the translator object. |
68 virtual bool Init( | 68 virtual bool Init( |
69 #if (ANGLE_SH_VERSION >= 126) | |
70 sh::GLenum shader_type, | 69 sh::GLenum shader_type, |
71 #else | |
72 ShShaderType shader_type, | |
73 #endif | |
74 ShShaderSpec shader_spec, | 70 ShShaderSpec shader_spec, |
75 const ShBuiltInResources* resources, | 71 const ShBuiltInResources* resources, |
76 GlslImplementationType glsl_implementation_type, | 72 GlslImplementationType glsl_implementation_type, |
77 ShCompileOptions driver_bug_workarounds) = 0; | 73 ShCompileOptions driver_bug_workarounds) = 0; |
78 | 74 |
79 // Translates the given shader source. | 75 // Translates the given shader source. |
80 // Returns true if translation is successful, false otherwise. | 76 // Returns true if translation is successful, false otherwise. |
81 virtual bool Translate(const char* shader) = 0; | 77 virtual bool Translate(const char* shader) = 0; |
82 | 78 |
83 // The following functions return results from the last translation. | 79 // The following functions return results from the last translation. |
(...skipping 29 matching lines...) Expand all Loading... |
113 virtual void OnDestruct(ShaderTranslator* translator) = 0; | 109 virtual void OnDestruct(ShaderTranslator* translator) = 0; |
114 | 110 |
115 private: | 111 private: |
116 DISALLOW_COPY_AND_ASSIGN(DestructionObserver); | 112 DISALLOW_COPY_AND_ASSIGN(DestructionObserver); |
117 }; | 113 }; |
118 | 114 |
119 ShaderTranslator(); | 115 ShaderTranslator(); |
120 | 116 |
121 // Overridden from ShaderTranslatorInterface. | 117 // Overridden from ShaderTranslatorInterface. |
122 virtual bool Init( | 118 virtual bool Init( |
123 #if (ANGLE_SH_VERSION >= 126) | |
124 sh::GLenum shader_type, | 119 sh::GLenum shader_type, |
125 #else | |
126 ShShaderType shader_type, | |
127 #endif | |
128 ShShaderSpec shader_spec, | 120 ShShaderSpec shader_spec, |
129 const ShBuiltInResources* resources, | 121 const ShBuiltInResources* resources, |
130 GlslImplementationType glsl_implementation_type, | 122 GlslImplementationType glsl_implementation_type, |
131 ShCompileOptions driver_bug_workarounds) OVERRIDE; | 123 ShCompileOptions driver_bug_workarounds) OVERRIDE; |
132 | 124 |
133 // Overridden from ShaderTranslatorInterface. | 125 // Overridden from ShaderTranslatorInterface. |
134 virtual bool Translate(const char* shader) OVERRIDE; | 126 virtual bool Translate(const char* shader) OVERRIDE; |
135 | 127 |
136 // Overridden from ShaderTranslatorInterface. | 128 // Overridden from ShaderTranslatorInterface. |
137 virtual const char* translated_shader() const OVERRIDE; | 129 virtual const char* translated_shader() const OVERRIDE; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ObserverList<DestructionObserver> destruction_observers_; | 161 ObserverList<DestructionObserver> destruction_observers_; |
170 | 162 |
171 DISALLOW_COPY_AND_ASSIGN(ShaderTranslator); | 163 DISALLOW_COPY_AND_ASSIGN(ShaderTranslator); |
172 }; | 164 }; |
173 | 165 |
174 } // namespace gles2 | 166 } // namespace gles2 |
175 } // namespace gpu | 167 } // namespace gpu |
176 | 168 |
177 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ | 169 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
178 | 170 |
OLD | NEW |