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

Unified Diff: ui/gl/gl_image_egl.cc

Issue 198703002: Add GL_TEXTURE_EXTERNAL_OES as supported texture target for CHROMIUM_map_image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nvidia work-around patch in gl_image_egl for android_webview Created 6 years, 9 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_egl.h ('k') | ui/gl/gl_image_shm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_egl.cc
diff --git a/ui/gl/gl_image_egl.cc b/ui/gl/gl_image_egl.cc
index ddd2f6f5e29552cba3706e78fadae7d5951bbfb3..15b9fbf10c8f084ac023613db8208b511d9a6781 100644
--- a/ui/gl/gl_image_egl.cc
+++ b/ui/gl/gl_image_egl.cc
@@ -14,8 +14,8 @@ GLImageEGL::GLImageEGL(gfx::Size size)
size_(size),
release_after_use_(false),
in_use_(false),
- target_(0) {
-}
+ target_(0),
+ native_buffer_(0) {}
GLImageEGL::~GLImageEGL() {
Destroy();
@@ -23,16 +23,16 @@ GLImageEGL::~GLImageEGL() {
bool GLImageEGL::Initialize(gfx::GpuMemoryBufferHandle buffer) {
DCHECK(buffer.native_buffer);
+ native_buffer_ = buffer.native_buffer;
reveman 2014/03/19 18:17:30 are you sure buffer.native_buffer is a valid point
EGLint attrs[] = {
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
EGL_NONE,
};
- egl_image_ = eglCreateImageKHR(
- GLSurfaceEGL::GetHardwareDisplay(),
- EGL_NO_CONTEXT,
- EGL_NATIVE_BUFFER_ANDROID,
- buffer.native_buffer,
- attrs);
+ egl_image_ = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(),
+ EGL_NO_CONTEXT,
+ EGL_NATIVE_BUFFER_ANDROID,
+ native_buffer_,
+ attrs);
if (egl_image_ == EGL_NO_IMAGE_KHR) {
EGLint error = eglGetError();
@@ -108,16 +108,22 @@ void GLImageEGL::DidUseTexImage() {
if (!release_after_use_)
return;
- char zero[4] = { 0, };
- glTexImage2D(target_,
- 0,
- GL_RGBA,
- 1,
- 1,
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- &zero);
+ EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE, };
+ EGLImageKHR egl_image = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(),
+ EGL_NO_CONTEXT,
+ EGL_NATIVE_BUFFER_ANDROID,
+ native_buffer_,
+ attrs);
+ DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image)
+ << "Error creating EGLImage: " << eglGetError();
+ glEGLImageTargetTexture2DOES(target_, egl_image);
reveman 2014/03/19 18:17:30 I don't understand why this would work. Binding th
+ DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+ EGLBoolean status =
+ eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(), egl_image);
boliu 2014/03/20 10:57:29 Currently this destroy fails.
+ if (status == EGL_FALSE) {
+ EGLint error = eglGetError();
+ LOG(ERROR) << "Error destroying EGLImage: " << error;
+ }
}
void GLImageEGL::WillModifyTexImage() {
« no previous file with comments | « ui/gl/gl_image_egl.h ('k') | ui/gl/gl_image_shm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698