Mesa (gallium-0.2): stw: Dispatch to our stw_winsys::flush_front_buffer

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Jan 16 15:17:08 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: eac69bf99e9917492c646854128c117d064e9901
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eac69bf99e9917492c646854128c117d064e9901

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Jan 14 12:56:12 2009 +0000

stw: Dispatch  to our stw_winsys::flush_front_buffer

pipe_winsys::flush_front_buffer should die someday, but this is good enough
for now.

---

 src/mesa/state_tracker/wgl/stw_device.c      |   22 ++++++++++++++++++++++
 src/mesa/state_tracker/wgl/stw_wgl_context.c |    5 +++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/wgl/stw_device.c b/src/mesa/state_tracker/wgl/stw_device.c
index e2a17d8..129b24c 100644
--- a/src/mesa/state_tracker/wgl/stw_device.c
+++ b/src/mesa/state_tracker/wgl/stw_device.c
@@ -28,6 +28,8 @@
 #include <windows.h>
 
 #include "pipe/p_debug.h"
+#include "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
 
 #include "stw_device.h"
 #include "stw_winsys.h"
@@ -37,6 +39,23 @@
 struct stw_device *stw_dev = NULL;
 
 
+/**
+ * XXX: Dispatch pipe_winsys::flush_front_buffer to our 
+ * stw_winsys::flush_front_buffer.
+ */
+static void 
+st_flush_frontbuffer(struct pipe_winsys *ws,
+                     struct pipe_surface *surf,
+                     void *context_private )
+{
+   const struct stw_winsys *stw_winsys = stw_dev->stw_winsys;
+   struct pipe_winsys *winsys = stw_dev->screen->winsys;
+   HDC hdc = (HDC)context_private;
+   
+   stw_winsys->flush_frontbuffer(winsys, surf, hdc);
+}
+
+
 boolean
 st_init(const struct stw_winsys *stw_winsys)
 {
@@ -53,6 +72,9 @@ st_init(const struct stw_winsys *stw_winsys)
    if(!stw_dev->screen)
       goto error1;
 
+   /* XXX: pipe_winsys::flush_frontbuffer should go away */
+   stw_dev->screen->winsys->flush_frontbuffer = st_flush_frontbuffer;
+   
    pixelformat_init();
 
    return TRUE;
diff --git a/src/mesa/state_tracker/wgl/stw_wgl_context.c b/src/mesa/state_tracker/wgl/stw_wgl_context.c
index 0c13c6b..890d97f 100644
--- a/src/mesa/state_tracker/wgl/stw_wgl_context.c
+++ b/src/mesa/state_tracker/wgl/stw_wgl_context.c
@@ -111,6 +111,9 @@ wglCreateContext(
       FREE( ctx );
       return NULL;
    }
+   
+   assert(!pipe->priv);
+   pipe->priv = hdc;
 
    ctx->st = st_create_context( pipe, visual, NULL );
    if (ctx->st == NULL) {
@@ -265,6 +268,8 @@ wglMakeCurrent(
    if (ctx && fb) {
       st_make_current( ctx->st, fb->stfb, fb->stfb );
       framebuffer_resize( fb, width, height );
+      ctx->hdc = hdc;
+      ctx->st->pipe->priv = hdc;
    }
    else {
       /* Detach */




More information about the mesa-commit mailing list