glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / targets / libgl-gdi / gdi_softpipe_winsys.c
blob4ac507ff9cf283f8f7b8d7b6a6df9c6b9ff06582
1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
4 * All Rights Reserved.
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
24 * of the Software.
27 **************************************************************************/
29 /**
30 * @file
31 * LLVMpipe support.
33 * @author Jose Fonseca <jfonseca@vmware.com>
37 #include <windows.h>
39 #include "stw_winsys.h"
40 #include "gdi/gdi_sw_winsys.h"
41 #include "softpipe/sp_texture.h"
42 #include "softpipe/sp_screen.h"
43 #include "softpipe/sp_public.h"
46 static struct pipe_screen *
47 gdi_softpipe_screen_create(void)
49 static struct sw_winsys *winsys;
50 struct pipe_screen *screen;
52 winsys = gdi_create_sw_winsys();
53 if(!winsys)
54 goto no_winsys;
56 screen = softpipe_create_screen(winsys);
57 if(!screen)
58 goto no_screen;
60 return screen;
62 no_screen:
63 winsys->destroy(winsys);
64 no_winsys:
65 return NULL;
71 static void
72 gdi_softpipe_present(struct pipe_screen *screen,
73 struct pipe_surface *surface,
74 HDC hDC)
76 /* This will fail if any interposing layer (trace, debug, etc) has
77 * been introduced between the state-trackers and softpipe.
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(softpipe_screen(screen)->winsys,
86 softpipe_resource(surface->texture)->dt,
87 hDC);
91 static const struct stw_winsys stw_winsys = {
92 &gdi_softpipe_screen_create,
93 &gdi_softpipe_present,
94 NULL, /* get_adapter_luid */
95 NULL, /* shared_surface_open */
96 NULL, /* shared_surface_close */
97 NULL /* compose */
101 BOOL WINAPI
102 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
104 switch (fdwReason) {
105 case DLL_PROCESS_ATTACH:
106 stw_init(&stw_winsys);
107 stw_init_thread();
108 break;
110 case DLL_THREAD_ATTACH:
111 stw_init_thread();
112 break;
114 case DLL_THREAD_DETACH:
115 stw_cleanup_thread();
116 break;
118 case DLL_PROCESS_DETACH:
119 stw_cleanup_thread();
120 stw_cleanup();
121 break;
123 return TRUE;