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_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 kANGLE, | 28 kANGLE, |
29 kGL, // GL or GLES | 29 kGL, // GL or GLES |
30 }; | 30 }; |
31 | 31 |
32 enum ShaderState { | 32 enum ShaderState { |
33 kShaderStateWaiting, | 33 kShaderStateWaiting, |
34 kShaderStateCompileRequested, | 34 kShaderStateCompileRequested, |
35 kShaderStateCompiled, // Signifies compile happened, not valid compile. | 35 kShaderStateCompiled, // Signifies compile happened, not valid compile. |
36 }; | 36 }; |
37 | 37 |
| 38 static const int kUndefinedShaderVersion = -1; |
| 39 |
38 void RequestCompile(scoped_refptr<ShaderTranslatorInterface> translator, | 40 void RequestCompile(scoped_refptr<ShaderTranslatorInterface> translator, |
39 TranslatedShaderSourceType type); | 41 TranslatedShaderSourceType type); |
40 | 42 |
41 void DoCompile(); | 43 void DoCompile(); |
42 | 44 |
43 ShaderState shader_state() const { | 45 ShaderState shader_state() const { |
44 return shader_state_; | 46 return shader_state_; |
45 } | 47 } |
46 | 48 |
47 GLuint service_id() const { | 49 GLuint service_id() const { |
48 return marked_for_deletion_ ? 0 : service_id_; | 50 return marked_for_deletion_ ? 0 : service_id_; |
49 } | 51 } |
50 | 52 |
51 GLenum shader_type() const { | 53 GLenum shader_type() const { |
52 return shader_type_; | 54 return shader_type_; |
53 } | 55 } |
54 | 56 |
| 57 int shader_version() const { |
| 58 return shader_version_; |
| 59 } |
| 60 |
55 const std::string& source() const { | 61 const std::string& source() const { |
56 return source_; | 62 return source_; |
57 } | 63 } |
58 | 64 |
59 void set_source(const std::string& source) { | 65 void set_source(const std::string& source) { |
60 source_ = source; | 66 source_ = source; |
61 } | 67 } |
62 | 68 |
63 const std::string& translated_source() const { | 69 const std::string& translated_source() const { |
64 return translated_source_; | 70 return translated_source_; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 167 |
162 // The shader has been marked for deletion. | 168 // The shader has been marked for deletion. |
163 bool marked_for_deletion_; | 169 bool marked_for_deletion_; |
164 | 170 |
165 // The shader this Shader is tracking. | 171 // The shader this Shader is tracking. |
166 GLuint service_id_; | 172 GLuint service_id_; |
167 | 173 |
168 // Type of shader - GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. | 174 // Type of shader - GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. |
169 GLenum shader_type_; | 175 GLenum shader_type_; |
170 | 176 |
| 177 // Version of the shader. Can be kUndefinedShaderVersion or version returned |
| 178 // by ANGLE. |
| 179 int shader_version_; |
| 180 |
171 // Translated source type when shader was last requested to be compiled. | 181 // Translated source type when shader was last requested to be compiled. |
172 TranslatedShaderSourceType source_type_; | 182 TranslatedShaderSourceType source_type_; |
173 | 183 |
174 // Translator to use, set when shader was last requested to be compiled. | 184 // Translator to use, set when shader was last requested to be compiled. |
175 scoped_refptr<ShaderTranslatorInterface> translator_; | 185 scoped_refptr<ShaderTranslatorInterface> translator_; |
176 | 186 |
177 // True if compilation succeeded. | 187 // True if compilation succeeded. |
178 bool valid_; | 188 bool valid_; |
179 | 189 |
180 // The shader source as passed to glShaderSource. | 190 // The shader source as passed to glShaderSource. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 void RemoveShader(Shader* shader); | 255 void RemoveShader(Shader* shader); |
246 | 256 |
247 DISALLOW_COPY_AND_ASSIGN(ShaderManager); | 257 DISALLOW_COPY_AND_ASSIGN(ShaderManager); |
248 }; | 258 }; |
249 | 259 |
250 } // namespace gles2 | 260 } // namespace gles2 |
251 } // namespace gpu | 261 } // namespace gpu |
252 | 262 |
253 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 263 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
254 | 264 |
OLD | NEW |