OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_ |
| 7 |
| 8 #include <queue> |
| 9 |
| 10 #include "base/hash_tables.h" |
| 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "gpu/command_buffer/service/gl_utils.h" |
| 14 #include "gpu/gpu_export.h" |
| 15 |
| 16 namespace gpu { |
| 17 namespace gles2 { |
| 18 |
| 19 class TextureDefinition; |
| 20 class TextureManager; |
| 21 |
| 22 struct MailboxName { |
| 23 int32 components[32]; |
| 24 }; |
| 25 |
| 26 class GPU_EXPORT Display : public base::RefCounted<Display> { |
| 27 public: |
| 28 Display(); |
| 29 |
| 30 TextureDefinition* ConsumeTexture(GLenum target, const MailboxName& name); |
| 31 |
| 32 void ProduceTexture(GLenum target, |
| 33 const MailboxName& name, |
| 34 TextureDefinition* definition, |
| 35 TextureManager* owner); |
| 36 |
| 37 void DestroyOwnedTextures(TextureManager* owner, bool have_context); |
| 38 |
| 39 private: |
| 40 friend class base::RefCounted<Display>; |
| 41 |
| 42 struct TargetName { |
| 43 TargetName(GLenum target, const MailboxName& name); |
| 44 GLenum target; |
| 45 MailboxName name; |
| 46 }; |
| 47 |
| 48 struct TargetNameCompare { |
| 49 enum { |
| 50 bucket_size = 4, |
| 51 min_buckets = 8 |
| 52 }; |
| 53 size_t operator() (const TargetName& key) const; |
| 54 int operator() (const TargetName& lhs, const TargetName& rhs) const; |
| 55 }; |
| 56 |
| 57 struct OwnedTextureDefinition { |
| 58 OwnedTextureDefinition(TextureDefinition* definition, |
| 59 TextureManager* owner); |
| 60 linked_ptr<TextureDefinition> definition; |
| 61 TextureManager* owner; |
| 62 }; |
| 63 |
| 64 typedef base::hash_map<TargetName, OwnedTextureDefinition, TargetNameCompare> |
| 65 TextureDefinitionMap; |
| 66 |
| 67 ~Display(); |
| 68 |
| 69 TextureDefinitionMap textures_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(Display); |
| 72 }; |
| 73 |
| 74 } // namespage gles2 |
| 75 } // namespace gpu |
| 76 |
| 77 #endif // GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_ |
| 78 |
| 79 |
OLD | NEW |