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

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: Address feedback. Added asyncTexImage. 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 "build/build_config.h"
10 #include "ui/gl/gl_bindings.h"
11
12 namespace gfx {
13
14 // AsyncPixelTransferState holds the resources required to do async
15 // transfers on one texture. It should stay alive for the lifetime
16 // of the texture to allow multiple transfers.
17 class AsyncPixelTransferState
18 : public base::RefCounted<AsyncPixelTransferState> {
apatrick_chromium 2012/12/04 20:59:22 RefCountedThreadSafe
epenner 2012/12/08 03:15:04 I haven't made this thread safe as the lifetime is
19 public:
20 AsyncPixelTransferState() {}
21 virtual ~AsyncPixelTransferState() {};
22
23 // Returns true if there is a transfer in progress.
24 virtual bool TransferIsInProgress() = 0;
25
26 // Bind the async texture and perform any other custom binding.
27 // TODO(epenner): Android currently needs this to lazily bind
28 // a new EGLImage to the texture. We can get rid of this
29 // if we can make the textures context current during a
30 // 'completed' callback on the main thread.
31 virtual void BindTexture(GLenum target) = 0;
32
33 private:
34 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferState);
35 };
36
37
38 class AsyncPixelTransferDelegate {
39 public:
40 // TODO: Should this be owned by a GPU process object?
41 // We only need one in the GPU process, so this is currently
42 // just a lazy instance.
43 static AsyncPixelTransferDelegate* Get();
44
45 virtual scoped_refptr<AsyncPixelTransferState>
46 CreatePixelTransferState(GLuint texture) = 0;
47
48 virtual void AsyncNotifyCompletion(
49 const base::Closure& notify_task) = 0;
50
51 virtual void AsyncTexImage2D(
52 AsyncPixelTransferState*,
apatrick_chromium 2012/12/04 20:59:22 nit: indentation is out by 2 spaces
epenner 2012/12/08 03:15:04 Done.
53 GLenum target,
54 GLint level,
55 GLenum internal_format,
56 GLsizei width,
57 GLsizei height,
58 GLint border,
59 GLenum format,
60 GLenum type,
61 const void* data) = 0;
62
63 virtual void AsyncTexSubImage2D(
64 AsyncPixelTransferState*,
65 GLenum target,
66 GLint level,
67 GLint xoffset,
68 GLint yoffset,
69 GLsizei width,
70 GLsizei height,
71 GLenum format,
72 GLenum type,
73 const void* data) = 0;
74
75 protected:
76 AsyncPixelTransferDelegate() {}
77 virtual ~AsyncPixelTransferDelegate() {}
78 private:
79 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegate);
80 };
81
82 } // namespace gfx
83
84 #endif // UI_GL_ASYNC_TASK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698