summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl/shared/stw_device.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-03-20 13:05:51 +0100
committerMichal Krol <michal@vmware.com>2009-03-20 13:05:51 +0100
commit4489f9efee58f2cba374298f2d43c96e5cd2ff41 (patch)
treedf078f476ce7aab2f0e46dba5b8938c69314a4c9 /src/gallium/state_trackers/wgl/shared/stw_device.c
parent3d4246e22e90ffef5fe0cd935bd54c7f862e82f7 (diff)
stw: Keep per-thread storage for current context and pixel format.
Diffstat (limited to 'src/gallium/state_trackers/wgl/shared/stw_device.c')
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c
index 0dca856d73..4bec036fe3 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_device.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_device.c
@@ -35,6 +35,7 @@
#include "shared/stw_winsys.h"
#include "shared/stw_pixelformat.h"
#include "shared/stw_public.h"
+#include "shared/stw_tls.h"
#ifdef WIN32_THREADS
extern _glthread_Mutex OneTimeLock;
@@ -70,6 +71,8 @@ st_init(const struct stw_winsys *stw_winsys)
assert(!stw_dev);
+ stw_tls_init();
+
stw_dev = &stw_dev_storage;
memset(stw_dev, 0, sizeof(*stw_dev));
@@ -101,6 +104,24 @@ error1:
}
+boolean
+st_init_thread(void)
+{
+ if (!stw_tls_init_thread()) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+void
+st_cleanup_thread(void)
+{
+ stw_tls_cleanup_thread();
+}
+
+
void
st_cleanup(void)
{
@@ -133,6 +154,8 @@ st_cleanup(void)
debug_memory_end(stw_dev->memdbg_no);
#endif
+ stw_tls_cleanup();
+
stw_dev = NULL;
}