OSDN Git Service

Fix libGL build.
authorNicolas Capens <capn@google.com>
Thu, 14 Sep 2017 15:11:07 +0000 (11:11 -0400)
committerNicolas Capens <nicolascapens@google.com>
Thu, 14 Sep 2017 19:38:56 +0000 (19:38 +0000)
This does not fix the OGLSimpleCube sample. See swiftshader:81.

Change-Id: I4bb5755d8b63f234965c3d12f774706968f2d34e
Reviewed-on: https://swiftshader-review.googlesource.com/12088
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/libGL/main.cpp

index 6a6e3da..5533321 100644 (file)
@@ -36,12 +36,10 @@ static void glAttachThread()
 {
        TRACE("()");
 
-       gl::Current *current = new gl::Current;
+       gl::Current *current = (gl::Current*)sw::Thread::allocateLocalStorage(currentTLS, sizeof(gl::Current));
 
        if(current)
        {
-               sw::Thread::setLocalStorage(currentTLS, current);
-
                current->context = nullptr;
                current->display = nullptr;
                current->drawSurface = nullptr;
@@ -55,8 +53,7 @@ static void glDetachThread()
 
        wglMakeCurrent(NULL, NULL);
 
-       delete (gl::Current*)sw::Thread::getLocalStorage(currentTLS);
-       sw::Thread::setLocalStorage(currentTLS, nullptr);
+       sw::Thread::freeLocalStorage(currentTLS);
 }
 
 CONSTRUCTOR static bool glAttachProcess()