OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Mark a shader as used | 143 // Mark a shader as used |
144 void UseShader(ShaderInfo* info); | 144 void UseShader(ShaderInfo* info); |
145 | 145 |
146 // Unmark a shader as used. If it has been deleted and is not used | 146 // Unmark a shader as used. If it has been deleted and is not used |
147 // then we free the info. | 147 // then we free the info. |
148 void UnuseShader(ShaderInfo* info); | 148 void UnuseShader(ShaderInfo* info); |
149 | 149 |
150 // Check if a ShaderInfo is owned by this ShaderManager. | 150 // Check if a ShaderInfo is owned by this ShaderManager. |
151 bool IsOwned(ShaderInfo* info); | 151 bool IsOwned(ShaderInfo* info); |
152 | 152 |
| 153 // Strips the comments from a shader. |
| 154 static std::string StripComments(const std::string source); |
| 155 |
153 private: | 156 private: |
154 // Info for each shader by service side shader Id. | 157 // Info for each shader by service side shader Id. |
155 typedef base::hash_map<GLuint, ShaderInfo::Ref> ShaderInfoMap; | 158 typedef base::hash_map<GLuint, ShaderInfo::Ref> ShaderInfoMap; |
156 ShaderInfoMap shader_infos_; | 159 ShaderInfoMap shader_infos_; |
157 | 160 |
158 void RemoveShaderInfoIfUnused(ShaderInfo* info); | 161 void RemoveShaderInfoIfUnused(ShaderInfo* info); |
159 | 162 |
160 DISALLOW_COPY_AND_ASSIGN(ShaderManager); | 163 DISALLOW_COPY_AND_ASSIGN(ShaderManager); |
161 }; | 164 }; |
162 | 165 |
163 } // namespace gles2 | 166 } // namespace gles2 |
164 } // namespace gpu | 167 } // namespace gpu |
165 | 168 |
166 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 169 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
167 | 170 |
OLD | NEW |