Commit 393e2f94 by Nicolas Capens Committed by Nicolas Capens

Create a renderer device per GL context.

Bug 18572955 Change-Id: I5c05ab7e0bae3581600ab4fcaba7c499fb5987a7 Reviewed-on: https://swiftshader-review.googlesource.com/1521Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent f4fea7f5
...@@ -35,15 +35,14 @@ ...@@ -35,15 +35,14 @@
namespace es1 namespace es1
{ {
Device *Context::device = 0;
Context::Context(const egl::Config *config, const Context *shareContext) Context::Context(const egl::Config *config, const Context *shareContext)
: modelViewStack(MAX_MODELVIEW_STACK_DEPTH), : modelViewStack(MAX_MODELVIEW_STACK_DEPTH),
projectionStack(MAX_PROJECTION_STACK_DEPTH), projectionStack(MAX_PROJECTION_STACK_DEPTH),
textureStack0(MAX_TEXTURE_STACK_DEPTH), textureStack0(MAX_TEXTURE_STACK_DEPTH),
textureStack1(MAX_TEXTURE_STACK_DEPTH) textureStack1(MAX_TEXTURE_STACK_DEPTH)
{ {
device = getDevice(); sw::Context *context = new sw::Context();
device = new es1::Device(context);
mVertexDataManager = new VertexDataManager(this); mVertexDataManager = new VertexDataManager(this);
mIndexDataManager = new IndexDataManager(); mIndexDataManager = new IndexDataManager();
...@@ -210,6 +209,7 @@ Context::~Context() ...@@ -210,6 +209,7 @@ Context::~Context()
delete mIndexDataManager; delete mIndexDataManager;
mResourceManager->release(); mResourceManager->release();
delete device;
} }
void Context::makeCurrent(egl::Surface *surface) void Context::makeCurrent(egl::Surface *surface)
...@@ -2464,12 +2464,6 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu ...@@ -2464,12 +2464,6 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu
Device *Context::getDevice() Device *Context::getDevice()
{ {
if(!device)
{
sw::Context *context = new sw::Context();
device = new es1::Device(context);
}
return device; return device;
} }
......
...@@ -502,9 +502,8 @@ private: ...@@ -502,9 +502,8 @@ private:
bool texture2D; bool texture2D;
GLenum clientTexture; GLenum clientTexture;
Device *device;
ResourceManager *mResourceManager; ResourceManager *mResourceManager;
static Device *device;
}; };
} }
......
...@@ -39,11 +39,10 @@ ...@@ -39,11 +39,10 @@
namespace es2 namespace es2
{ {
Device *Context::device = 0;
Context::Context(const egl::Config *config, const Context *shareContext) : mConfig(config) Context::Context(const egl::Config *config, const Context *shareContext) : mConfig(config)
{ {
device = getDevice(); sw::Context *context = new sw::Context();
device = new es2::Device(context);
mFenceHandleAllocator.setBaseHandle(0); mFenceHandleAllocator.setBaseHandle(0);
...@@ -220,6 +219,7 @@ Context::~Context() ...@@ -220,6 +219,7 @@ Context::~Context()
delete mIndexDataManager; delete mIndexDataManager;
mResourceManager->release(); mResourceManager->release();
delete device;
} }
void Context::makeCurrent(egl::Surface *surface) void Context::makeCurrent(egl::Surface *surface)
...@@ -3133,12 +3133,6 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu ...@@ -3133,12 +3133,6 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu
Device *Context::getDevice() Device *Context::getDevice()
{ {
if(!device)
{
sw::Context *context = new sw::Context();
device = new es2::Device(context);
}
return device; return device;
} }
......
...@@ -491,9 +491,8 @@ private: ...@@ -491,9 +491,8 @@ private:
bool mFrontFaceDirty; bool mFrontFaceDirty;
bool mDitherStateDirty; bool mDitherStateDirty;
Device *device;
ResourceManager *mResourceManager; ResourceManager *mResourceManager;
static Device *device;
}; };
} }
......
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