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

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

Issue 10106015: Allow textures to be moved from one GL context group to another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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/common/constants.h"
14 #include "gpu/gpu_export.h"
15
16 namespace gpu {
17 namespace gles2 {
18
19 class TextureDefinition;
20 class TextureManager;
21
22 // Identified a mailbox where a texture definition can be stored for sharing
greggman 2012/04/26 18:09:18 s/Identified/Identifies/ ?
23 // transferring between contexts that are not in the same context group. It is
24 // generally a large random number.
25 struct MailboxName {
26 char components[kMailboxSize];
27 };
28
29 // Manages resources scoped beyond the context or context group level.
30 class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> {
31 public:
32 MailboxManager();
33
34 // Remove the texture definition from the named mailbox and empty the mailbox.
35 TextureDefinition* ConsumeTexture(unsigned target, const MailboxName& name);
36
37 // Put the texture definition in the named mailbox.
38 void ProduceTexture(unsigned target,
39 const MailboxName& name,
40 TextureDefinition* definition,
41 TextureManager* owner);
42
43 // Destroy any texture definitions and mailboxes owned by the given texture
44 // manager.
45 void DestroyOwnedTextures(TextureManager* owner, bool have_context);
46
47 private:
48 friend class base::RefCounted<MailboxManager>;
49
50 struct TargetName {
51 TargetName(unsigned target, const MailboxName& name);
52 unsigned target;
53 MailboxName name;
54 };
55
56 struct TargetNameCompare {
57 enum {
58 bucket_size = 4,
59 min_buckets = 8
60 };
61 size_t operator() (const TargetName& key) const;
62 int operator() (const TargetName& lhs, const TargetName& rhs) const;
63 };
64
65 struct OwnedTextureDefinition {
66 OwnedTextureDefinition(TextureDefinition* definition,
67 TextureManager* owner);
68 linked_ptr<TextureDefinition> definition;
69 TextureManager* owner;
70 };
71
72 typedef base::hash_map<TargetName, OwnedTextureDefinition, TargetNameCompare>
73 TextureDefinitionMap;
74
75 ~MailboxManager();
76
77 TextureDefinitionMap textures_;
78
79 DISALLOW_COPY_AND_ASSIGN(MailboxManager);
80 };
81 } // namespage gles2
82 } // namespace gpu
83
84 #endif // GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_
85
86
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698