Commit e8cc4a64 by Jamie Madill Committed by Commit Bot

Surface: Don't use a BindingPointer for BindTexImage.

The BindingPointer pattern isn't necessary. Every time we delete a Texture we call ReleaseTexImage internally. There shouldn't be any time that we keep an orphaned Texture is Surface. This cleans up one place where we were using the ProxyContext. Bug: angleproject:2714 Change-Id: I3b0fd2125d02ea7545922ec6da7f487451bed871 Reviewed-on: https://chromium-review.googlesource.com/1128925 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent aa2126c4
......@@ -60,7 +60,7 @@ Surface::Surface(EGLint surfaceType,
mRenderBuffer(EGL_BACK_BUFFER),
mSwapBehavior(EGL_NONE),
mOrientation(0),
mTexture(),
mTexture(nullptr),
mColorFormat(config->renderTargetFormat),
mDSFormat(config->depthStencilFormat),
mInitState(gl::InitState::Initialized)
......@@ -123,7 +123,7 @@ Error Surface::destroyImpl(const Display *display)
mImplementation->destroy(display);
}
if (mTexture.get())
if (mTexture)
{
gl::Context *context = display->getProxyContext();
if (mImplementation)
......@@ -135,7 +135,7 @@ Error Surface::destroyImpl(const Display *display)
{
return Error(EGL_BAD_SURFACE);
}
mTexture.set(context, nullptr);
mTexture = nullptr;
}
SafeDelete(mImplementation);
......@@ -388,7 +388,7 @@ EGLint Surface::getHeight() const
Error Surface::bindTexImage(const gl::Context *context, gl::Texture *texture, EGLint buffer)
{
ASSERT(!mTexture.get());
ASSERT(!mTexture);
ANGLE_TRY(mImplementation->bindTexImage(context, texture, buffer));
auto glErr = texture->bindTexImageFromSurface(context, this);
......@@ -396,7 +396,7 @@ Error Surface::bindTexImage(const gl::Context *context, gl::Texture *texture, EG
{
return Error(EGL_BAD_SURFACE);
}
mTexture.set(context, texture);
mTexture = texture;
return NoError();
}
......@@ -407,13 +407,13 @@ Error Surface::releaseTexImage(const gl::Context *context, EGLint buffer)
ANGLE_TRY(mImplementation->releaseTexImage(context, buffer));
ASSERT(mTexture.get());
ASSERT(mTexture);
auto glErr = mTexture->releaseTexImageFromSurface(context);
if (glErr.isError())
{
return Error(EGL_BAD_SURFACE);
}
mTexture.set(context, nullptr);
mTexture = nullptr;
return NoError();
}
......@@ -425,8 +425,8 @@ Error Surface::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR
void Surface::releaseTexImageFromTexture(const gl::Context *context)
{
ASSERT(mTexture.get());
mTexture.set(context, nullptr);
ASSERT(mTexture);
mTexture = nullptr;
}
gl::Extents Surface::getAttachmentSize(const gl::ImageIndex & /*target*/) const
......
......@@ -106,7 +106,7 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
EGLint getVerticalResolution() const;
EGLenum getMultisampleResolve() const;
gl::Texture *getBoundTexture() const { return mTexture.get(); }
gl::Texture *getBoundTexture() const { return mTexture; }
EGLint isFixedSize() const;
......@@ -186,7 +186,9 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
EGLint mOrientation;
gl::BindingPointer<gl::Texture> mTexture;
// We don't use a binding pointer here. We don't ever want to own an orphaned texture. If a
// Texture is deleted the Surface is unbound in onDestroy.
gl::Texture *mTexture;
gl::Format mColorFormat;
gl::Format mDSFormat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment