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.
This commit is contained in:
José Fonseca
2009-01-06 16:45:12 +00:00
parent a40ad7ded4
commit 5da0401398
6 changed files with 35 additions and 25 deletions
+16 -1
View File
@@ -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;
}
+6 -19
View File
@@ -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;
}
+2
View File
@@ -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];
+1 -1
View File
@@ -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 );
@@ -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;
}
+7 -1
View File
@@ -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 */