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

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: Remove unnecessary change. 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 "../../gpu_export.h"
12 #include "../client/hash_tables.h"
13 #include "../common/gles2_cmd_format.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 GPU_EXPORT BufferTracker {
24 public:
25 class GPU_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 }
38
39 GLenum id() const {
40 return id_;
41 }
42
43 unsigned int size() const {
44 return size_;
45 }
46
47 int32 shm_id() const {
48 return shm_id_;
49 }
50
51 uint32 shm_offset() const {
52 return shm_offset_;
53 }
54
55 void* address() const {
56 return address_;
57 }
58
59 private:
60 friend class BufferTracker;
61 friend class BufferTrackerTest;
62
63 GLuint id_;
64 unsigned int size_;
65 int32 shm_id_;
66 uint32 shm_offset_;
67 void* address_;
68 };
69
70 BufferTracker(MappedMemoryManager* manager);
71 ~BufferTracker();
72
73 Buffer* CreateBuffer(GLuint id, GLsizeiptr size);
74 Buffer* GetBuffer(GLuint id);
75 void RemoveBuffer(GLuint id);
76
77 // Frees the block of memory associated with buffer, pending the passage
78 // of a token.
79 void FreePendingToken(Buffer*, int32 token);
80
81 private:
82 typedef gpu::hash_map<GLuint, Buffer*> BufferMap;
83
84 MappedMemoryManager* mapped_memory_;
85 BufferMap buffers_;
86
87 DISALLOW_COPY_AND_ASSIGN(BufferTracker);
88 };
89
90 } // namespace gles2
91 } // namespace gpu
92
93 #endif // GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698