winsys/gdi: get softpipe version compiling
authorKeith Whitwell <keithw@vmware.com>
Tue, 9 Mar 2010 15:02:21 +0000 (15:02 +0000)
committerKeith Whitwell <keithw@vmware.com>
Tue, 9 Mar 2010 15:02:21 +0000 (15:02 +0000)
src/gallium/winsys/gdi/SConscript
src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
src/gallium/winsys/gdi/gdi_softpipe_winsys.c
src/gallium/winsys/gdi/gdi_sw_winsys.c
src/gallium/winsys/gdi/gdi_sw_winsys.h

index 4b32aa27e17a9c1c4ea47ceed3c9c78bc26feaae..0a3f141e7209e1a3135b48d5376289ccea4b15f0 100644 (file)
@@ -18,17 +18,19 @@ if env['platform'] == 'windows':
         'ws2_32',
     ])
 
-    sources = ['gdi_sw_winsys.c']
+    sources = []
     drivers = []
 
     if 'softpipe' in env['drivers']:
-        sources = ['gdi_softpipe_winsys.c']
+        sources = ['gdi_sw_winsys.c',
+                   'gdi_softpipe_winsys.c']
         drivers = [softpipe]
 
     if 'llvmpipe' in env['drivers']:
         env.Tool('llvm')
         if 'LLVM_VERSION' in env:
-            sources = ['gdi_llvmpipe_winsys.c']
+            sources = ['gdi_sw_winsys.c',
+                       'gdi_llvmpipe_winsys.c']
             drivers = [llvmpipe]
 
     if not sources or not drivers:
index e627028dd45deb4e70b33ed6e8984e888726bb3e..4ea33f673fc6f44eb6f1e4f3ff78775f09713425 100644 (file)
 
 #include <windows.h>
 
+#include "stw_winsys.h"
 #include "gdi_sw_winsys.h"
 #include "llvmpipe/lp_texture.h"
+#include "llvmpipe/lp_screen.h"
 
 
 static struct pipe_screen *
@@ -57,7 +59,7 @@ gdi_llvmpipe_screen_create(void)
    return screen;
    
 no_screen:
-   FREE(winsys);
+   winsys->destroy(winsys);
 no_winsys:
    return NULL;
 }
@@ -70,16 +72,18 @@ gdi_llvmpipe_present(struct pipe_screen *screen,
                      struct pipe_surface *surface,
                      HDC hDC)
 {
-    struct llvmpipe_texture *texture;
-    struct gdi_llvmpipe_displaytarget *gdt;
-
-    texture = llvmpipe_texture(surface->texture);
-    gdt = gdi_llvmpipe_displaytarget(texture->dt);
-
-    StretchDIBits(hDC,
-                  0, 0, gdt->width, gdt->height,
-                  0, 0, gdt->width, gdt->height,
-                  gdt->data, &gdt->bmi, 0, SRCCOPY);
+   /* This will fail if any interposing layer (trace, debug, etc) has
+    * been introduced between the state-trackers and llvmpipe.
+    *
+    * Ideally this would get replaced with a call to
+    * pipe_screen::flush_frontbuffer().
+    *
+    * Failing that, it may be necessary for intervening layers to wrap
+    * other structs such as this stw_winsys as well...
+    */
+   gdi_sw_display(llvmpipe_screen(screen)->winsys,
+                  llvmpipe_texture(surface->texture)->dt,
+                  hDC);
 }
 
 
index bb669bbb6431fc9d326be912554bb5db9bfe2377..5c5c154c7fd025e5da8b523d2f5adc1ba0293355 100644 (file)
 
 #include <windows.h>
 
+#include "stw_winsys.h"
 #include "gdi_sw_winsys.h"
 #include "softpipe/sp_texture.h"
+#include "softpipe/sp_screen.h"
 
 
 static struct pipe_screen *
 gdi_softpipe_screen_create(void)
 {
-   static struct softpipe_winsys *winsys;
+   static struct sw_winsys *winsys;
    struct pipe_screen *screen;
 
    winsys = gdi_create_sw_winsys();
@@ -57,7 +59,7 @@ gdi_softpipe_screen_create(void)
    return screen;
    
 no_screen:
-   FREE(winsys);
+   winsys->destroy(winsys);
 no_winsys:
    return NULL;
 }
@@ -70,16 +72,18 @@ gdi_softpipe_present(struct pipe_screen *screen,
                      struct pipe_surface *surface,
                      HDC hDC)
 {
-    struct softpipe_texture *texture;
-    struct gdi_softpipe_displaytarget *gdt;
-
-    texture = softpipe_texture(surface->texture);
-    gdt = gdi_softpipe_displaytarget(texture->dt);
-
-    StretchDIBits(hDC,
-                  0, 0, gdt->width, gdt->height,
-                  0, 0, gdt->width, gdt->height,
-                  gdt->data, &gdt->bmi, 0, SRCCOPY);
+   /* This will fail if any interposing layer (trace, debug, etc) has
+    * been introduced between the state-trackers and softpipe.
+    *
+    * Ideally this would get replaced with a call to
+    * pipe_screen::flush_frontbuffer().
+    *
+    * Failing that, it may be necessary for intervening layers to wrap
+    * other structs such as this stw_winsys as well...
+    */
+   gdi_sw_display(softpipe_screen(screen)->winsys,
+                  softpipe_texture(surface->texture)->dt,
+                  hDC);
 }
 
 
index 00c6facd044814f26bcaed2684d18926e4600485..55f99c4f47de9d9088866c55f73804583a9409a7 100644 (file)
@@ -43,7 +43,7 @@
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "state_tracker/sw_winsys.h"
-#include "stw_winsys.h"
+#include "gdi_sw_winsys.h"
 
 
 struct gdi_sw_displaytarget
@@ -168,21 +168,29 @@ no_gdt:
 }
 
 
+void
+gdi_sw_display( struct sw_winsys *winsys,
+                struct sw_displaytarget *dt,
+                HDC hDC )
+{
+    struct gdi_sw_displaytarget *gdt = gdi_sw_displaytarget(dt);
+
+    StretchDIBits(hDC,
+                  0, 0, gdt->width, gdt->height,
+                  0, 0, gdt->width, gdt->height,
+                  gdt->data, &gdt->bmi, 0, SRCCOPY);
+}
+
 static void
 gdi_sw_displaytarget_display(struct sw_winsys *winsys, 
                              struct sw_displaytarget *dt,
                              void *context_private)
 {
-    struct gdi_softpipe_displaytarget *gdt = gdi_sw_displaytarget(dt);
-
     /* nasty:
      */
     HDC hDC = (HDC)context_private;
 
-    StretchDIBits(hDC,
-                  0, 0, gdt->width, gdt->height,
-                  0, 0, gdt->width, gdt->height,
-                  gdt->data, &gdt->bmi, 0, SRCCOPY);
+    gdi_sw_display(winsys, dt, hDC);
 }
 
 
index 7e00d78911c0555847fadd12355b595a96feb783..8ecca7bbc3e3a7e0c106110f74992566b90e60cf 100644 (file)
@@ -4,7 +4,11 @@
 #include "pipe/p_compiler.h"
 #include "state_tracker/sw_winsys.h"
 
+void gdi_sw_display( struct sw_winsys *winsys,
+                     struct sw_displaytarget *dt,
+                     HDC hDC );
+
 struct sw_winsys *
-gdi_create_sw_winsys(void)
+gdi_create_sw_winsys(void);
 
 #endif