summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl/stw_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/wgl/stw_device.c')
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index ea300f27cb..61b207525c 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -30,8 +30,8 @@
#include "glapi/glthread.h"
#include "util/u_debug.h"
#include "util/u_math.h"
+#include "util/u_memory.h"
#include "pipe/p_screen.h"
-#include "state_tracker/st_public.h"
#include "stw_device.h"
#include "stw_winsys.h"
@@ -39,6 +39,7 @@
#include "stw_icd.h"
#include "stw_tls.h"
#include "stw_framebuffer.h"
+#include "stw_st.h"
#ifdef WIN32_THREADS
extern _glthread_Mutex OneTimeLock;
@@ -48,28 +49,6 @@ extern _glthread_Mutex OneTimeLock;
struct stw_device *stw_dev = NULL;
-/**
- * XXX: Dispatch pipe_screen::flush_front_buffer to our
- * stw_winsys::flush_front_buffer.
- */
-static void
-stw_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surface,
- void *context_private )
-{
- HDC hdc = (HDC)context_private;
- struct stw_framebuffer *fb;
-
- fb = stw_framebuffer_from_hdc( hdc );
- if (!fb) {
- /* fb can be NULL if window was destroyed already */
- return;
- }
-
- stw_framebuffer_present_locked(hdc, fb, surface);
-}
-
-
boolean
stw_init(const struct stw_winsys *stw_winsys)
{
@@ -95,6 +74,11 @@ stw_init(const struct stw_winsys *stw_winsys)
_glthread_INIT_MUTEX(OneTimeLock);
#endif
+ stw_dev->stapi = stw_st_create_api();
+ stw_dev->smapi = CALLOC_STRUCT(st_manager);
+ if (!stw_dev->stapi || !stw_dev->smapi)
+ goto error1;
+
screen = stw_winsys->create_screen();
if(!screen)
goto error1;
@@ -102,12 +86,9 @@ stw_init(const struct stw_winsys *stw_winsys)
if(stw_winsys->get_adapter_luid)
stw_winsys->get_adapter_luid(screen, &stw_dev->AdapterLuid);
+ stw_dev->smapi->screen = screen;
stw_dev->screen = screen;
- /* XXX
- */
- stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer;
-
pipe_mutex_init( stw_dev->ctx_mutex );
pipe_mutex_init( stw_dev->fb_mutex );
@@ -121,6 +102,11 @@ stw_init(const struct stw_winsys *stw_winsys)
return TRUE;
error1:
+ if (stw_dev->smapi)
+ FREE(stw_dev->smapi);
+ if (stw_dev->stapi)
+ stw_dev->stapi->destroy(stw_dev->stapi);
+
stw_dev = NULL;
return FALSE;
}
@@ -170,6 +156,9 @@ stw_cleanup(void)
pipe_mutex_destroy( stw_dev->fb_mutex );
pipe_mutex_destroy( stw_dev->ctx_mutex );
+ FREE(stw_dev->smapi);
+ stw_dev->stapi->destroy(stw_dev->stapi);
+
stw_dev->screen->destroy(stw_dev->screen);
#ifdef WIN32_THREADS