}
-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
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;
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;
}
-static void
+void
st_cleanup(void)
{
DHGLRC dhglrc;
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;
-}
struct stw_device
{
+ const struct stw_winsys *stw_winsys;
+
struct pipe_screen *screen;
struct drv_context ctx_array[DRV_CONTEXT_MAX];
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 );
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;
}
#include <windows.h> /* for HDC */
+#include "pipe/p_compiler.h"
+
struct pipe_screen;
struct pipe_context;
struct pipe_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 */