Revert pending surface destruction (part of revision 632).

TRAC #16271 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@656 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 062231c0
#define MAJOR_VERSION 0 #define MAJOR_VERSION 0
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 655 #define BUILD_REVISION 656
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -603,15 +603,8 @@ EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *sha ...@@ -603,15 +603,8 @@ EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *sha
void Display::destroySurface(egl::Surface *surface) void Display::destroySurface(egl::Surface *surface)
{ {
if (surface == egl::getCurrentDrawSurface() || surface == egl::getCurrentReadSurface()) delete surface;
{ mSurfaceSet.erase(surface);
surface->setPendingDestroy();
}
else
{
delete surface;
mSurfaceSet.erase(surface);
}
} }
void Display::destroyContext(gl::Context *context) void Display::destroyContext(gl::Context *context)
...@@ -645,7 +638,7 @@ bool Display::isValidContext(gl::Context *context) ...@@ -645,7 +638,7 @@ bool Display::isValidContext(gl::Context *context)
bool Display::isValidSurface(egl::Surface *surface) bool Display::isValidSurface(egl::Surface *surface)
{ {
return mSurfaceSet.find(surface) != mSurfaceSet.end() && !surface->isPendingDestroy(); return mSurfaceSet.find(surface) != mSurfaceSet.end();
} }
bool Display::hasExistingWindowSurface(HWND window) bool Display::hasExistingWindowSurface(HWND window)
......
...@@ -38,8 +38,6 @@ Surface::Surface(Display *display, const Config *config, HWND window) ...@@ -38,8 +38,6 @@ Surface::Surface(Display *display, const Config *config, HWND window)
mSwapInterval = -1; mSwapInterval = -1;
setSwapInterval(1); setSwapInterval(1);
mIsPendingDestroy = false;
subclassWindow(); subclassWindow();
} }
...@@ -60,8 +58,6 @@ Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGL ...@@ -60,8 +58,6 @@ Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGL
mSwapBehavior = EGL_BUFFER_PRESERVED; mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1; mSwapInterval = -1;
setSwapInterval(1); setSwapInterval(1);
mIsPendingDestroy = false;
} }
Surface::~Surface() Surface::~Surface()
...@@ -324,7 +320,6 @@ DWORD Surface::convertInterval(EGLint interval) ...@@ -324,7 +320,6 @@ DWORD Surface::convertInterval(EGLint interval)
return D3DPRESENT_INTERVAL_DEFAULT; return D3DPRESENT_INTERVAL_DEFAULT;
} }
bool Surface::swap() bool Surface::swap()
{ {
if (mSwapChain) if (mSwapChain)
...@@ -430,13 +425,4 @@ D3DFORMAT Surface::getFormat() const ...@@ -430,13 +425,4 @@ D3DFORMAT Surface::getFormat() const
{ {
return mConfig->mRenderTargetFormat; return mConfig->mRenderTargetFormat;
} }
void Surface::setPendingDestroy() {
mIsPendingDestroy = true;
}
bool Surface::isPendingDestroy() const {
return mIsPendingDestroy;
}
} }
...@@ -61,9 +61,6 @@ class Surface ...@@ -61,9 +61,6 @@ class Surface
virtual void setBoundTexture(gl::Texture2D *texture); virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const; virtual gl::Texture2D *getBoundTexture() const;
void setPendingDestroy();
bool isPendingDestroy() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(Surface); DISALLOW_COPY_AND_ASSIGN(Surface);
...@@ -74,7 +71,6 @@ private: ...@@ -74,7 +71,6 @@ private:
IDirect3DTexture9* mOffscreenTexture; IDirect3DTexture9* mOffscreenTexture;
HANDLE mShareHandle; HANDLE mShareHandle;
bool mIsPendingDestroy;
void subclassWindow(); void subclassWindow();
void unsubclassWindow(); void unsubclassWindow();
......
...@@ -936,18 +936,6 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface ...@@ -936,18 +936,6 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
glMakeCurrent(context, display, static_cast<egl::Surface*>(draw)); glMakeCurrent(context, display, static_cast<egl::Surface*>(draw));
// If the previous surfaces are still current, this might just flag
// them as pending destruction again, deferring destruction to a future
// eglMakeCurrent or eglTerminate call.
if (previousDraw && previousDraw->isPendingDestroy())
{
eglDestroySurface(dpy, previousDraw);
}
if (previousRead && previousRead != previousDraw && previousRead->isPendingDestroy())
{
eglDestroySurface(dpy, previousRead);
}
return success(EGL_TRUE); return success(EGL_TRUE);
} }
catch(std::bad_alloc&) catch(std::bad_alloc&)
......
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