diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-01-28 16:11:46 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-01-28 16:11:46 +0000 |
commit | 67b6e5b907096ce9eee32c36c164acd38574cf14 (patch) | |
tree | 3820b57003653a806b988eac932d36ba8238fe32 /src/gallium/state_trackers/wgl/shared | |
parent | 507498af1077390c684ca24e6ce6e0ee6ddcc479 (diff) |
wgl: split device structs, move swapbuffers to shared
Each of icd, shared and wgl now have the opportunity to maintain their
own per-device structs, which should reduce the need for these
modules to be looking into each others structures.
Diffstat (limited to 'src/gallium/state_trackers/wgl/shared')
4 files changed, 36 insertions, 28 deletions
diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 63ee066824..88eeae7de7 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -34,6 +34,8 @@ #include "shared/stw_device.h" #include "shared/stw_winsys.h" #include "shared/stw_pixelformat.h" +#include "shared/stw_public.h" +#include "stw.h" struct stw_device *stw_dev = NULL; @@ -57,7 +59,7 @@ st_flush_frontbuffer(struct pipe_winsys *ws, boolean -st_init(const struct stw_winsys *stw_winsys) +stw_shared_init(const struct stw_winsys *stw_winsys) { static struct stw_device stw_dev_storage; @@ -86,17 +88,7 @@ error1: void -st_cleanup(void) +stw_shared_cleanup(void) { - DHGLRC dhglrc; - - if(!stw_dev) - return; - - /* Ensure all contexts are destroyed */ - for (dhglrc = 1; dhglrc <= DRV_CONTEXT_MAX; dhglrc++) - if (stw_dev->ctx_array[dhglrc - 1].hglrc) - DrvDeleteContext( dhglrc ); - stw_dev = NULL; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index 2babc654da..bc0bce37c6 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -29,28 +29,12 @@ #define ST_DEVICE_H_ -#include "icd/stw_icd.h" - struct pipe_screen; - -struct drv_context -{ - HGLRC hglrc; -}; - -#define DRV_CONTEXT_MAX 32 - - struct stw_device { const struct stw_winsys *stw_winsys; - struct pipe_screen *screen; - - struct drv_context ctx_array[DRV_CONTEXT_MAX]; - - DHGLRC ctx_current; }; diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 1ecafa451e..50edf7306d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -29,9 +29,14 @@ #include "main/context.h" #include "pipe/p_format.h" +#include "pipe/p_screen.h" #include "state_tracker/st_context.h" #include "state_tracker/st_public.h" #include "stw_framebuffer.h" +#include "stw_device.h" +#include "stw_public.h" +#include "stw_winsys.h" + void framebuffer_resize( @@ -179,3 +184,29 @@ framebuffer_from_hdc( return fb; return NULL; } + + +BOOL +stw_swap_buffers( + HDC hdc ) +{ + struct stw_framebuffer *fb; + struct pipe_surface *surf; + + fb = framebuffer_from_hdc( hdc ); + if (fb == NULL) + return FALSE; + + /* If we're swapping the buffer associated with the current context + * we have to flush any pending rendering commands first. + */ + st_notify_swapbuffers( fb->stfb ); + + st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf ); + + stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys, + surf, + hdc ); + + return TRUE; +} diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index 982de22666..ab5dcfc672 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -29,6 +29,7 @@ #define PIXELFORMAT_H #include <windows.h> +#include "pipe/p_compiler.h" #define PF_FLAG_DOUBLEBUFFER 0x00000001 #define PF_FLAG_MULTISAMPLED 0x00000002 |