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_TEXTURE_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 return min_filter_ != GL_NEAREST && min_filter_ != GL_LINEAR; | 269 return min_filter_ != GL_NEAREST && min_filter_ != GL_LINEAR; |
270 } | 270 } |
271 | 271 |
272 // True if this texture meets all the GLES2 criteria for rendering. | 272 // True if this texture meets all the GLES2 criteria for rendering. |
273 // See section 3.8.2 of the GLES2 spec. | 273 // See section 3.8.2 of the GLES2 spec. |
274 bool CanRender(const FeatureInfo* feature_info) const; | 274 bool CanRender(const FeatureInfo* feature_info) const; |
275 | 275 |
276 // Returns true if mipmaps can be generated by GL. | 276 // Returns true if mipmaps can be generated by GL. |
277 bool CanGenerateMipmaps(const FeatureInfo* feature_info) const; | 277 bool CanGenerateMipmaps(const FeatureInfo* feature_info) const; |
278 | 278 |
279 // Returns true if any of the texture dimensions are not a power of two. | |
280 static bool TextureIsNPOT(GLsizei width, GLsizei height, GLsizei depth); | |
281 | |
282 // Returns true if texture face is complete relative to the first face. | |
283 static bool TextureFaceComplete(const Texture::LevelInfo& first_face, | |
284 size_t face_index, | |
285 GLenum target, | |
286 GLenum internal_format, | |
287 GLsizei width, | |
288 GLsizei height, | |
289 GLsizei depth, | |
290 GLenum format, | |
291 GLenum type); | |
292 | |
293 // Returns true if texture mip level is complete relative to first level. | |
294 static bool TextureMipComplete(const Texture::LevelInfo& level0_face, | |
295 GLenum target, | |
296 GLint level, | |
297 GLenum internal_format, | |
298 GLsizei width, | |
299 GLsizei height, | |
300 GLsizei depth, | |
301 GLenum format, | |
302 GLenum type); | |
303 | |
279 // Sets the Texture's target | 304 // Sets the Texture's target |
280 // Parameters: | 305 // Parameters: |
281 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or | 306 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or |
282 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB | 307 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB |
283 // max_levels: The maximum levels this type of target can have. | 308 // max_levels: The maximum levels this type of target can have. |
284 void SetTarget( | 309 void SetTarget( |
285 const FeatureInfo* feature_info, GLenum target, GLint max_levels); | 310 const FeatureInfo* feature_info, GLenum target, GLint max_levels); |
286 | 311 |
287 // Update info about this texture. | 312 // Update info about this texture. |
288 void Update(const FeatureInfo* feature_info); | 313 void Update(const FeatureInfo* feature_info); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 | 347 |
323 // Increment the framebuffer state change count in all the managers | 348 // Increment the framebuffer state change count in all the managers |
324 // referencing this texture. | 349 // referencing this texture. |
325 void IncAllFramebufferStateChangeCount(); | 350 void IncAllFramebufferStateChangeCount(); |
326 | 351 |
327 MailboxManager* mailbox_manager_; | 352 MailboxManager* mailbox_manager_; |
328 | 353 |
329 // Info about each face and level of texture. | 354 // Info about each face and level of texture. |
330 std::vector<std::vector<LevelInfo> > level_infos_; | 355 std::vector<std::vector<LevelInfo> > level_infos_; |
331 | 356 |
357 // Number of mip levels for each level. | |
358 std::vector<GLsizei> num_mip_levels_; | |
vmiura
2014/10/07 00:13:03
Is this number of mip levels for each face?
If so
David Yen
2014/10/09 20:20:16
Done.
| |
359 | |
332 // The texture refs that point to this Texture. | 360 // The texture refs that point to this Texture. |
333 typedef std::set<TextureRef*> RefSet; | 361 typedef std::set<TextureRef*> RefSet; |
334 RefSet refs_; | 362 RefSet refs_; |
335 | 363 |
336 // The single TextureRef that accounts for memory for this texture. Must be | 364 // The single TextureRef that accounts for memory for this texture. Must be |
337 // one of refs_. | 365 // one of refs_. |
338 TextureRef* memory_tracking_ref_; | 366 TextureRef* memory_tracking_ref_; |
339 | 367 |
340 // The id of the texure | 368 // The id of the texure |
341 GLuint service_id_; | 369 GLuint service_id_; |
342 | 370 |
343 // Whether all renderable mips of this texture have been cleared. | 371 // Whether all renderable mips of this texture have been cleared. |
344 bool cleared_; | 372 bool cleared_; |
345 | 373 |
346 int num_uncleared_mips_; | 374 int num_uncleared_mips_; |
375 int num_npot_faces_; | |
376 int num_complete_faces_; | |
377 int num_incomplete_mips_; | |
347 | 378 |
348 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. | 379 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. |
349 GLenum target_; | 380 GLenum target_; |
350 | 381 |
351 // Texture parameters. | 382 // Texture parameters. |
352 GLenum min_filter_; | 383 GLenum min_filter_; |
353 GLenum mag_filter_; | 384 GLenum mag_filter_; |
354 GLenum wrap_s_; | 385 GLenum wrap_s_; |
355 GLenum wrap_t_; | 386 GLenum wrap_t_; |
356 GLenum usage_; | 387 GLenum usage_; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 private: | 855 private: |
825 DecoderTextureState* texture_state_; | 856 DecoderTextureState* texture_state_; |
826 base::TimeTicks begin_time_; | 857 base::TimeTicks begin_time_; |
827 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 858 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
828 }; | 859 }; |
829 | 860 |
830 } // namespace gles2 | 861 } // namespace gles2 |
831 } // namespace gpu | 862 } // namespace gpu |
832 | 863 |
833 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 864 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |