Commit 192a1810 by apatrick@chromium.org

Implemented semantics for eglDestroySurface when surface is current on thread.

The spec has this to say. " All resources associated with surface which were allocated by EGL are marked for deletion as soon as possible. If surface is current to any thread (see section 3.7.3), resources are not actually released while the surface remains current. Future references to surface remain valid only so long as it is current; it will be destroyed, and all future references to it will become invalid, as soon as any otherwise valid eglMakeCurrent call is made from the thread it is bound to." Review URL: http://codereview.appspot.com/4449064 git-svn-id: https://angleproject.googlecode.com/svn/trunk@632 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent e2f954cd
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 629
#define BUILD_REVISION 632
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -589,8 +589,15 @@ EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *sha
void Display::destroySurface(egl::Surface *surface)
{
delete surface;
mSurfaceSet.erase(surface);
if (surface == egl::getCurrentDrawSurface() || surface == egl::getCurrentReadSurface())
{
surface->setPendingDestroy();
}
else
{
delete surface;
mSurfaceSet.erase(surface);
}
}
void Display::destroyContext(gl::Context *context)
......@@ -624,7 +631,7 @@ bool Display::isValidContext(gl::Context *context)
bool Display::isValidSurface(egl::Surface *surface)
{
return mSurfaceSet.find(surface) != mSurfaceSet.end();
return mSurfaceSet.find(surface) != mSurfaceSet.end() && !surface->isPendingDestroy();
}
bool Display::hasExistingWindowSurface(HWND window)
......
......@@ -38,6 +38,8 @@ Surface::Surface(Display *display, const Config *config, HWND window)
mSwapInterval = -1;
setSwapInterval(1);
mIsPendingDestroy = false;
subclassWindow();
resetSwapChain();
}
......@@ -61,6 +63,8 @@ Surface::Surface(Display *display, const Config *config, EGLint width, EGLint he
mSwapInterval = -1;
setSwapInterval(1);
mIsPendingDestroy = false;
resetSwapChain(width, height);
}
......@@ -412,4 +416,13 @@ D3DFORMAT Surface::getFormat() const
{
return mConfig->mRenderTargetFormat;
}
void Surface::setPendingDestroy() {
mIsPendingDestroy = true;
}
bool Surface::isPendingDestroy() const {
return mIsPendingDestroy;
}
}
......@@ -60,6 +60,9 @@ class Surface
virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const;
void setPendingDestroy();
bool isPendingDestroy() const;
private:
DISALLOW_COPY_AND_ASSIGN(Surface);
......@@ -70,6 +73,7 @@ private:
IDirect3DTexture9* mOffscreenTexture;
HANDLE mShareHandle;
bool mIsPendingDestroy;
void subclassWindow();
void unsubclassWindow();
......
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