1 /**************************************************************************
3 * Copyright 2009-2010 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
27 **************************************************************************/
31 * Softpipe/LLVMpipe support.
33 * @author Jose Fonseca <jfonseca@vmware.com>
39 #include "util/u_debug.h"
40 #include "stw_winsys.h"
41 #include "gdi/gdi_sw_winsys.h"
43 #include "softpipe/sp_texture.h"
44 #include "softpipe/sp_screen.h"
45 #include "softpipe/sp_public.h"
48 #include "llvmpipe/lp_texture.h"
49 #include "llvmpipe/lp_screen.h"
50 #include "llvmpipe/lp_public.h"
54 static boolean use_llvmpipe
= FALSE
;
57 static struct pipe_screen
*
58 gdi_screen_create(void)
60 const char *default_driver
;
62 struct pipe_screen
*screen
= NULL
;
63 struct sw_winsys
*winsys
;
65 winsys
= gdi_create_sw_winsys();
70 default_driver
= "llvmpipe";
72 default_driver
= "softpipe";
75 driver
= debug_get_option("GALLIUM_DRIVER", default_driver
);
78 if (strcmp(driver
, "llvmpipe") == 0) {
79 screen
= llvmpipe_create_screen( winsys
);
84 screen
= softpipe_create_screen( winsys
);
95 winsys
->destroy(winsys
);
102 gdi_present(struct pipe_screen
*screen
,
103 struct pipe_surface
*surface
,
106 /* This will fail if any interposing layer (trace, debug, etc) has
107 * been introduced between the state-trackers and the pipe driver.
109 * Ideally this would get replaced with a call to
110 * pipe_screen::flush_frontbuffer().
112 * Failing that, it may be necessary for intervening layers to wrap
113 * other structs such as this stw_winsys as well...
116 struct sw_winsys
*winsys
= NULL
;
117 struct sw_displaytarget
*dt
= NULL
;
121 winsys
= llvmpipe_screen(screen
)->winsys
;
122 dt
= llvmpipe_resource(surface
->texture
)->dt
;
123 gdi_sw_display(winsys
, dt
, hDC
);
128 winsys
= softpipe_screen(screen
)->winsys
,
129 dt
= softpipe_resource(surface
->texture
)->dt
,
130 gdi_sw_display(winsys
, dt
, hDC
);
134 static const struct stw_winsys stw_winsys
= {
137 NULL
, /* get_adapter_luid */
138 NULL
, /* shared_surface_open */
139 NULL
, /* shared_surface_close */
145 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpReserved
)
148 case DLL_PROCESS_ATTACH
:
149 stw_init(&stw_winsys
);
153 case DLL_THREAD_ATTACH
:
157 case DLL_THREAD_DETACH
:
158 stw_cleanup_thread();
161 case DLL_PROCESS_DETACH
:
162 stw_cleanup_thread();