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

Side by Side Diff: ui/gl/gl_image_egl.cc

Issue 66033009: [Android] Add workaround to unbind gpu memory buffer only on NVIDIA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update a more comments Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_image_egl.h" 5 #include "ui/gl/gl_image_egl.h"
6 6
7 #include "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_surface_egl.h" 8 #include "ui/gl/gl_surface_egl.h"
9 9
10 namespace gfx { 10 namespace gfx {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Defer ImageTargetTexture2D if not currently in use. 69 // Defer ImageTargetTexture2D if not currently in use.
70 if (!in_use_) 70 if (!in_use_)
71 return true; 71 return true;
72 72
73 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); 73 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_);
74 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 74 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
75 return true; 75 return true;
76 } 76 }
77 77
78 void GLImageEGL::ReleaseTexImage() { 78 void GLImageEGL::ReleaseTexImage() {
79 // Nothing to do here as image is released after each use. 79 // Nothing to do here as image is released after each use or there is no need
80 // to release tex image.
80 } 81 }
81 82
82 void GLImageEGL::WillUseTexImage() { 83 void GLImageEGL::WillUseTexImage() {
83 DCHECK(egl_image_); 84 DCHECK(egl_image_);
84 DCHECK(!in_use_); 85 DCHECK(!in_use_);
85 in_use_ = true; 86 in_use_ = true;
86 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); 87 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_);
87 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 88 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
88 } 89 }
89 90
90 void GLImageEGL::DidUseTexImage() { 91 void GLImageEGL::DidUseTexImage(bool release_tex_image) {
91 DCHECK(in_use_); 92 DCHECK(in_use_);
92 in_use_ = false; 93 in_use_ = false;
94
95 if (!release_tex_image)
96 return;
97
93 char zero[4] = { 0, }; 98 char zero[4] = { 0, };
94 glTexImage2D(GL_TEXTURE_2D, 99 glTexImage2D(GL_TEXTURE_2D,
95 0, 100 0,
96 GL_RGBA, 101 GL_RGBA,
97 1, 102 1,
98 1, 103 1,
99 0, 104 0,
100 GL_RGBA, 105 GL_RGBA,
101 GL_UNSIGNED_BYTE, 106 GL_UNSIGNED_BYTE,
102 &zero); 107 &zero);
103 } 108 }
104 109
105 } // namespace gfx 110 } // namespace gfx
OLDNEW
« ui/gl/gl_image.h ('K') | « ui/gl/gl_image_egl.h ('k') | ui/gl/gl_image_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698