summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-01-06 16:45:12 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-01-08 12:05:20 +0000
commit73d02d70b8c98c0e64e7816795565ed5f5bf3639 (patch)
tree42db029c54e48c2a8c183345a28cfb90b6081f18
parente59eb5fc969777ea9590af3710c3ec9373ce043b (diff)
wgl: Do not provide DllMain inside the state tracker.
MS CRT libraries already provide a default DllMain entrypoint, and MS Linker will complain if it finds the same symbol in two different libraries. Therefore the DllMain has to be in (each) winsys.
-rw-r--r--src/gallium/winsys/gdi/gdi_softpipe_winsys.c17
-rw-r--r--src/mesa/state_tracker/wgl/stw_device.c25
-rw-r--r--src/mesa/state_tracker/wgl/stw_device.h2
-rw-r--r--src/mesa/state_tracker/wgl/stw_wgl_context.c2
-rw-r--r--src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c6
-rw-r--r--src/mesa/state_tracker/wgl/stw_winsys.h8
6 files changed, 35 insertions, 25 deletions
diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
index cb74b54742..e981b4c5cd 100644
--- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
@@ -337,8 +337,23 @@ gdi_softpipe_flush_frontbuffer(struct pipe_winsys *winsys,
}
-const struct stw_winsys stw_winsys = {
+static const struct stw_winsys stw_winsys = {
&gdi_softpipe_screen_create,
&gdi_softpipe_context_create,
&gdi_softpipe_flush_frontbuffer
};
+
+
+BOOL WINAPI
+DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+{
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ return st_init(&stw_winsys);
+
+ case DLL_PROCESS_DETACH:
+ st_cleanup();
+ break;
+ }
+ return TRUE;
+} \ No newline at end of file
diff --git a/src/mesa/state_tracker/wgl/stw_device.c b/src/mesa/state_tracker/wgl/stw_device.c
index 52907f1a79..e2a17d83ac 100644
--- a/src/mesa/state_tracker/wgl/stw_device.c
+++ b/src/mesa/state_tracker/wgl/stw_device.c
@@ -37,8 +37,8 @@
struct stw_device *stw_dev = NULL;
-static BOOL
-st_init(void)
+boolean
+st_init(const struct stw_winsys *stw_winsys)
{
static struct stw_device stw_dev_storage;
@@ -47,7 +47,9 @@ st_init(void)
stw_dev = &stw_dev_storage;
memset(stw_dev, 0, sizeof(*stw_dev));
- stw_dev->screen = stw_winsys.create_screen();
+ stw_dev->stw_winsys = stw_winsys;
+
+ stw_dev->screen = stw_winsys->create_screen();
if(!stw_dev->screen)
goto error1;
@@ -61,7 +63,7 @@ error1:
}
-static void
+void
st_cleanup(void)
{
DHGLRC dhglrc;
@@ -76,18 +78,3 @@ st_cleanup(void)
stw_dev = NULL;
}
-
-
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- return st_init();
-
- case DLL_PROCESS_DETACH:
- st_cleanup();
- break;
- }
- return TRUE;
-}
diff --git a/src/mesa/state_tracker/wgl/stw_device.h b/src/mesa/state_tracker/wgl/stw_device.h
index 49f79ac9c7..e2020bf055 100644
--- a/src/mesa/state_tracker/wgl/stw_device.h
+++ b/src/mesa/state_tracker/wgl/stw_device.h
@@ -44,6 +44,8 @@ struct drv_context
struct stw_device
{
+ const struct stw_winsys *stw_winsys;
+
struct pipe_screen *screen;
struct drv_context ctx_array[DRV_CONTEXT_MAX];
diff --git a/src/mesa/state_tracker/wgl/stw_wgl_context.c b/src/mesa/state_tracker/wgl/stw_wgl_context.c
index d087b63507..0c13c6b68a 100644
--- a/src/mesa/state_tracker/wgl/stw_wgl_context.c
+++ b/src/mesa/state_tracker/wgl/stw_wgl_context.c
@@ -105,7 +105,7 @@ wglCreateContext(
return NULL;
}
- pipe = stw_winsys.create_context( stw_dev->screen );
+ pipe = stw_dev->stw_winsys->create_context( stw_dev->screen );
if (!pipe) {
_mesa_destroy_visual( visual );
FREE( ctx );
diff --git a/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c b/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c
index 794259123a..bd86501ac0 100644
--- a/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c
+++ b/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c
@@ -55,9 +55,9 @@ wglSwapBuffers(
surf = st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT );
- stw_winsys.flush_frontbuffer(stw_dev->screen->winsys,
- surf,
- hdc );
+ stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys,
+ surf,
+ hdc );
return TRUE;
}
diff --git a/src/mesa/state_tracker/wgl/stw_winsys.h b/src/mesa/state_tracker/wgl/stw_winsys.h
index e61f65f70e..8557327ccd 100644
--- a/src/mesa/state_tracker/wgl/stw_winsys.h
+++ b/src/mesa/state_tracker/wgl/stw_winsys.h
@@ -30,6 +30,8 @@
#include <windows.h> /* for HDC */
+#include "pipe/p_compiler.h"
+
struct pipe_screen;
struct pipe_context;
struct pipe_winsys;
@@ -49,6 +51,10 @@ struct stw_winsys
HDC hDC );
};
-extern const struct stw_winsys stw_winsys;
+boolean
+st_init(const struct stw_winsys *stw_winsys);
+
+void
+st_cleanup(void);
#endif /* STW_WINSYS_H */