summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-01-06 16:45:12 +0000
committerJosé Fonseca <[email protected]>2009-01-06 18:23:17 +0000
commit5da0401398239a2b445e11945144d073d77f0f03 (patch)
treef27d6b2e9b60f4548a51b2e35c04e7a607601560 /src
parenta40ad7ded44e8331ccd9a6d477a2f1716baf6d16 (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.
Diffstat (limited to 'src')
-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 cb74b54742a..e981b4c5cd3 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 52907f1a792..e2a17d83ac6 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 49f79ac9c70..e2020bf0554 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 d087b63507c..0c13c6b68ab 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 794259123a1..bd86501ac04 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 e61f65f70e1..8557327ccdd 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 */