Commit f6cd5dec by Nicolas Capens Committed by Nicolas Capens

Eliminate the destroyContext() dependency.

BUG=18110152 Change-Id: I288dca5fa10e6c53e02089f9c618fe2e44889493 Reviewed-on: https://swiftshader-review.googlesource.com/1239Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent b4db6295
......@@ -430,7 +430,7 @@ void Display::destroySurface(egl::Surface *surface)
void Display::destroyContext(gl::Context *context)
{
gl::destroyContext(context);
context->destroy();
mContextSet.erase(context);
}
......
......@@ -90,7 +90,6 @@ CONSTRUCTOR static bool eglAttachProcess()
libGLESv2 = loadLibrary(libGLESv2_lib);
gl::createDevice = (gl::Device*(*)())getProcAddress(libGLESv2, "createDevice");
gl::createContext = (gl::Context *(*)(const egl::Config*, const gl::Context*))getProcAddress(libGLESv2, "glCreateContext");
gl::destroyContext = (void (*)(gl::Context*))getProcAddress(libGLESv2, "glDestroyContext");
gl::makeCurrent = (void (*)(gl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent");
gl::getCurrentContext = (gl::Context *(*)())getProcAddress(libGLESv2, "glGetCurrentContext");
gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");
......@@ -249,7 +248,6 @@ namespace gl
{
Device *(*createDevice)() = 0;
Context *(*createContext)(const egl::Config *config, const Context *shareContext) = 0;
void (*destroyContext)(Context *context) = 0;
void (*bindTexImage)(egl::Surface *surface) = 0;
void (*makeCurrent)(Context *context, egl::Display *display, egl::Surface *surface) = 0;
Context *(*getCurrentContext)() = 0;
......
......@@ -84,7 +84,6 @@ namespace gl
extern Device *(*createDevice)();
extern Context *(*createContext)(const egl::Config *config, const Context *shareContext);
extern void (*destroyContext)(Context *context);
extern void (*bindTexImage)(egl::Surface *surface);
extern void (*makeCurrent)(Context *context, egl::Display *display, egl::Surface *surface);
extern Context *(*getCurrentContext)();
......
......@@ -167,6 +167,16 @@ Context::~Context()
mResourceManager->release();
}
void Context::destroy()
{
if(this == gl::getContext())
{
gl::makeCurrent(NULL, NULL, NULL);
}
delete this;
}
void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
{
Device *device = display->getDevice();
......@@ -2217,16 +2227,6 @@ extern "C"
return new gl::Context(config, shareContext);
}
void glDestroyContext(gl::Context *context)
{
delete context;
if(context == gl::getContext())
{
gl::makeCurrent(NULL, NULL, NULL);
}
}
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface)
{
gl::makeCurrent(context, display, surface);
......
......@@ -219,10 +219,10 @@ struct State
class Context
{
public:
public:
Context(const egl::Config *config, const Context *shareContext);
virtual ~Context();
virtual void destroy();
void makeCurrent(egl::Display *display, egl::Surface *surface);
......@@ -366,7 +366,9 @@ class Context
static int getSupportedMultiSampleDepth(sw::Format format, int requested);
private:
private:
virtual ~Context();
bool applyRenderTarget();
void applyState(GLenum drawMode);
GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count);
......
......@@ -147,7 +147,6 @@ EXPORTS
; EGL dependencies
glCreateContext @144
glDestroyContext @145
glMakeCurrent @146
glGetCurrentContext @147
glGetProcAddress @148
......
......@@ -215,6 +215,16 @@ Context::~Context()
mResourceManager->release();
}
void Context::destroy()
{
if(this == gl::getContext())
{
gl::makeCurrent(NULL, NULL, NULL);
}
delete this;
}
void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
{
Device *device = display->getDevice();
......@@ -3030,16 +3040,6 @@ extern "C"
return new gl::Context(config, shareContext);
}
void glDestroyContext(gl::Context *context)
{
delete context;
if(context == gl::getContext())
{
gl::makeCurrent(NULL, NULL, NULL);
}
}
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface)
{
gl::makeCurrent(context, display, surface);
......
......@@ -237,10 +237,10 @@ struct State
class Context
{
public:
public:
Context(const egl::Config *config, const Context *shareContext);
virtual ~Context();
virtual void destroy();
void makeCurrent(egl::Display *display, egl::Surface *surface);
......@@ -418,7 +418,9 @@ class Context
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask);
private:
private:
virtual ~Context();
bool applyRenderTarget();
void applyState(GLenum drawMode);
GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count);
......
......@@ -170,7 +170,6 @@ EXPORTS
; EGL dependencies
glCreateContext @144
glDestroyContext @145
glMakeCurrent @146
glGetCurrentContext @147
glGetProcAddress @148
......
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