1 /**************************************************************************
3 * Copyright 2009 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 **************************************************************************/
33 * @author Jose Fonseca <jfonseca@vmware.com>
39 #include "stw_winsys.h"
40 #include "gdi/gdi_sw_winsys.h"
41 #include "llvmpipe/lp_texture.h"
42 #include "llvmpipe/lp_screen.h"
43 #include "llvmpipe/lp_public.h"
46 static struct pipe_screen *
47 gdi_llvmpipe_screen_create(void)
49 static struct sw_winsys *winsys;
50 struct pipe_screen *screen;
52 winsys = gdi_create_sw_winsys();
56 screen = llvmpipe_create_screen(winsys);
63 winsys->destroy(winsys);
72 gdi_llvmpipe_present(struct pipe_screen *screen,
73 struct pipe_surface *surface,
76 /* This will fail if any interposing layer (trace, debug, etc) has
77 * been introduced between the state-trackers and llvmpipe.
79 * Ideally this would get replaced with a call to
80 * pipe_screen::flush_frontbuffer().
82 * Failing that, it may be necessary for intervening layers to wrap
83 * other structs such as this stw_winsys as well...
85 gdi_sw_display(llvmpipe_screen(screen)->winsys,
86 llvmpipe_resource(surface->texture)->dt,
91 static const struct stw_winsys stw_winsys = {
92 &gdi_llvmpipe_screen_create,
93 &gdi_llvmpipe_present,
94 NULL, /* get_adapter_luid */
95 NULL, /* shared_surface_open */
96 NULL, /* shared_surface_close */
102 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
105 case DLL_PROCESS_ATTACH:
106 stw_init(&stw_winsys);
110 case DLL_THREAD_ATTACH:
114 case DLL_THREAD_DETACH:
115 stw_cleanup_thread();
118 case DLL_PROCESS_DETACH:
119 stw_cleanup_thread();