radeon/r200/r300: cleanup some of the renderbuffer code
[mesa.git] / src / gallium / state_trackers / wgl / wgl / stw_wgl.c
1 /**************************************************************************
2 *
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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:
13 *
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.
17 *
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.
25 *
26 **************************************************************************/
27
28 #include <windows.h>
29
30 #include "pipe/p_debug.h"
31 #include "shared/stw_public.h"
32 #include "stw_wgl.h"
33 #include "stw.h"
34
35 boolean stw_wgl_init( void )
36 {
37 debug_printf("%s\n", __FUNCTION__);
38 return TRUE;
39 }
40
41 void stw_wgl_cleanup( void )
42 {
43 }
44
45 static INLINE struct stw_context *stw_context( HGLRC hglrc )
46 {
47 return (struct stw_context *)hglrc;
48 }
49
50
51 WINGDIAPI BOOL APIENTRY
52 wglCopyContext(
53 HGLRC hglrcSrc,
54 HGLRC hglrcDst,
55 UINT mask )
56 {
57 return stw_copy_context( stw_context(hglrcSrc),
58 stw_context(hglrcDst),
59 mask );
60 }
61
62 WINGDIAPI HGLRC APIENTRY
63 wglCreateContext(
64 HDC hdc )
65 {
66 return (HGLRC) stw_create_context( hdc, 0 );
67 }
68
69 WINGDIAPI HGLRC APIENTRY
70 wglCreateLayerContext(
71 HDC hdc,
72 int iLayerPlane )
73 {
74 return (HGLRC) stw_create_context( hdc, iLayerPlane );
75 }
76
77 WINGDIAPI BOOL APIENTRY
78 wglDeleteContext(
79 HGLRC hglrc )
80 {
81 return stw_delete_context( stw_context(hglrc) );
82 }
83
84
85 WINGDIAPI HGLRC APIENTRY
86 wglGetCurrentContext( VOID )
87 {
88 return (HGLRC) stw_get_current_context();
89 }
90
91 WINGDIAPI HDC APIENTRY
92 wglGetCurrentDC( VOID )
93 {
94 return stw_get_current_dc();
95 }
96
97 WINGDIAPI BOOL APIENTRY
98 wglMakeCurrent(
99 HDC hdc,
100 HGLRC hglrc )
101 {
102 return stw_make_current( hdc, stw_context(hglrc) );
103 }
104
105
106 WINGDIAPI BOOL APIENTRY
107 wglSwapBuffers(
108 HDC hdc )
109 {
110 return stw_swap_buffers( hdc );
111 }
112
113
114 WINGDIAPI BOOL APIENTRY
115 wglSwapLayerBuffers(
116 HDC hdc,
117 UINT fuPlanes )
118 {
119 (void) hdc;
120 (void) fuPlanes;
121
122 return FALSE;
123 }
124
125 WINGDIAPI PROC APIENTRY
126 wglGetProcAddress(
127 LPCSTR lpszProc )
128 {
129 return stw_get_proc_address( lpszProc );
130 }
131
132
133 WINGDIAPI int APIENTRY
134 wglChoosePixelFormat(
135 HDC hdc,
136 CONST PIXELFORMATDESCRIPTOR *ppfd )
137 {
138 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1)
139 return 0;
140 if (ppfd->iPixelType != PFD_TYPE_RGBA)
141 return 0;
142 if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW))
143 return 0;
144 if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL))
145 return 0;
146 if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP)
147 return 0;
148 if (ppfd->dwFlags & PFD_SUPPORT_GDI)
149 return 0;
150 if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO))
151 return 0;
152
153 return stw_pixelformat_choose( hdc, ppfd );
154 }
155
156 WINGDIAPI int APIENTRY
157 wglDescribePixelFormat(
158 HDC hdc,
159 int iPixelFormat,
160 UINT nBytes,
161 LPPIXELFORMATDESCRIPTOR ppfd )
162 {
163 return stw_pixelformat_describe( hdc, iPixelFormat, nBytes, ppfd );
164 }
165
166 WINGDIAPI int APIENTRY
167 wglGetPixelFormat(
168 HDC hdc )
169 {
170 return stw_pixelformat_get( hdc );
171 }
172
173 WINGDIAPI BOOL APIENTRY
174 wglSetPixelFormat(
175 HDC hdc,
176 int iPixelFormat,
177 const PIXELFORMATDESCRIPTOR *ppfd )
178 {
179 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ))
180 return FALSE;
181
182 return stw_pixelformat_set( hdc, iPixelFormat );
183 }
184
185
186 WINGDIAPI BOOL APIENTRY
187 wglUseFontBitmapsA(
188 HDC hdc,
189 DWORD first,
190 DWORD count,
191 DWORD listBase )
192 {
193 (void) hdc;
194 (void) first;
195 (void) count;
196 (void) listBase;
197
198 assert( 0 );
199
200 return FALSE;
201 }
202
203 WINGDIAPI BOOL APIENTRY
204 wglShareLists(
205 HGLRC hglrc1,
206 HGLRC hglrc2 )
207 {
208 (void) hglrc1;
209 (void) hglrc2;
210
211 assert( 0 );
212
213 return FALSE;
214 }
215
216 WINGDIAPI BOOL APIENTRY
217 wglUseFontBitmapsW(
218 HDC hdc,
219 DWORD first,
220 DWORD count,
221 DWORD listBase )
222 {
223 (void) hdc;
224 (void) first;
225 (void) count;
226 (void) listBase;
227
228 assert( 0 );
229
230 return FALSE;
231 }
232
233 WINGDIAPI BOOL APIENTRY
234 wglUseFontOutlinesA(
235 HDC hdc,
236 DWORD first,
237 DWORD count,
238 DWORD listBase,
239 FLOAT deviation,
240 FLOAT extrusion,
241 int format,
242 LPGLYPHMETRICSFLOAT lpgmf )
243 {
244 (void) hdc;
245 (void) first;
246 (void) count;
247 (void) listBase;
248 (void) deviation;
249 (void) extrusion;
250 (void) format;
251 (void) lpgmf;
252
253 assert( 0 );
254
255 return FALSE;
256 }
257
258 WINGDIAPI BOOL APIENTRY
259 wglUseFontOutlinesW(
260 HDC hdc,
261 DWORD first,
262 DWORD count,
263 DWORD listBase,
264 FLOAT deviation,
265 FLOAT extrusion,
266 int format,
267 LPGLYPHMETRICSFLOAT lpgmf )
268 {
269 (void) hdc;
270 (void) first;
271 (void) count;
272 (void) listBase;
273 (void) deviation;
274 (void) extrusion;
275 (void) format;
276 (void) lpgmf;
277
278 assert( 0 );
279
280 return FALSE;
281 }
282
283 WINGDIAPI BOOL APIENTRY
284 wglDescribeLayerPlane(
285 HDC hdc,
286 int iPixelFormat,
287 int iLayerPlane,
288 UINT nBytes,
289 LPLAYERPLANEDESCRIPTOR plpd )
290 {
291 (void) hdc;
292 (void) iPixelFormat;
293 (void) iLayerPlane;
294 (void) nBytes;
295 (void) plpd;
296
297 assert( 0 );
298
299 return FALSE;
300 }
301
302 WINGDIAPI int APIENTRY
303 wglSetLayerPaletteEntries(
304 HDC hdc,
305 int iLayerPlane,
306 int iStart,
307 int cEntries,
308 CONST COLORREF *pcr )
309 {
310 (void) hdc;
311 (void) iLayerPlane;
312 (void) iStart;
313 (void) cEntries;
314 (void) pcr;
315
316 assert( 0 );
317
318 return 0;
319 }
320
321 WINGDIAPI int APIENTRY
322 wglGetLayerPaletteEntries(
323 HDC hdc,
324 int iLayerPlane,
325 int iStart,
326 int cEntries,
327 COLORREF *pcr )
328 {
329 (void) hdc;
330 (void) iLayerPlane;
331 (void) iStart;
332 (void) cEntries;
333 (void) pcr;
334
335 assert( 0 );
336
337 return 0;
338 }
339
340 WINGDIAPI BOOL APIENTRY
341 wglRealizeLayerPalette(
342 HDC hdc,
343 int iLayerPlane,
344 BOOL bRealize )
345 {
346 (void) hdc;
347 (void) iLayerPlane;
348 (void) bRealize;
349
350 assert( 0 );
351
352 return FALSE;
353 }