glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / state_trackers / wgl / stw_wgl.c
blob5fbb7bf7cfd6b8aefd102b73c4e2411497c48ab7
1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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 above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include <windows.h>
30 #include "util/u_debug.h"
31 #include "stw_icd.h"
32 #include "stw_context.h"
33 #include "stw_pixelformat.h"
34 #include "stw_wgl.h"
37 WINGDIAPI BOOL APIENTRY
38 wglCopyContext(
39 HGLRC hglrcSrc,
40 HGLRC hglrcDst,
41 UINT mask )
43 return DrvCopyContext( (DHGLRC)(UINT_PTR)hglrcSrc,
44 (DHGLRC)(UINT_PTR)hglrcDst,
45 mask );
48 WINGDIAPI HGLRC APIENTRY
49 wglCreateContext(
50 HDC hdc )
52 return (HGLRC) DrvCreateContext(hdc);
55 WINGDIAPI HGLRC APIENTRY
56 wglCreateLayerContext(
57 HDC hdc,
58 int iLayerPlane )
60 return (HGLRC) DrvCreateLayerContext( hdc, iLayerPlane );
63 WINGDIAPI BOOL APIENTRY
64 wglDeleteContext(
65 HGLRC hglrc )
67 return DrvDeleteContext((DHGLRC)(UINT_PTR)hglrc );
71 WINGDIAPI HGLRC APIENTRY
72 wglGetCurrentContext( VOID )
74 return (HGLRC)(UINT_PTR)stw_get_current_context();
77 WINGDIAPI HDC APIENTRY
78 wglGetCurrentDC( VOID )
80 return stw_get_current_dc();
83 WINGDIAPI BOOL APIENTRY
84 wglMakeCurrent(
85 HDC hdc,
86 HGLRC hglrc )
88 return DrvSetContext( hdc, (DHGLRC)(UINT_PTR)hglrc, NULL ) ? TRUE : FALSE;
92 WINGDIAPI BOOL APIENTRY
93 wglSwapBuffers(
94 HDC hdc )
96 return DrvSwapBuffers( hdc );
100 WINGDIAPI DWORD WINAPI
101 wglSwapMultipleBuffers(UINT n,
102 CONST WGLSWAP *ps)
104 UINT i;
106 for (i =0; i < n; ++i)
107 wglSwapBuffers(ps->hdc);
109 return 0;
113 WINGDIAPI BOOL APIENTRY
114 wglSwapLayerBuffers(
115 HDC hdc,
116 UINT fuPlanes )
118 return DrvSwapLayerBuffers( hdc, fuPlanes );
121 WINGDIAPI PROC APIENTRY
122 wglGetProcAddress(
123 LPCSTR lpszProc )
125 return DrvGetProcAddress( lpszProc );
129 WINGDIAPI int APIENTRY
130 wglChoosePixelFormat(
131 HDC hdc,
132 CONST PIXELFORMATDESCRIPTOR *ppfd )
134 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1)
135 return 0;
136 if (ppfd->iPixelType != PFD_TYPE_RGBA)
137 return 0;
138 if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW))
139 return 0;
140 if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL))
141 return 0;
142 if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP)
143 return 0;
144 if (ppfd->dwFlags & PFD_SUPPORT_GDI)
145 return 0;
146 if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO))
147 return 0;
149 return stw_pixelformat_choose( hdc, ppfd );
152 WINGDIAPI int APIENTRY
153 wglDescribePixelFormat(
154 HDC hdc,
155 int iPixelFormat,
156 UINT nBytes,
157 LPPIXELFORMATDESCRIPTOR ppfd )
159 return DrvDescribePixelFormat( hdc, iPixelFormat, nBytes, ppfd );
162 WINGDIAPI int APIENTRY
163 wglGetPixelFormat(
164 HDC hdc )
166 return stw_pixelformat_get( hdc );
169 WINGDIAPI BOOL APIENTRY
170 wglSetPixelFormat(
171 HDC hdc,
172 int iPixelFormat,
173 const PIXELFORMATDESCRIPTOR *ppfd )
175 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ))
176 return FALSE;
178 return DrvSetPixelFormat( hdc, iPixelFormat );
182 WINGDIAPI BOOL APIENTRY
183 wglUseFontBitmapsA(
184 HDC hdc,
185 DWORD first,
186 DWORD count,
187 DWORD listBase )
189 (void) hdc;
190 (void) first;
191 (void) count;
192 (void) listBase;
194 assert( 0 );
196 return FALSE;
199 WINGDIAPI BOOL APIENTRY
200 wglShareLists(
201 HGLRC hglrc1,
202 HGLRC hglrc2 )
204 return DrvShareLists((DHGLRC)(UINT_PTR)hglrc1,
205 (DHGLRC)(UINT_PTR)hglrc2);
208 WINGDIAPI BOOL APIENTRY
209 wglUseFontBitmapsW(
210 HDC hdc,
211 DWORD first,
212 DWORD count,
213 DWORD listBase )
215 (void) hdc;
216 (void) first;
217 (void) count;
218 (void) listBase;
220 assert( 0 );
222 return FALSE;
225 WINGDIAPI BOOL APIENTRY
226 wglUseFontOutlinesA(
227 HDC hdc,
228 DWORD first,
229 DWORD count,
230 DWORD listBase,
231 FLOAT deviation,
232 FLOAT extrusion,
233 int format,
234 LPGLYPHMETRICSFLOAT lpgmf )
236 (void) hdc;
237 (void) first;
238 (void) count;
239 (void) listBase;
240 (void) deviation;
241 (void) extrusion;
242 (void) format;
243 (void) lpgmf;
245 assert( 0 );
247 return FALSE;
250 WINGDIAPI BOOL APIENTRY
251 wglUseFontOutlinesW(
252 HDC hdc,
253 DWORD first,
254 DWORD count,
255 DWORD listBase,
256 FLOAT deviation,
257 FLOAT extrusion,
258 int format,
259 LPGLYPHMETRICSFLOAT lpgmf )
261 (void) hdc;
262 (void) first;
263 (void) count;
264 (void) listBase;
265 (void) deviation;
266 (void) extrusion;
267 (void) format;
268 (void) lpgmf;
270 assert( 0 );
272 return FALSE;
275 WINGDIAPI BOOL APIENTRY
276 wglDescribeLayerPlane(
277 HDC hdc,
278 int iPixelFormat,
279 int iLayerPlane,
280 UINT nBytes,
281 LPLAYERPLANEDESCRIPTOR plpd )
283 return DrvDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
286 WINGDIAPI int APIENTRY
287 wglSetLayerPaletteEntries(
288 HDC hdc,
289 int iLayerPlane,
290 int iStart,
291 int cEntries,
292 CONST COLORREF *pcr )
294 return DrvSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
297 WINGDIAPI int APIENTRY
298 wglGetLayerPaletteEntries(
299 HDC hdc,
300 int iLayerPlane,
301 int iStart,
302 int cEntries,
303 COLORREF *pcr )
305 return DrvGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
308 WINGDIAPI BOOL APIENTRY
309 wglRealizeLayerPalette(
310 HDC hdc,
311 int iLayerPlane,
312 BOOL bRealize )
314 (void) hdc;
315 (void) iLayerPlane;
316 (void) bRealize;
318 assert( 0 );
320 return FALSE;