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

Side by Side Diff: gpu/command_buffer/client/buffer_tracker.h

Issue 10440019: Add support for GL_CHROMIUM_pixel_transfer_buffer_object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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
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_CLIENT_BUFFER_TRACKER_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_
7
8 #include <GLES2/gl2.h>
9
10 #include <queue>
11 #include "../client/hash_tables.h"
12 #include "../common/gles2_cmd_format.h"
13 #include "gles2_impl_export.h"
14
15 namespace gpu {
16
17 class CommandBufferHelper;
18 class MappedMemoryManager;
19
20 namespace gles2 {
21
22 // Tracks buffer objects for client side of command buffer.
23 class GLES2_IMPL_EXPORT BufferTracker {
24 public:
25 class GLES2_IMPL_EXPORT Buffer {
26 public:
27 Buffer(GLuint id,
28 unsigned int size,
29 int32 shm_id,
30 uint32 shm_offset,
31 void* address)
32 : id_(id),
33 size_(size),
34 shm_id_(shm_id),
35 shm_offset_(shm_offset),
36 address_(address),
37 mapped_(false) {
38 }
39
40 GLenum id() const {
41 return id_;
42 }
43
44 unsigned int size() const {
45 return size_;
46 }
47
48 int32 shm_id() const {
49 return shm_id_;
50 }
51
52 uint32 shm_offset() const {
53 return shm_offset_;
54 }
55
56 void* address() const {
57 return address_;
58 }
59
60 void set_mapped(bool mapped) {
61 mapped_ = mapped;
62 }
63
64 bool mapped() const {
65 return mapped_;
66 }
67
68 private:
69 friend class BufferTracker;
70 friend class BufferTrackerTest;
71
72 GLuint id_;
73 unsigned int size_;
74 int32 shm_id_;
75 uint32 shm_offset_;
76 void* address_;
77 bool mapped_;
78 };
79
80 BufferTracker(MappedMemoryManager* manager);
81 ~BufferTracker();
82
83 Buffer* CreateBuffer(GLuint id, GLsizeiptr size);
84 Buffer* GetBuffer(GLuint id);
85 void RemoveBuffer(GLuint id);
86
87 // Frees the block of memory associated with buffer, pending the passage
88 // of a token.
89 void FreePendingToken(Buffer*, int32 token);
90
91 private:
92 typedef gpu::hash_map<GLuint, Buffer*> BufferMap;
93
94 MappedMemoryManager* mapped_memory_;
95 BufferMap buffers_;
96
97 DISALLOW_COPY_AND_ASSIGN(BufferTracker);
98 };
99
100 } // namespace gles2
101 } // namespace gpu
102
103 #endif // GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/client/buffer_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698