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

Side by Side Diff: ui/gl/async_pixel_transfer_delegate.h

Issue 11428140: gpu: Add async pixel transfer interface, stub and tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Fix lint. Created 8 years 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
(Empty)
1 // Copyright (c) 2011 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 UI_GL_ASYNC_TASK_DELEGATE_H_
6 #define UI_GL_ASYNC_TASK_DELEGATE_H_
7
8 #include "base/basictypes.h"
9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "build/build_config.h"
13 #include "ui/gl/gl_bindings.h"
14 #include "ui/gl/gl_export.h"
15
16 namespace base {
17 class SharedMemory;
18 }
19
20 namespace gfx {
21
22 // AsyncPixelTransferState holds the resources required to do async
23 // transfers on one texture. It should stay alive for the lifetime
24 // of the texture to allow multiple transfers.
25 class GL_EXPORT AsyncPixelTransferState
26 : public base::RefCounted<AsyncPixelTransferState> {
27 public:
28 // Returns true if there is a transfer in progress.
29 virtual bool TransferIsInProgress() = 0;
30
31 // Perform any custom binding of the transfer, if needed.
32 // Returns true if the transfer is bound, which also
33 // indicates that the level has been cleared.
34 virtual bool BindAsyncTransferToTexture(GLenum target) = 0;
35
36 protected:
37 friend class base::RefCounted<AsyncPixelTransferState>;
38 AsyncPixelTransferState() {}
39 virtual ~AsyncPixelTransferState() {}
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferState);
43 };
44
45 struct AsyncTexImage2DParams {
46 GLenum target;
47 GLint level;
48 GLenum internal_format;
49 GLsizei width;
50 GLsizei height;
51 GLint border;
52 GLenum format;
53 GLenum type;
54 };
55
56 struct AsyncTexSubImage2DParams {
57 GLenum target;
58 GLint level;
59 GLint xoffset;
60 GLint yoffset;
61 GLsizei width;
62 GLsizei height;
63 GLenum format;
64 GLenum type;
65 };
66
67 struct AsyncMemoryParams {
68 base::SharedMemory* shared_memory;
69 uint32 shm_size;
70 uint32 shm_data_offset;
71 uint32 shm_data_size;
72 };
73
74 class GL_EXPORT AsyncPixelTransferDelegate {
75 public:
76 static scoped_ptr<AsyncPixelTransferDelegate> Create();
77 virtual ~AsyncPixelTransferDelegate() {}
78
79 virtual scoped_refptr<AsyncPixelTransferState>
80 CreatePixelTransferState(GLuint texture) = 0;
81
82 virtual void AsyncNotifyCompletion(
83 const base::Closure& notify_task) = 0;
84
85 virtual void AsyncTexImage2D(
86 AsyncPixelTransferState*,
greggman 2012/12/12 03:51:36 style: google style requires argument names.
epennerAtGoogle 2012/12/12 04:49:49 Done.
87 AsyncTexImage2DParams,
greggman 2012/12/12 03:51:36 any reason this can't be a const ref?
epennerAtGoogle 2012/12/12 04:49:49 Done.
88 AsyncMemoryParams) = 0;
89
90 virtual void AsyncTexSubImage2D(
91 AsyncPixelTransferState*,
greggman 2012/12/12 03:51:36 style: google style requires argument names.
epennerAtGoogle 2012/12/12 04:49:49 Done.
92 AsyncTexSubImage2DParams,
greggman 2012/12/12 03:51:36 any reason this can't be a const ref?
epennerAtGoogle 2012/12/12 04:49:49 Done.
93 AsyncMemoryParams) = 0;
94
95 protected:
96 AsyncPixelTransferDelegate() {}
97
98 private:
99 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegate);
100 };
101
102 } // namespace gfx
103
104 #endif // UI_GL_ASYNC_TASK_DELEGATE_H_
105
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698