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

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

Issue 14456004: GPU client side changes for GpuMemoryBuffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@glapi
Patch Set: Add missing parameter in GLES2Implementation ctor in GLES2Implementation unittest Created 7 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CLIENT_GPU_MEMORY_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "gles2_impl_export.h" 11 #include "gles2_impl_export.h"
12 12
13 namespace gpu { 13 namespace gpu {
14 14
15 // Interface for creating and accessing a zero-copy GPU memory buffer. 15 // Interface for creating and accessing a zero-copy GPU memory buffer.
16 // This design evolved from the generalization of GraphicBuffer API 16 // This design evolved from the generalization of GraphicBuffer API
17 // of Android framework. 17 // of Android framework.
18 // 18 //
19 // THREADING CONSIDERATIONS: 19 // THREADING CONSIDERATIONS:
20 // 20 //
21 // This interface is thread-safe. However, multiple threads mapping 21 // This interface is thread-safe. However, multiple threads mapping
22 // a buffer for Write or ReadOrWrite simultaneously may result in undefined 22 // a buffer for Write or ReadOrWrite simultaneously may result in undefined
23 // behavior and is not allowed. 23 // behavior and is not allowed.
24 class GLES2_IMPL_EXPORT GpuMemoryBuffer { 24 class GLES2_IMPL_EXPORT GpuMemoryBuffer {
25 public: 25 public:
26 typedef base::Callback<scoped_ptr<GpuMemoryBuffer>(int, int)> Creator; 26 typedef base::Callback<scoped_ptr<GpuMemoryBuffer>(int, int)> Creator;
27 enum AccessMode { 27 enum AccessMode {
28 READ_ONLY, 28 READ_ONLY,
29 WRITE_ONLY, 29 WRITE_ONLY,
30 READ_OR_WRITE, 30 READ_WRITE,
31 }; 31 };
32 32
33 // Frees a previously allocated buffer. Freeing a buffer that is still 33 // Frees a previously allocated buffer. Freeing a buffer that is still
34 // mapped in any process is undefined behavior. 34 // mapped in any process is undefined behavior.
35 virtual ~GpuMemoryBuffer() {} 35 virtual ~GpuMemoryBuffer() {}
36 36
37 // Maps the buffer so the client can write the bitmap data in |*vaddr| 37 // Maps the buffer so the client can write the bitmap data in |*vaddr|
38 // subsequently. This call may block, for instance if the hardware needs 38 // subsequently. This call may block, for instance if the hardware needs
39 // to finish rendering or if CPU caches need to be synchronized. 39 // to finish rendering or if CPU caches need to be synchronized.
40 virtual void Map(AccessMode mode, void** vaddr) = 0; 40 virtual void Map(AccessMode mode, void** vaddr) = 0;
41 41
42 // Unmaps the buffer. Called after all changes to the buffer are 42 // Unmaps the buffer. Called after all changes to the buffer are
43 // completed. 43 // completed.
44 virtual void Unmap() = 0; 44 virtual void Unmap() = 0;
45 45
46 // Returns true iff the buffer is mapped. 46 // Returns true iff the buffer is mapped.
47 virtual bool IsMapped() = 0; 47 virtual bool IsMapped() = 0;
48 48
49 // Returns the native pointer for the buffer. 49 // Returns the native pointer for the buffer.
50 virtual void* GetNativeBuffer() = 0; 50 virtual void* GetNativeBuffer() = 0;
51 51
52 // Returns the stride in pixels for the buffer. 52 // Returns the stride in pixels for the buffer.
53 virtual uint32 GetStride() = 0; 53 virtual uint32 GetStride() = 0;
54 }; 54 };
55 55
56 } // namespace gpu 56 } // namespace gpu
57 57
58 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ 58 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698