'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:
#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 *
return screen;
no_screen:
- FREE(winsys);
+ winsys->destroy(winsys);
no_winsys:
return NULL;
}
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);
}
#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();
return screen;
no_screen:
- FREE(winsys);
+ winsys->destroy(winsys);
no_winsys:
return NULL;
}
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);
}
#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
}
+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);
}
#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