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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/gl/async_pixel_transfer_delegate.h
diff --git a/ui/gl/async_pixel_transfer_delegate.h b/ui/gl/async_pixel_transfer_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..12dd0429cf57257f1f601c2d772a6eacabf54f84
--- /dev/null
+++ b/ui/gl/async_pixel_transfer_delegate.h
@@ -0,0 +1,105 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GL_ASYNC_TASK_DELEGATE_H_
+#define UI_GL_ASYNC_TASK_DELEGATE_H_
+
+#include "base/basictypes.h"
+#include "base/bind.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "build/build_config.h"
+#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_export.h"
+
+namespace base {
+class SharedMemory;
+}
+
+namespace gfx {
+
+// AsyncPixelTransferState holds the resources required to do async
+// transfers on one texture. It should stay alive for the lifetime
+// of the texture to allow multiple transfers.
+class GL_EXPORT AsyncPixelTransferState
+ : public base::RefCounted<AsyncPixelTransferState> {
+ public:
+ // Returns true if there is a transfer in progress.
+ virtual bool TransferIsInProgress() = 0;
+
+ // Perform any custom binding of the transfer, if needed.
+ // Returns true if the transfer is bound, which also
+ // indicates that the level has been cleared.
+ virtual bool BindAsyncTransferToTexture(GLenum target) = 0;
+
+ protected:
+ friend class base::RefCounted<AsyncPixelTransferState>;
+ AsyncPixelTransferState() {}
+ virtual ~AsyncPixelTransferState() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferState);
+};
+
+struct AsyncTexImage2DParams {
+ GLenum target;
+ GLint level;
+ GLenum internal_format;
+ GLsizei width;
+ GLsizei height;
+ GLint border;
+ GLenum format;
+ GLenum type;
+};
+
+struct AsyncTexSubImage2DParams {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint yoffset;
+ GLsizei width;
+ GLsizei height;
+ GLenum format;
+ GLenum type;
+};
+
+struct AsyncMemoryParams {
+ base::SharedMemory* shared_memory;
+ uint32 shm_size;
+ uint32 shm_data_offset;
+ uint32 shm_data_size;
+};
+
+class GL_EXPORT AsyncPixelTransferDelegate {
+ public:
+ static scoped_ptr<AsyncPixelTransferDelegate> Create();
+ virtual ~AsyncPixelTransferDelegate() {}
+
+ virtual scoped_refptr<AsyncPixelTransferState>
+ CreatePixelTransferState(GLuint texture) = 0;
+
+ virtual void AsyncNotifyCompletion(
+ const base::Closure& notify_task) = 0;
+
+ virtual void AsyncTexImage2D(
+ AsyncPixelTransferState*,
greggman 2012/12/12 03:51:36 style: google style requires argument names.
epennerAtGoogle 2012/12/12 04:49:49 Done.
+ 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.
+ AsyncMemoryParams) = 0;
+
+ virtual void AsyncTexSubImage2D(
+ AsyncPixelTransferState*,
greggman 2012/12/12 03:51:36 style: google style requires argument names.
epennerAtGoogle 2012/12/12 04:49:49 Done.
+ 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.
+ AsyncMemoryParams) = 0;
+
+ protected:
+ AsyncPixelTransferDelegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegate);
+};
+
+} // namespace gfx
+
+#endif // UI_GL_ASYNC_TASK_DELEGATE_H_
+

Powered by Google App Engine
This is Rietveld 408576698