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

Unified Diff: ui/gl/gl_image_memory.cc

Issue 2443023002: gpu: Add CHROMIUM_copy_image extension.
Patch Set: rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_memory.cc
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc
index f99dce59fdbfe0dbf0bcb2f85a6c2e67ddc3892a..6c18247505910c00598e9575b69861f5bdedab98 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -12,7 +12,9 @@
#include "ui/gfx/buffer_format_util.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
+#include "ui/gl/gl_fence.h"
#include "ui/gl/gl_version_info.h"
+#include "ui/gl/scoped_binders.h"
using gfx::BufferFormat;
@@ -488,6 +490,35 @@ bool GLImageMemory::CopyTexSubImage(unsigned target,
return true;
}
+bool GLImageMemory::CopySubImageData(unsigned texture_id,
+ const gfx::Point& offset,
+ const gfx::Rect& rect,
+ GLFence* in_fence,
+ GLFence* out_fence) {
+ TRACE_EVENT2("gpu", "GLImageMemory::CopySubImageData", "width", rect.width(),
+ "height", rect.height());
+
+ // Output fence must have support for client side signaling.
+ if (out_fence && !out_fence->SignalSupported())
+ return false;
+
+ if (in_fence)
+ in_fence->ClientWait();
+
+ {
+ ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id);
+
+ bool rv = CopyTexSubImage(GL_TEXTURE_2D, offset, rect);
+ if (!rv)
+ return false;
+ }
+
+ if (out_fence)
+ out_fence->Signal();
+
+ return true;
+}
+
bool GLImageMemory::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
int z_order,
gfx::OverlayTransform transform,
« no previous file with comments | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698