Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: gpu/command_buffer/service/shader_manager.h

Issue 957403004: Compile shader upon deletion if attached. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 private: 141 private:
142 friend class base::RefCounted<Shader>; 142 friend class base::RefCounted<Shader>;
143 friend class ShaderManager; 143 friend class ShaderManager;
144 144
145 Shader(GLuint service_id, GLenum shader_type); 145 Shader(GLuint service_id, GLenum shader_type);
146 ~Shader(); 146 ~Shader();
147 147
148 void IncUseCount(); 148 void IncUseCount();
149 void DecUseCount(); 149 void DecUseCount();
150 void MarkAsDeleted(); 150 void Delete();
151 151
152 int use_count_; 152 int use_count_;
153 153
154 // The current state of the shader. 154 // The current state of the shader.
155 ShaderState shader_state_; 155 ShaderState shader_state_;
156 156
157 // The shader this Shader is tracking. 157 // The shader this Shader is tracking.
158 GLuint service_id_; 158 GLuint service_id_;
159 159
160 // Type of shader - GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. 160 // Type of shader - GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 GLuint service_id, 208 GLuint service_id,
209 GLenum shader_type); 209 GLenum shader_type);
210 210
211 // Gets an existing shader info for the given shader ID. Returns NULL if none 211 // Gets an existing shader info for the given shader ID. Returns NULL if none
212 // exists. 212 // exists.
213 Shader* GetShader(GLuint client_id); 213 Shader* GetShader(GLuint client_id);
214 214
215 // Gets a client id for a given service id. 215 // Gets a client id for a given service id.
216 bool GetClientId(GLuint service_id, GLuint* client_id) const; 216 bool GetClientId(GLuint service_id, GLuint* client_id) const;
217 217
218 void MarkAsDeleted(Shader* shader); 218 void Delete(Shader* shader);
219 219
220 // Mark a shader as used 220 // Mark a shader as used
221 void UseShader(Shader* shader); 221 void UseShader(Shader* shader);
222 222
223 // Unmark a shader as used. If it has been deleted and is not used 223 // Unmark a shader as used. If it has been deleted and is not used
224 // then we free the shader. 224 // then we free the shader.
225 void UnuseShader(Shader* shader); 225 void UnuseShader(Shader* shader);
226 226
227 // Check if a Shader is owned by this ShaderManager. 227 // Check if a Shader is owned by this ShaderManager.
228 bool IsOwned(Shader* shader); 228 bool IsOwned(Shader* shader);
229 229
230 private: 230 private:
231 friend class Shader; 231 friend class Shader;
232 232
233 // Info for each shader by service side shader Id. 233 // Info for each shader by service side shader Id.
234 typedef base::hash_map<GLuint, scoped_refptr<Shader> > ShaderMap; 234 typedef base::hash_map<GLuint, scoped_refptr<Shader> > ShaderMap;
235 ShaderMap shaders_; 235 ShaderMap shaders_;
236 236
237 void RemoveShader(Shader* shader); 237 void RemoveShader(Shader* shader);
238 238
239 DISALLOW_COPY_AND_ASSIGN(ShaderManager); 239 DISALLOW_COPY_AND_ASSIGN(ShaderManager);
240 }; 240 };
241 241
242 } // namespace gles2 242 } // namespace gles2
243 } // namespace gpu 243 } // namespace gpu
244 244
245 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ 245 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_
246 246
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/shader_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698