diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-21 14:08:31 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-21 14:08:31 +0000 |
commit | d38a7d243bca58af1378f5f4d25253f596f4c4fd (patch) | |
tree | a3f2ad43ea98d37d8e3a99ecee8ef879fb595bd6 /ui/gl | |
parent | 1eaf2ac412f01daefd178ce9a2fbf3be555b6797 (diff) | |
download | chromium_src-d38a7d243bca58af1378f5f4d25253f596f4c4fd.zip chromium_src-d38a7d243bca58af1378f5f4d25253f596f4c4fd.tar.gz chromium_src-d38a7d243bca58af1378f5f4d25253f596f4c4fd.tar.bz2 |
Revert 229532 "gpu: Add Will/DidUseTexImage to GLImage API."
This is causing webgl_conformance_tests to fail.
> gpu: Add Will/DidUseTexImage to GLImage API.
>
> WillUseTexImage/DidUseTexImage is called before/after the image is
> used for sampling. The result is that the client only has to call
> bind/releaseTexImage2D when contents have changed, which allows
> for more efficient GLImage implementations as work required before
> use can be separated from work required when contents have changed.
>
> BUG=261649
> TEST=gpu_unittests --gtest_filter=SharedTextureTest.Images && gpu_unittests --gtest_filter=GLES2DecoderWithShaderTest.UseTexImage && cc_unittests --gtest_filter=ResourceProviderTests/ResourceProviderTest.Image_GLTexture* && gl_tests --gtest_filter=MockGpuMemoryBufferTest.Lifecycle
>
> Review URL: https://codereview.chromium.org/23129010
TBR=reveman@chromium.org
Review URL: https://codereview.chromium.org/32603002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rw-r--r-- | ui/gl/gl_image.cc | 8 | ||||
-rw-r--r-- | ui/gl/gl_image.h | 6 | ||||
-rw-r--r-- | ui/gl/gl_image_egl.cc | 55 | ||||
-rw-r--r-- | ui/gl/gl_image_egl.h | 3 | ||||
-rw-r--r-- | ui/gl/gl_image_glx.cc | 10 | ||||
-rw-r--r-- | ui/gl/gl_image_glx.h | 2 | ||||
-rw-r--r-- | ui/gl/gl_image_shm.cc | 14 | ||||
-rw-r--r-- | ui/gl/gl_image_shm.h | 2 | ||||
-rw-r--r-- | ui/gl/gl_image_stub.cc | 13 | ||||
-rw-r--r-- | ui/gl/gl_image_stub.h | 4 |
10 files changed, 27 insertions, 90 deletions
diff --git a/ui/gl/gl_image.cc b/ui/gl/gl_image.cc index ff7eb56..aaefb94 100644 --- a/ui/gl/gl_image.cc +++ b/ui/gl/gl_image.cc @@ -19,14 +19,6 @@ void GLImage::ReleaseTexImage() { NOTIMPLEMENTED(); } -void GLImage::WillUseTexImage() { - NOTIMPLEMENTED(); -} - -void GLImage::DidUseTexImage() { - NOTIMPLEMENTED(); -} - GLImage::~GLImage() {} } // namespace gfx diff --git a/ui/gl/gl_image.h b/ui/gl/gl_image.h index 859966c..8d59bc4 100644 --- a/ui/gl/gl_image.h +++ b/ui/gl/gl_image.h @@ -33,12 +33,6 @@ class GL_EXPORT GLImage : public base::RefCounted<GLImage> { // Release image from texture currently bound to GL_TEXTURE_2D target. virtual void ReleaseTexImage(); - // Called before the texture is used for drawing. - virtual void WillUseTexImage(); - - // Called after the texture has been used for drawing. - virtual void DidUseTexImage(); - // Create a GL image for a window. static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window); diff --git a/ui/gl/gl_image_egl.cc b/ui/gl/gl_image_egl.cc index aeafc9a..182117c 100644 --- a/ui/gl/gl_image_egl.cc +++ b/ui/gl/gl_image_egl.cc @@ -11,8 +11,7 @@ namespace gfx { GLImageEGL::GLImageEGL(gfx::Size size) : egl_image_(EGL_NO_IMAGE_KHR), - size_(size), - in_use_(false) { + size_(size) { } GLImageEGL::~GLImageEGL() { @@ -41,6 +40,25 @@ bool GLImageEGL::Initialize(gfx::GpuMemoryBufferHandle buffer) { return true; } +bool GLImageEGL::BindTexImage() { + if (egl_image_ == EGL_NO_IMAGE_KHR) { + LOG(ERROR) << "NULL EGLImage in BindTexImage"; + return false; + } + + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); + + if (glGetError() != GL_NO_ERROR) { + return false; + } + + return true; +} + +gfx::Size GLImageEGL::GetSize() { + return size_; +} + void GLImageEGL::Destroy() { if (egl_image_ == EGL_NO_IMAGE_KHR) return; @@ -56,40 +74,7 @@ void GLImageEGL::Destroy() { egl_image_ = EGL_NO_IMAGE_KHR; } -gfx::Size GLImageEGL::GetSize() { - return size_; -} - -bool GLImageEGL::BindTexImage() { - if (egl_image_ == EGL_NO_IMAGE_KHR) { - LOG(ERROR) << "NULL EGLImage in BindTexImage"; - return false; - } - - // Defer ImageTargetTexture2D if not currently in use. - if (!in_use_) - return true; - - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); - DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); - return true; -} - void GLImageEGL::ReleaseTexImage() { - // Nothing to do here as image is released after each use. -} - -void GLImageEGL::WillUseTexImage() { - DCHECK(egl_image_); - DCHECK(!in_use_); - in_use_ = true; - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); - DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); -} - -void GLImageEGL::DidUseTexImage() { - DCHECK(in_use_); - in_use_ = false; char zero[4] = { 0, }; glTexImage2D(GL_TEXTURE_2D, 0, diff --git a/ui/gl/gl_image_egl.h b/ui/gl/gl_image_egl.h index 2c64f4d..1c66bb9 100644 --- a/ui/gl/gl_image_egl.h +++ b/ui/gl/gl_image_egl.h @@ -21,8 +21,6 @@ class GL_EXPORT GLImageEGL : public GLImage { virtual gfx::Size GetSize() OVERRIDE; virtual bool BindTexImage() OVERRIDE; virtual void ReleaseTexImage() OVERRIDE; - virtual void WillUseTexImage() OVERRIDE; - virtual void DidUseTexImage() OVERRIDE; protected: virtual ~GLImageEGL(); @@ -30,7 +28,6 @@ class GL_EXPORT GLImageEGL : public GLImage { private: EGLImageKHR egl_image_; gfx::Size size_; - bool in_use_; DISALLOW_COPY_AND_ASSIGN(GLImageEGL); }; diff --git a/ui/gl/gl_image_glx.cc b/ui/gl/gl_image_glx.cc index 739b4d4..85254f3 100644 --- a/ui/gl/gl_image_glx.cc +++ b/ui/gl/gl_image_glx.cc @@ -52,10 +52,6 @@ GLImageGLX::GLImageGLX(gfx::PluginWindowHandle window) glx_pixmap_(0) { } -GLImageGLX::~GLImageGLX() { - Destroy(); -} - bool GLImageGLX::Initialize() { if (!GLSurfaceGLX::IsTextureFromPixmapSupported()) { LOG(ERROR) << "GLX_EXT_texture_from_pixmap not supported."; @@ -174,10 +170,8 @@ void GLImageGLX::ReleaseTexImage() { glXReleaseTexImageEXT(display_, glx_pixmap_, GLX_FRONT_LEFT_EXT); } -void GLImageGLX::WillUseTexImage() { -} - -void GLImageGLX::DidUseTexImage() { +GLImageGLX::~GLImageGLX() { + Destroy(); } } // namespace gfx diff --git a/ui/gl/gl_image_glx.h b/ui/gl/gl_image_glx.h index e1b9b4f..bbdaa30 100644 --- a/ui/gl/gl_image_glx.h +++ b/ui/gl/gl_image_glx.h @@ -23,8 +23,6 @@ class GL_EXPORT GLImageGLX : public GLImage { virtual gfx::Size GetSize() OVERRIDE; virtual bool BindTexImage() OVERRIDE; virtual void ReleaseTexImage() OVERRIDE; - virtual void WillUseTexImage() OVERRIDE; - virtual void DidUseTexImage() OVERRIDE; protected: virtual ~GLImageGLX(); diff --git a/ui/gl/gl_image_shm.cc b/ui/gl/gl_image_shm.cc index 5b182eb..78e8164 100644 --- a/ui/gl/gl_image_shm.cc +++ b/ui/gl/gl_image_shm.cc @@ -40,13 +40,6 @@ bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { return true; } -void GLImageShm::Destroy() { -} - -gfx::Size GLImageShm::GetSize() { - return size_; -} - bool GLImageShm::BindTexImage() { TRACE_EVENT0("gpu", "GLImageShm::BindTexImage"); DCHECK(shared_memory_); @@ -89,13 +82,14 @@ bool GLImageShm::BindTexImage() { return true; } -void GLImageShm::ReleaseTexImage() { +gfx::Size GLImageShm::GetSize() { + return size_; } -void GLImageShm::WillUseTexImage() { +void GLImageShm::Destroy() { } -void GLImageShm::DidUseTexImage() { +void GLImageShm::ReleaseTexImage() { } } // namespace gfx diff --git a/ui/gl/gl_image_shm.h b/ui/gl/gl_image_shm.h index d18938d..ffdfc8b 100644 --- a/ui/gl/gl_image_shm.h +++ b/ui/gl/gl_image_shm.h @@ -21,8 +21,6 @@ class GL_EXPORT GLImageShm : public GLImage { virtual gfx::Size GetSize() OVERRIDE; virtual bool BindTexImage() OVERRIDE; virtual void ReleaseTexImage() OVERRIDE; - virtual void WillUseTexImage() OVERRIDE; - virtual void DidUseTexImage() OVERRIDE; protected: virtual ~GLImageShm(); diff --git a/ui/gl/gl_image_stub.cc b/ui/gl/gl_image_stub.cc index a1a8a85..86efe6e 100644 --- a/ui/gl/gl_image_stub.cc +++ b/ui/gl/gl_image_stub.cc @@ -6,13 +6,6 @@ namespace gfx { -GLImageStub::GLImageStub() { -} - -GLImageStub::~GLImageStub() { - Destroy(); -} - void GLImageStub::Destroy() { } @@ -27,10 +20,6 @@ bool GLImageStub::BindTexImage() { void GLImageStub::ReleaseTexImage() { } -void GLImageStub::WillUseTexImage() { -} - -void GLImageStub::DidUseTexImage() { -} +GLImageStub::~GLImageStub() {} } // namespace gfx diff --git a/ui/gl/gl_image_stub.h b/ui/gl/gl_image_stub.h index ec232fa..8b47358 100644 --- a/ui/gl/gl_image_stub.h +++ b/ui/gl/gl_image_stub.h @@ -12,15 +12,11 @@ namespace gfx { // A GLImage that does nothing for unit tests. class GL_EXPORT GLImageStub : public GLImage { public: - GLImageStub(); - // Implement GLImage. virtual void Destroy() OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; virtual bool BindTexImage() OVERRIDE; virtual void ReleaseTexImage() OVERRIDE; - virtual void WillUseTexImage() OVERRIDE; - virtual void DidUseTexImage() OVERRIDE; protected: virtual ~GLImageStub(); |