2 * DirectDraw helper functions
4 * Copyright (c) 1997-2000 Marcus Meissner
5 * Copyright (c) 1998 Lionel Ulmer
6 * Copyright (c) 2000 TransGaming Technologies Inc.
7 * Copyright (c) 2006 Stefan Dösinger
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #define NONAMELESSUNION
28 #include "ddraw_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(ddraw
);
33 void DDRAW_dump_flags_(DWORD flags
, const flag_info
* names
, size_t num_names
, int newline
);
35 /*****************************************************************************
36 * PixelFormat_WineD3DtoDD
38 * Converts an WINED3DFORMAT value into a DDPIXELFORMAT structure
41 * DDPixelFormat: Address of the structure to write the pixel format to
42 * WineD3DFormat: Source format
44 *****************************************************************************/
46 PixelFormat_WineD3DtoDD(DDPIXELFORMAT
*DDPixelFormat
,
47 WINED3DFORMAT WineD3DFormat
)
49 DWORD Size
= DDPixelFormat
->dwSize
;
50 TRACE("Converting WINED3DFORMAT %d to DDRAW\n", WineD3DFormat
);
54 memset(DDPixelFormat
, 0x00, Size
);
55 DDPixelFormat
->dwSize
= Size
;
58 case WINED3DFMT_R8G8B8
:
59 DDPixelFormat
->dwFlags
= DDPF_RGB
;
60 DDPixelFormat
->dwFourCC
= 0;
61 DDPixelFormat
->u1
.dwRGBBitCount
= 24;
62 DDPixelFormat
->u2
.dwRBitMask
= 0x00ff0000;
63 DDPixelFormat
->u3
.dwGBitMask
= 0x0000ff00;
64 DDPixelFormat
->u4
.dwBBitMask
= 0x000000ff;
65 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
68 case WINED3DFMT_A8R8G8B8
:
69 DDPixelFormat
->dwFlags
= DDPF_RGB
| DDPF_ALPHAPIXELS
;
70 DDPixelFormat
->dwFourCC
= 0;
71 DDPixelFormat
->u1
.dwRGBBitCount
= 32;
72 DDPixelFormat
->u2
.dwRBitMask
= 0x00ff0000;
73 DDPixelFormat
->u3
.dwGBitMask
= 0x0000ff00;
74 DDPixelFormat
->u4
.dwBBitMask
= 0x000000ff;
75 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0xff000000;
78 case WINED3DFMT_X8R8G8B8
:
79 DDPixelFormat
->dwFlags
= DDPF_RGB
;
80 DDPixelFormat
->dwFourCC
= 0;
81 DDPixelFormat
->u1
.dwRGBBitCount
= 32;
82 DDPixelFormat
->u2
.dwRBitMask
= 0x00ff0000;
83 DDPixelFormat
->u3
.dwGBitMask
= 0x0000ff00;
84 DDPixelFormat
->u4
.dwBBitMask
= 0x000000ff;
85 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
88 case WINED3DFMT_X8B8G8R8
:
89 DDPixelFormat
->dwFlags
= DDPF_RGB
;
90 DDPixelFormat
->dwFourCC
= 0;
91 DDPixelFormat
->u1
.dwRGBBitCount
= 32;
92 DDPixelFormat
->u2
.dwRBitMask
= 0x000000ff;
93 DDPixelFormat
->u3
.dwGBitMask
= 0x0000ff00;
94 DDPixelFormat
->u4
.dwBBitMask
= 0x00ff0000;
95 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
98 case WINED3DFMT_R5G6B5
:
99 DDPixelFormat
->dwFlags
= DDPF_RGB
;
100 DDPixelFormat
->dwFourCC
= 0;
101 DDPixelFormat
->u1
.dwRGBBitCount
= 16;
102 DDPixelFormat
->u2
.dwRBitMask
= 0xF800;
103 DDPixelFormat
->u3
.dwGBitMask
= 0x07E0;
104 DDPixelFormat
->u4
.dwBBitMask
= 0x001F;
105 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
108 case WINED3DFMT_X1R5G5B5
:
109 DDPixelFormat
->dwFlags
= DDPF_RGB
;
110 DDPixelFormat
->dwFourCC
= 0;
111 DDPixelFormat
->u1
.dwRGBBitCount
= 16;
112 DDPixelFormat
->u2
.dwRBitMask
= 0x7C00;
113 DDPixelFormat
->u3
.dwGBitMask
= 0x03E0;
114 DDPixelFormat
->u4
.dwBBitMask
= 0x001F;
115 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
118 case WINED3DFMT_A1R5G5B5
:
119 DDPixelFormat
->dwFlags
= DDPF_RGB
| DDPF_ALPHAPIXELS
;
120 DDPixelFormat
->dwFourCC
= 0;
121 DDPixelFormat
->u1
.dwRGBBitCount
= 16;
122 DDPixelFormat
->u2
.dwRBitMask
= 0x7C00;
123 DDPixelFormat
->u3
.dwGBitMask
= 0x03E0;
124 DDPixelFormat
->u4
.dwBBitMask
= 0x001F;
125 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x8000;
128 case WINED3DFMT_A4R4G4B4
:
129 DDPixelFormat
->dwFlags
= DDPF_RGB
| DDPF_ALPHAPIXELS
;
130 DDPixelFormat
->dwFourCC
= 0;
131 DDPixelFormat
->u1
.dwRGBBitCount
= 16;
132 DDPixelFormat
->u2
.dwRBitMask
= 0x0F00;
133 DDPixelFormat
->u3
.dwGBitMask
= 0x00F0;
134 DDPixelFormat
->u4
.dwBBitMask
= 0x000F;
135 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0xF000;
138 case WINED3DFMT_R3G3B2
:
139 DDPixelFormat
->dwFlags
= DDPF_RGB
;
140 DDPixelFormat
->dwFourCC
= 0;
141 DDPixelFormat
->u1
.dwRGBBitCount
= 8;
142 DDPixelFormat
->u2
.dwRBitMask
= 0xE0;
143 DDPixelFormat
->u3
.dwGBitMask
= 0x1C;
144 DDPixelFormat
->u4
.dwBBitMask
= 0x03;
145 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0x0;
149 DDPixelFormat
->dwFlags
= DDPF_PALETTEINDEXED8
| DDPF_RGB
;
150 DDPixelFormat
->dwFourCC
= 0;
151 DDPixelFormat
->u1
.dwRGBBitCount
= 8;
152 DDPixelFormat
->u2
.dwRBitMask
= 0x00;
153 DDPixelFormat
->u3
.dwGBitMask
= 0x00;
154 DDPixelFormat
->u4
.dwBBitMask
= 0x00;
158 DDPixelFormat
->dwFlags
= DDPF_ALPHA
;
159 DDPixelFormat
->dwFourCC
= 0;
160 DDPixelFormat
->u1
.dwAlphaBitDepth
= 8;
161 DDPixelFormat
->u2
.dwRBitMask
= 0x0;
162 DDPixelFormat
->u3
.dwZBitMask
= 0x0;
163 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
164 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0x0;
167 case WINED3DFMT_A8R3G3B2
:
168 DDPixelFormat
->dwFlags
= DDPF_RGB
| DDPF_ALPHAPIXELS
;
169 DDPixelFormat
->dwFourCC
= 0;
170 DDPixelFormat
->u1
.dwRGBBitCount
= 16;
171 DDPixelFormat
->u2
.dwRBitMask
= 0x00E0;
172 DDPixelFormat
->u3
.dwGBitMask
= 0x001C;
173 DDPixelFormat
->u4
.dwBBitMask
= 0x0003;
174 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0xF000;
177 case WINED3DFMT_X4R4G4B4
:
178 DDPixelFormat
->dwFlags
= DDPF_RGB
;
179 DDPixelFormat
->dwFourCC
= 0;
180 DDPixelFormat
->u1
.dwRGBBitCount
= 16;
181 DDPixelFormat
->u2
.dwRBitMask
= 0x0F00;
182 DDPixelFormat
->u3
.dwGBitMask
= 0x00F0;
183 DDPixelFormat
->u4
.dwBBitMask
= 0x000F;
184 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
187 /* How are Z buffer bit depth and Stencil buffer bit depth related?
190 DDPixelFormat
->dwFlags
= DDPF_ZBUFFER
;
191 DDPixelFormat
->dwFourCC
= 0;
192 DDPixelFormat
->u1
.dwZBufferBitDepth
= 16;
193 DDPixelFormat
->u2
.dwStencilBitDepth
= 0;
194 DDPixelFormat
->u3
.dwZBitMask
= 0x0000FFFF;
195 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
196 DDPixelFormat
->u5
.dwRGBZBitMask
= 0x0000FFFF;
200 DDPixelFormat
->dwFlags
= DDPF_ZBUFFER
;
201 DDPixelFormat
->dwFourCC
= 0;
202 DDPixelFormat
->u1
.dwZBufferBitDepth
= 32;
203 DDPixelFormat
->u2
.dwStencilBitDepth
= 0;
204 DDPixelFormat
->u3
.dwZBitMask
= 0xFFFFFFFF;
205 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
206 DDPixelFormat
->u5
.dwRGBZBitMask
= 0xFFFFFFFF;
209 case WINED3DFMT_D24X4S4
:
210 DDPixelFormat
->dwFlags
= DDPF_ZBUFFER
| DDPF_STENCILBUFFER
;
211 DDPixelFormat
->dwFourCC
= 0;
212 /* Should I set dwZBufferBitDepth to 32 here? */
213 DDPixelFormat
->u1
.dwZBufferBitDepth
= 24;
214 DDPixelFormat
->u2
.dwStencilBitDepth
= 4;
215 DDPixelFormat
->u3
.dwZBitMask
= 0x0;
216 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
217 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
220 case WINED3DFMT_D24S8
:
221 DDPixelFormat
->dwFlags
= DDPF_ZBUFFER
| DDPF_STENCILBUFFER
;
222 DDPixelFormat
->dwFourCC
= 0;
223 /* Should I set dwZBufferBitDepth to 32 here? */
224 DDPixelFormat
->u1
.dwZBufferBitDepth
= 24;
225 DDPixelFormat
->u2
.dwStencilBitDepth
= 8;
226 DDPixelFormat
->u3
.dwZBitMask
= 0x0;
227 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
228 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
231 case WINED3DFMT_D24X8
:
232 DDPixelFormat
->dwFlags
= DDPF_ZBUFFER
;
233 DDPixelFormat
->dwFourCC
= 0;
234 DDPixelFormat
->u1
.dwZBufferBitDepth
= 24;
235 DDPixelFormat
->u2
.dwStencilBitDepth
= 8;
236 DDPixelFormat
->u3
.dwZBitMask
= 0x0;
237 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
238 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
241 case WINED3DFMT_D15S1
:
242 DDPixelFormat
->dwFlags
= DDPF_ZBUFFER
| DDPF_STENCILBUFFER
;
243 DDPixelFormat
->dwFourCC
= 0;
244 /* Should I set dwZBufferBitDepth to 16 here? */
245 DDPixelFormat
->u1
.dwZBufferBitDepth
= 15;
246 DDPixelFormat
->u2
.dwStencilBitDepth
= 1;
247 DDPixelFormat
->u3
.dwZBitMask
= 0x0;
248 DDPixelFormat
->u4
.dwStencilBitMask
= 0x0;
249 DDPixelFormat
->u5
.dwRGBAlphaBitMask
= 0x0;
252 case WINED3DFMT_UYVY
:
253 case WINED3DFMT_YUY2
:
254 case WINED3DFMT_DXT1
:
255 case WINED3DFMT_DXT2
:
256 case WINED3DFMT_DXT3
:
257 case WINED3DFMT_DXT4
:
258 case WINED3DFMT_DXT5
:
259 case WINED3DFMT_MULTI2_ARGB
:
260 case WINED3DFMT_G8R8_G8B8
:
261 case WINED3DFMT_R8G8_B8G8
:
262 DDPixelFormat
->dwFlags
= DDPF_FOURCC
;
263 DDPixelFormat
->dwFourCC
= WineD3DFormat
;
268 DDPixelFormat
->dwFlags
= DDPF_LUMINANCE
;
269 DDPixelFormat
->dwFourCC
= 0;
270 DDPixelFormat
->u1
.dwLuminanceBitCount
= 8;
271 DDPixelFormat
->u2
.dwLuminanceBitMask
= 0xff;
272 DDPixelFormat
->u3
.dwBumpDvBitMask
= 0x0;
273 DDPixelFormat
->u4
.dwBumpLuminanceBitMask
= 0x0;
274 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0x0;
277 case WINED3DFMT_A4L4
:
278 DDPixelFormat
->dwFlags
= DDPF_ALPHAPIXELS
| DDPF_LUMINANCE
;
279 DDPixelFormat
->dwFourCC
= 0;
280 DDPixelFormat
->u1
.dwLuminanceBitCount
= 4;
281 DDPixelFormat
->u2
.dwLuminanceBitMask
= 0x0f;
282 DDPixelFormat
->u3
.dwBumpDvBitMask
= 0x0;
283 DDPixelFormat
->u4
.dwBumpLuminanceBitMask
= 0x0;
284 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0xf0;
287 case WINED3DFMT_A8L8
:
288 DDPixelFormat
->dwFlags
= DDPF_ALPHAPIXELS
| DDPF_LUMINANCE
;
289 DDPixelFormat
->dwFourCC
= 0;
290 DDPixelFormat
->u1
.dwLuminanceBitCount
= 16;
291 DDPixelFormat
->u2
.dwLuminanceBitMask
= 0x00ff;
292 DDPixelFormat
->u3
.dwBumpDvBitMask
= 0x0;
293 DDPixelFormat
->u4
.dwBumpLuminanceBitMask
= 0x0;
294 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0xff00;
298 case WINED3DFMT_V8U8
:
299 DDPixelFormat
->dwFlags
= DDPF_BUMPDUDV
;
300 DDPixelFormat
->dwFourCC
= 0;
301 DDPixelFormat
->u1
.dwBumpBitCount
= 16;
302 DDPixelFormat
->u2
.dwBumpDuBitMask
= 0x000000ff;
303 DDPixelFormat
->u3
.dwBumpDvBitMask
= 0x0000ff00;
304 DDPixelFormat
->u4
.dwBumpLuminanceBitMask
= 0x00000000;
305 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0x00000000;
308 case WINED3DFMT_L6V5U5
:
309 DDPixelFormat
->dwFlags
= DDPF_BUMPDUDV
;
310 DDPixelFormat
->dwFourCC
= 0;
311 DDPixelFormat
->u1
.dwBumpBitCount
= 16;
312 DDPixelFormat
->u2
.dwBumpDuBitMask
= 0x0000001f;
313 DDPixelFormat
->u3
.dwBumpDvBitMask
= 0x000003e0;
314 DDPixelFormat
->u4
.dwBumpLuminanceBitMask
= 0x0000fc00;
315 DDPixelFormat
->u5
.dwLuminanceAlphaBitMask
= 0x00000000;
319 ERR("Can't translate this Pixelformat %d\n", WineD3DFormat
);
322 if(TRACE_ON(ddraw
)) {
323 TRACE("Returning: ");
324 DDRAW_dump_pixelformat(DDPixelFormat
);
328 /*****************************************************************************
329 * PixelFormat_DD2WineD3D
331 * Reads a DDPIXELFORMAT structure and returns the equal WINED3DFORMAT
334 * DDPixelFormat: The source format
337 * The WINED3DFORMAT equal to the DDraw format
338 * WINED3DFMT_UNKNOWN if a matching format wasn't found
339 *****************************************************************************/
341 PixelFormat_DD2WineD3D(DDPIXELFORMAT
*DDPixelFormat
)
343 TRACE("Convert a DirectDraw Pixelformat to a WineD3D Pixelformat\n");
346 DDRAW_dump_pixelformat(DDPixelFormat
);
350 if(DDPixelFormat
->dwFlags
& DDPF_PALETTEINDEXED8
)
352 return WINED3DFMT_P8
;
354 else if(DDPixelFormat
->dwFlags
& (DDPF_PALETTEINDEXED1
| DDPF_PALETTEINDEXED2
| DDPF_PALETTEINDEXED4
) )
356 FIXME("DDPF_PALETTEINDEXED1 to DDPF_PALETTEINDEXED4 are not supported by WineD3D (yet). Returning WINED3DFMT_P8\n");
357 return WINED3DFMT_P8
;
359 else if(DDPixelFormat
->dwFlags
& DDPF_RGB
)
361 switch(DDPixelFormat
->u1
.dwRGBBitCount
)
364 /* This is the only format that can match here */
365 return WINED3DFMT_R3G3B2
;
368 /* Read the Color masks */
369 if( (DDPixelFormat
->u2
.dwRBitMask
== 0xF800) &&
370 (DDPixelFormat
->u3
.dwGBitMask
== 0x07E0) &&
371 (DDPixelFormat
->u4
.dwBBitMask
== 0x001F) )
373 return WINED3DFMT_R5G6B5
;
376 if( (DDPixelFormat
->u2
.dwRBitMask
== 0x7C00) &&
377 (DDPixelFormat
->u3
.dwGBitMask
== 0x03E0) &&
378 (DDPixelFormat
->u4
.dwBBitMask
== 0x001F) )
380 if( (DDPixelFormat
->dwFlags
& DDPF_ALPHAPIXELS
) &&
381 (DDPixelFormat
->u5
.dwRGBAlphaBitMask
== 0x8000))
382 return WINED3DFMT_A1R5G5B5
;
384 return WINED3DFMT_X1R5G5B5
;
387 if( (DDPixelFormat
->u2
.dwRBitMask
== 0x0F00) &&
388 (DDPixelFormat
->u3
.dwGBitMask
== 0x00F0) &&
389 (DDPixelFormat
->u4
.dwBBitMask
== 0x000F) )
391 if( (DDPixelFormat
->dwFlags
& DDPF_ALPHAPIXELS
) &&
392 (DDPixelFormat
->u5
.dwRGBAlphaBitMask
== 0xF000))
393 return WINED3DFMT_A4R4G4B4
;
395 return WINED3DFMT_X4R4G4B4
;
398 if( (DDPixelFormat
->dwFlags
& DDPF_ALPHAPIXELS
) &&
399 (DDPixelFormat
->u5
.dwRGBAlphaBitMask
== 0xFF00) &&
400 (DDPixelFormat
->u2
.dwRBitMask
== 0x00E0) &&
401 (DDPixelFormat
->u3
.dwGBitMask
== 0x001C) &&
402 (DDPixelFormat
->u4
.dwBBitMask
== 0x0003) )
404 return WINED3DFMT_A8R3G3B2
;
406 ERR("16 bit RGB Pixel format does not match\n");
407 return WINED3DFMT_UNKNOWN
;
410 return WINED3DFMT_R8G8B8
;
413 /* Read the Color masks */
414 if( (DDPixelFormat
->u2
.dwRBitMask
== 0x00FF0000) &&
415 (DDPixelFormat
->u3
.dwGBitMask
== 0x0000FF00) &&
416 (DDPixelFormat
->u4
.dwBBitMask
== 0x000000FF) )
418 if( (DDPixelFormat
->dwFlags
& DDPF_ALPHAPIXELS
) &&
419 (DDPixelFormat
->u5
.dwRGBAlphaBitMask
== 0xFF000000))
420 return WINED3DFMT_A8R8G8B8
;
422 return WINED3DFMT_X8R8G8B8
;
425 ERR("32 bit RGB pixel format does not match\n");
428 ERR("Invalid dwRGBBitCount in Pixelformat structure\n");
429 return WINED3DFMT_UNKNOWN
;
432 else if( (DDPixelFormat
->dwFlags
& DDPF_ALPHA
) )
434 /* Alpha only Pixelformat */
435 switch(DDPixelFormat
->u1
.dwAlphaBitDepth
)
440 ERR("Unsupported Alpha-Only bit depth 0x%x\n", DDPixelFormat
->u1
.dwAlphaBitDepth
);
442 return WINED3DFMT_A8
;
445 ERR("Invalid AlphaBitDepth in Alpha-Only Pixelformat\n");
446 return WINED3DFMT_UNKNOWN
;
449 else if(DDPixelFormat
->dwFlags
& DDPF_LUMINANCE
)
451 /* Luminance-only or luminance-alpha */
452 if(DDPixelFormat
->dwFlags
& DDPF_ALPHAPIXELS
)
454 /* Luminance with Alpha */
455 switch(DDPixelFormat
->u1
.dwLuminanceBitCount
)
458 if(DDPixelFormat
->u1
.dwAlphaBitDepth
== 4)
459 return WINED3DFMT_A4L4
;
460 ERR("Unknown Alpha / Luminance bit depth combination\n");
461 return WINED3DFMT_UNKNOWN
;
464 ERR("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now!!\n");
465 return WINED3DFMT_L6V5U5
;
468 if(DDPixelFormat
->u1
.dwAlphaBitDepth
== 8)
469 return WINED3DFMT_A8L8
;
470 ERR("Unknown Alpha / Lumincase bit depth combination\n");
471 return WINED3DFMT_UNKNOWN
;
477 switch(DDPixelFormat
->u1
.dwLuminanceBitCount
)
480 ERR("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now!!\n");
481 return WINED3DFMT_L6V5U5
;
484 return WINED3DFMT_L8
;
487 ERR("Unknown luminance-only bit depth 0x%x\n", DDPixelFormat
->u1
.dwLuminanceBitCount
);
488 return WINED3DFMT_UNKNOWN
;
492 else if(DDPixelFormat
->dwFlags
& DDPF_ZBUFFER
)
495 if(DDPixelFormat
->dwFlags
& DDPF_STENCILBUFFER
)
497 switch(DDPixelFormat
->u1
.dwZBufferBitDepth
)
500 ERR("8 Bits Z+Stencil buffer pixelformat is not supported. Returning WINED3DFMT_UNKNOWN\n");
501 return WINED3DFMT_UNKNOWN
;
505 if(DDPixelFormat
->u2
.dwStencilBitDepth
== 1)
506 return WINED3DFMT_D15S1
;
508 ERR("Don't know how to handle a 16 bit Z buffer with %d bit stencil buffer pixelformat\n", DDPixelFormat
->u2
.dwStencilBitDepth
);
509 return WINED3DFMT_UNKNOWN
;
512 ERR("Don't know how to handle a 24 bit depth buffer with stencil bits\n");
513 return WINED3DFMT_D24S8
;
516 if(DDPixelFormat
->u2
.dwStencilBitDepth
== 8)
517 return WINED3DFMT_D24S8
;
519 return WINED3DFMT_D24X4S4
;
522 ERR("Unknown Z buffer depth %d\n", DDPixelFormat
->u1
.dwZBufferBitDepth
);
523 return WINED3DFMT_UNKNOWN
;
528 switch(DDPixelFormat
->u1
.dwZBufferBitDepth
)
531 ERR("8 Bit Z buffers are not supported. Trying a 16 Bit one\n");
532 return WINED3DFMT_D16
;
535 return WINED3DFMT_D16
;
538 return WINED3DFMT_D24X8
;
541 return WINED3DFMT_D32
;
544 ERR("Unsupported Z buffer depth %d\n", DDPixelFormat
->u1
.dwZBufferBitDepth
);
545 return WINED3DFMT_UNKNOWN
;
549 else if(DDPixelFormat
->dwFlags
& DDPF_FOURCC
)
551 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('U', 'Y', 'V', 'Y'))
553 return WINED3DFMT_UYVY
;
555 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('Y', 'U', 'Y', '2'))
557 return WINED3DFMT_YUY2
;
559 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('D', 'X', 'T', '1'))
561 return WINED3DFMT_DXT1
;
563 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('D', 'X', 'T', '2'))
565 return WINED3DFMT_DXT2
;
567 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('D', 'X', 'T', '3'))
569 return WINED3DFMT_DXT3
;
571 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('D', 'X', 'T', '4'))
573 return WINED3DFMT_DXT4
;
575 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('D', 'X', 'T', '5'))
577 return WINED3DFMT_DXT5
;
579 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('G', 'R', 'G', 'B'))
581 return WINED3DFMT_G8R8_G8B8
;
583 if(DDPixelFormat
->dwFourCC
== MAKEFOURCC('R', 'G', 'B', 'G'))
585 return WINED3DFMT_R8G8_B8G8
;
587 return WINED3DFMT_UNKNOWN
; /* Abuse this as a error value */
589 else if(DDPixelFormat
->dwFlags
& DDPF_BUMPDUDV
)
591 if( (DDPixelFormat
->u1
.dwBumpBitCount
== 16 ) &&
592 (DDPixelFormat
->u2
.dwBumpDuBitMask
== 0x000000ff) &&
593 (DDPixelFormat
->u3
.dwBumpDvBitMask
== 0x0000ff00) &&
594 (DDPixelFormat
->u4
.dwBumpLuminanceBitMask
== 0x00000000) )
596 return WINED3DFMT_V8U8
;
598 else if ( (DDPixelFormat
->u1
.dwBumpBitCount
== 16 ) &&
599 (DDPixelFormat
->u2
.dwBumpDuBitMask
== 0x0000001f) &&
600 (DDPixelFormat
->u3
.dwBumpDvBitMask
== 0x000003e0) &&
601 (DDPixelFormat
->u4
.dwBumpLuminanceBitMask
== 0x0000fc00) )
603 return WINED3DFMT_L6V5U5
;
607 ERR("Unknown Pixelformat!\n");
608 return WINED3DFMT_UNKNOWN
;
611 /*****************************************************************************
612 * Various dumping functions.
614 * They write the contents of a specific function to a DPRINTF.
616 *****************************************************************************/
618 DDRAW_dump_DWORD(const void *in
)
620 DPRINTF("%d", *((const DWORD
*) in
));
623 DDRAW_dump_PTR(const void *in
)
625 DPRINTF("%p", *((const void * const*) in
));
628 DDRAW_dump_DDCOLORKEY(const DDCOLORKEY
*ddck
)
630 DPRINTF(" Low : %d - High : %d", ddck
->dwColorSpaceLowValue
, ddck
->dwColorSpaceHighValue
);
632 void DDRAW_dump_DDSCAPS2(const DDSCAPS2
*in
)
634 static const flag_info flags
[] = {
635 FE(DDSCAPS_RESERVED1
),
637 FE(DDSCAPS_BACKBUFFER
),
640 FE(DDSCAPS_FRONTBUFFER
),
641 FE(DDSCAPS_OFFSCREENPLAIN
),
644 FE(DDSCAPS_PRIMARYSURFACE
),
645 FE(DDSCAPS_PRIMARYSURFACELEFT
),
646 FE(DDSCAPS_SYSTEMMEMORY
),
648 FE(DDSCAPS_3DDEVICE
),
649 FE(DDSCAPS_VIDEOMEMORY
),
651 FE(DDSCAPS_WRITEONLY
),
654 FE(DDSCAPS_LIVEVIDEO
),
658 FE(DDSCAPS_RESERVED2
),
659 FE(DDSCAPS_ALLOCONLOAD
),
660 FE(DDSCAPS_VIDEOPORT
),
661 FE(DDSCAPS_LOCALVIDMEM
),
662 FE(DDSCAPS_NONLOCALVIDMEM
),
663 FE(DDSCAPS_STANDARDVGAMODE
),
664 FE(DDSCAPS_OPTIMIZED
)
666 static const flag_info flags2
[] = {
667 FE(DDSCAPS2_HARDWAREDEINTERLACE
),
668 FE(DDSCAPS2_HINTDYNAMIC
),
669 FE(DDSCAPS2_HINTSTATIC
),
670 FE(DDSCAPS2_TEXTUREMANAGE
),
671 FE(DDSCAPS2_RESERVED1
),
672 FE(DDSCAPS2_RESERVED2
),
674 FE(DDSCAPS2_HINTANTIALIASING
),
675 FE(DDSCAPS2_CUBEMAP
),
676 FE(DDSCAPS2_CUBEMAP_POSITIVEX
),
677 FE(DDSCAPS2_CUBEMAP_NEGATIVEX
),
678 FE(DDSCAPS2_CUBEMAP_POSITIVEY
),
679 FE(DDSCAPS2_CUBEMAP_NEGATIVEY
),
680 FE(DDSCAPS2_CUBEMAP_POSITIVEZ
),
681 FE(DDSCAPS2_CUBEMAP_NEGATIVEZ
),
682 FE(DDSCAPS2_MIPMAPSUBLEVEL
),
683 FE(DDSCAPS2_D3DTEXTUREMANAGE
),
684 FE(DDSCAPS2_DONOTPERSIST
),
685 FE(DDSCAPS2_STEREOSURFACELEFT
)
688 DDRAW_dump_flags_(in
->dwCaps
, flags
, sizeof(flags
)/sizeof(flags
[0]), 0);
689 DDRAW_dump_flags_(in
->dwCaps2
, flags2
, sizeof(flags2
)/sizeof(flags2
[0]), 0);
693 DDRAW_dump_DDSCAPS(const DDSCAPS
*in
)
697 in_bis
.dwCaps
= in
->dwCaps
;
702 DDRAW_dump_DDSCAPS2(&in_bis
);
706 DDRAW_dump_flags_(DWORD flags
,
707 const flag_info
* names
,
713 for (i
=0; i
< num_names
; i
++)
714 if ((flags
& names
[i
].val
) || /* standard flag value */
715 ((!flags
) && (!names
[i
].val
))) /* zero value only */
716 DPRINTF("%s ", names
[i
].name
);
723 DDRAW_dump_pixelformat_flag(DWORD flagmask
)
725 static const flag_info flags
[] =
727 FE(DDPF_ALPHAPIXELS
),
730 FE(DDPF_PALETTEINDEXED4
),
731 FE(DDPF_PALETTEINDEXEDTO8
),
732 FE(DDPF_PALETTEINDEXED8
),
738 FE(DDPF_PALETTEINDEXED1
),
739 FE(DDPF_PALETTEINDEXED2
),
743 DDRAW_dump_flags_(flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]), 0);
747 DDRAW_dump_members(DWORD flags
,
749 const member_info
* mems
,
754 for (i
=0; i
< num_mems
; i
++)
756 if (mems
[i
].val
& flags
)
758 DPRINTF(" - %s : ", mems
[i
].name
);
759 mems
[i
].func((const char *)data
+ mems
[i
].offset
);
766 DDRAW_dump_pixelformat(const DDPIXELFORMAT
*pf
)
769 DDRAW_dump_pixelformat_flag(pf
->dwFlags
);
770 if (pf
->dwFlags
& DDPF_FOURCC
)
772 DPRINTF(", dwFourCC code '%c%c%c%c' (0x%08x) - %d bits per pixel",
773 (unsigned char)( pf
->dwFourCC
&0xff),
774 (unsigned char)((pf
->dwFourCC
>> 8)&0xff),
775 (unsigned char)((pf
->dwFourCC
>>16)&0xff),
776 (unsigned char)((pf
->dwFourCC
>>24)&0xff),
781 if (pf
->dwFlags
& DDPF_RGB
)
784 DPRINTF(", RGB bits: %d, ", pf
->u1
.dwRGBBitCount
);
785 switch (pf
->u1
.dwRGBBitCount
)
787 case 4: cmd
= "%1lx"; break;
788 case 8: cmd
= "%02lx"; break;
789 case 16: cmd
= "%04lx"; break;
790 case 24: cmd
= "%06lx"; break;
791 case 32: cmd
= "%08lx"; break;
792 default: ERR("Unexpected bit depth !\n"); cmd
= "%d"; break;
794 DPRINTF(" R "); DPRINTF(cmd
, pf
->u2
.dwRBitMask
);
795 DPRINTF(" G "); DPRINTF(cmd
, pf
->u3
.dwGBitMask
);
796 DPRINTF(" B "); DPRINTF(cmd
, pf
->u4
.dwBBitMask
);
797 if (pf
->dwFlags
& DDPF_ALPHAPIXELS
)
799 DPRINTF(" A "); DPRINTF(cmd
, pf
->u5
.dwRGBAlphaBitMask
);
801 if (pf
->dwFlags
& DDPF_ZPIXELS
)
803 DPRINTF(" Z "); DPRINTF(cmd
, pf
->u5
.dwRGBZBitMask
);
806 if (pf
->dwFlags
& DDPF_ZBUFFER
)
808 DPRINTF(", Z bits : %d", pf
->u1
.dwZBufferBitDepth
);
810 if (pf
->dwFlags
& DDPF_ALPHA
)
812 DPRINTF(", Alpha bits : %d", pf
->u1
.dwAlphaBitDepth
);
814 if (pf
->dwFlags
& DDPF_BUMPDUDV
)
816 const char *cmd
= "%08lx";
817 DPRINTF(", Bump bits: %d, ", pf
->u1
.dwBumpBitCount
);
818 DPRINTF(" U "); DPRINTF(cmd
, pf
->u2
.dwBumpDuBitMask
);
819 DPRINTF(" V "); DPRINTF(cmd
, pf
->u3
.dwBumpDvBitMask
);
820 DPRINTF(" L "); DPRINTF(cmd
, pf
->u4
.dwBumpLuminanceBitMask
);
825 void DDRAW_dump_surface_desc(const DDSURFACEDESC2
*lpddsd
)
827 #define STRUCT DDSURFACEDESC2
828 static const member_info members
[] =
830 ME(DDSD_HEIGHT
, DDRAW_dump_DWORD
, dwHeight
),
831 ME(DDSD_WIDTH
, DDRAW_dump_DWORD
, dwWidth
),
832 ME(DDSD_PITCH
, DDRAW_dump_DWORD
, u1
/* lPitch */),
833 ME(DDSD_LINEARSIZE
, DDRAW_dump_DWORD
, u1
/* dwLinearSize */),
834 ME(DDSD_BACKBUFFERCOUNT
, DDRAW_dump_DWORD
, dwBackBufferCount
),
835 ME(DDSD_MIPMAPCOUNT
, DDRAW_dump_DWORD
, u2
/* dwMipMapCount */),
836 ME(DDSD_ZBUFFERBITDEPTH
, DDRAW_dump_DWORD
, u2
/* dwZBufferBitDepth */), /* This is for 'old-style' D3D */
837 ME(DDSD_REFRESHRATE
, DDRAW_dump_DWORD
, u2
/* dwRefreshRate */),
838 ME(DDSD_ALPHABITDEPTH
, DDRAW_dump_DWORD
, dwAlphaBitDepth
),
839 ME(DDSD_LPSURFACE
, DDRAW_dump_PTR
, lpSurface
),
840 ME(DDSD_CKDESTOVERLAY
, DDRAW_dump_DDCOLORKEY
, u3
/* ddckCKDestOverlay */),
841 ME(DDSD_CKDESTBLT
, DDRAW_dump_DDCOLORKEY
, ddckCKDestBlt
),
842 ME(DDSD_CKSRCOVERLAY
, DDRAW_dump_DDCOLORKEY
, ddckCKSrcOverlay
),
843 ME(DDSD_CKSRCBLT
, DDRAW_dump_DDCOLORKEY
, ddckCKSrcBlt
),
844 ME(DDSD_PIXELFORMAT
, DDRAW_dump_pixelformat
, u4
/* ddpfPixelFormat */)
846 static const member_info members_caps
[] =
848 ME(DDSD_CAPS
, DDRAW_dump_DDSCAPS
, ddsCaps
)
850 static const member_info members_caps2
[] =
852 ME(DDSD_CAPS
, DDRAW_dump_DDSCAPS2
, ddsCaps
)
862 if (lpddsd
->dwSize
>= sizeof(DDSURFACEDESC2
))
864 DDRAW_dump_members(lpddsd
->dwFlags
, lpddsd
, members_caps2
, 1);
868 DDRAW_dump_members(lpddsd
->dwFlags
, lpddsd
, members_caps
, 1);
870 DDRAW_dump_members(lpddsd
->dwFlags
, lpddsd
, members
,
871 sizeof(members
)/sizeof(members
[0]));
876 dump_D3DMATRIX(D3DMATRIX
*mat
)
878 DPRINTF(" %f %f %f %f\n", mat
->_11
, mat
->_12
, mat
->_13
, mat
->_14
);
879 DPRINTF(" %f %f %f %f\n", mat
->_21
, mat
->_22
, mat
->_23
, mat
->_24
);
880 DPRINTF(" %f %f %f %f\n", mat
->_31
, mat
->_32
, mat
->_33
, mat
->_34
);
881 DPRINTF(" %f %f %f %f\n", mat
->_41
, mat
->_42
, mat
->_43
, mat
->_44
);
885 get_flexible_vertex_size(DWORD d3dvtVertexType
)
890 if (d3dvtVertexType
& D3DFVF_NORMAL
) size
+= 3 * sizeof(D3DVALUE
);
891 if (d3dvtVertexType
& D3DFVF_DIFFUSE
) size
+= sizeof(DWORD
);
892 if (d3dvtVertexType
& D3DFVF_SPECULAR
) size
+= sizeof(DWORD
);
893 if (d3dvtVertexType
& D3DFVF_RESERVED1
) size
+= sizeof(DWORD
);
894 switch (d3dvtVertexType
& D3DFVF_POSITION_MASK
)
896 case D3DFVF_XYZ
: size
+= 3 * sizeof(D3DVALUE
); break;
897 case D3DFVF_XYZRHW
: size
+= 4 * sizeof(D3DVALUE
); break;
898 default: TRACE(" matrix weighting not handled yet...\n");
900 for (i
= 0; i
< GET_TEXCOUNT_FROM_FVF(d3dvtVertexType
); i
++)
902 size
+= GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType
, i
) * sizeof(D3DVALUE
);
908 void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS
* pIn
, DDSCAPS2
* pOut
)
910 /* 2 adds three additional caps fields to the end. Both versions
911 * are unversioned. */
912 pOut
->dwCaps
= pIn
->dwCaps
;
918 void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2
* pIn
, DDDEVICEIDENTIFIER
* pOut
)
920 /* 2 adds a dwWHQLLevel field to the end. Both structures are
922 memcpy(pOut
, pIn
, sizeof(*pOut
));
925 void DDRAW_dump_cooperativelevel(DWORD cooplevel
)
927 static const flag_info flags
[] =
929 FE(DDSCL_FULLSCREEN
),
930 FE(DDSCL_ALLOWREBOOT
),
931 FE(DDSCL_NOWINDOWCHANGES
),
933 FE(DDSCL_ALLOWMODEX
),
935 FE(DDSCL_SETFOCUSWINDOW
),
936 FE(DDSCL_SETDEVICEWINDOW
),
937 FE(DDSCL_CREATEDEVICEWINDOW
)
943 DDRAW_dump_flags(cooplevel
, flags
, sizeof(flags
)/sizeof(flags
[0]));
947 void DDRAW_dump_DDCAPS(const DDCAPS
*lpcaps
)
949 static const flag_info flags1
[] =
952 FE(DDCAPS_ALIGNBOUNDARYDEST
),
953 FE(DDCAPS_ALIGNSIZEDEST
),
954 FE(DDCAPS_ALIGNBOUNDARYSRC
),
955 FE(DDCAPS_ALIGNSIZESRC
),
956 FE(DDCAPS_ALIGNSTRIDE
),
959 FE(DDCAPS_BLTFOURCC
),
960 FE(DDCAPS_BLTSTRETCH
),
963 FE(DDCAPS_OVERLAYCANTCLIP
),
964 FE(DDCAPS_OVERLAYFOURCC
),
965 FE(DDCAPS_OVERLAYSTRETCH
),
967 FE(DDCAPS_PALETTEVSYNC
),
968 FE(DDCAPS_READSCANLINE
),
969 FE(DDCAPS_STEREOVIEW
),
972 FE(DDCAPS_ZOVERLAYS
),
975 FE(DDCAPS_COLORKEYHWASSIST
),
976 FE(DDCAPS_NOHARDWARE
),
977 FE(DDCAPS_BLTCOLORFILL
),
978 FE(DDCAPS_BANKSWITCHED
),
979 FE(DDCAPS_BLTDEPTHFILL
),
981 FE(DDCAPS_CANCLIPSTRETCHED
),
982 FE(DDCAPS_CANBLTSYSMEM
)
984 static const flag_info flags2
[] =
986 FE(DDCAPS2_CERTIFIED
),
987 FE(DDCAPS2_NO2DDURING3DSCENE
),
988 FE(DDCAPS2_VIDEOPORT
),
989 FE(DDCAPS2_AUTOFLIPOVERLAY
),
990 FE(DDCAPS2_CANBOBINTERLEAVED
),
991 FE(DDCAPS2_CANBOBNONINTERLEAVED
),
992 FE(DDCAPS2_COLORCONTROLOVERLAY
),
993 FE(DDCAPS2_COLORCONTROLPRIMARY
),
994 FE(DDCAPS2_CANDROPZ16BIT
),
995 FE(DDCAPS2_NONLOCALVIDMEM
),
996 FE(DDCAPS2_NONLOCALVIDMEMCAPS
),
997 FE(DDCAPS2_NOPAGELOCKREQUIRED
),
998 FE(DDCAPS2_WIDESURFACES
),
999 FE(DDCAPS2_CANFLIPODDEVEN
),
1000 FE(DDCAPS2_CANBOBHARDWARE
),
1001 FE(DDCAPS2_COPYFOURCC
),
1002 FE(DDCAPS2_PRIMARYGAMMA
),
1003 FE(DDCAPS2_CANRENDERWINDOWED
),
1004 FE(DDCAPS2_CANCALIBRATEGAMMA
),
1005 FE(DDCAPS2_FLIPINTERVAL
),
1006 FE(DDCAPS2_FLIPNOVSYNC
),
1007 FE(DDCAPS2_CANMANAGETEXTURE
),
1008 FE(DDCAPS2_TEXMANINNONLOCALVIDMEM
),
1010 FE(DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL
)
1012 static const flag_info flags3
[] =
1014 FE(DDCKEYCAPS_DESTBLT
),
1015 FE(DDCKEYCAPS_DESTBLTCLRSPACE
),
1016 FE(DDCKEYCAPS_DESTBLTCLRSPACEYUV
),
1017 FE(DDCKEYCAPS_DESTBLTYUV
),
1018 FE(DDCKEYCAPS_DESTOVERLAY
),
1019 FE(DDCKEYCAPS_DESTOVERLAYCLRSPACE
),
1020 FE(DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV
),
1021 FE(DDCKEYCAPS_DESTOVERLAYONEACTIVE
),
1022 FE(DDCKEYCAPS_DESTOVERLAYYUV
),
1023 FE(DDCKEYCAPS_SRCBLT
),
1024 FE(DDCKEYCAPS_SRCBLTCLRSPACE
),
1025 FE(DDCKEYCAPS_SRCBLTCLRSPACEYUV
),
1026 FE(DDCKEYCAPS_SRCBLTYUV
),
1027 FE(DDCKEYCAPS_SRCOVERLAY
),
1028 FE(DDCKEYCAPS_SRCOVERLAYCLRSPACE
),
1029 FE(DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV
),
1030 FE(DDCKEYCAPS_SRCOVERLAYONEACTIVE
),
1031 FE(DDCKEYCAPS_SRCOVERLAYYUV
),
1032 FE(DDCKEYCAPS_NOCOSTOVERLAY
)
1034 static const flag_info flags4
[] =
1036 FE(DDFXCAPS_BLTALPHA
),
1037 FE(DDFXCAPS_OVERLAYALPHA
),
1038 FE(DDFXCAPS_BLTARITHSTRETCHYN
),
1039 FE(DDFXCAPS_BLTARITHSTRETCHY
),
1040 FE(DDFXCAPS_BLTMIRRORLEFTRIGHT
),
1041 FE(DDFXCAPS_BLTMIRRORUPDOWN
),
1042 FE(DDFXCAPS_BLTROTATION
),
1043 FE(DDFXCAPS_BLTROTATION90
),
1044 FE(DDFXCAPS_BLTSHRINKX
),
1045 FE(DDFXCAPS_BLTSHRINKXN
),
1046 FE(DDFXCAPS_BLTSHRINKY
),
1047 FE(DDFXCAPS_BLTSHRINKYN
),
1048 FE(DDFXCAPS_BLTSTRETCHX
),
1049 FE(DDFXCAPS_BLTSTRETCHXN
),
1050 FE(DDFXCAPS_BLTSTRETCHY
),
1051 FE(DDFXCAPS_BLTSTRETCHYN
),
1052 FE(DDFXCAPS_OVERLAYARITHSTRETCHY
),
1053 FE(DDFXCAPS_OVERLAYARITHSTRETCHYN
),
1054 FE(DDFXCAPS_OVERLAYSHRINKX
),
1055 FE(DDFXCAPS_OVERLAYSHRINKXN
),
1056 FE(DDFXCAPS_OVERLAYSHRINKY
),
1057 FE(DDFXCAPS_OVERLAYSHRINKYN
),
1058 FE(DDFXCAPS_OVERLAYSTRETCHX
),
1059 FE(DDFXCAPS_OVERLAYSTRETCHXN
),
1060 FE(DDFXCAPS_OVERLAYSTRETCHY
),
1061 FE(DDFXCAPS_OVERLAYSTRETCHYN
),
1062 FE(DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
),
1063 FE(DDFXCAPS_OVERLAYMIRRORUPDOWN
)
1065 static const flag_info flags5
[] =
1067 FE(DDFXALPHACAPS_BLTALPHAEDGEBLEND
),
1068 FE(DDFXALPHACAPS_BLTALPHAPIXELS
),
1069 FE(DDFXALPHACAPS_BLTALPHAPIXELSNEG
),
1070 FE(DDFXALPHACAPS_BLTALPHASURFACES
),
1071 FE(DDFXALPHACAPS_BLTALPHASURFACESNEG
),
1072 FE(DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND
),
1073 FE(DDFXALPHACAPS_OVERLAYALPHAPIXELS
),
1074 FE(DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG
),
1075 FE(DDFXALPHACAPS_OVERLAYALPHASURFACES
),
1076 FE(DDFXALPHACAPS_OVERLAYALPHASURFACESNEG
)
1078 static const flag_info flags6
[] =
1081 FE(DDPCAPS_8BITENTRIES
),
1083 FE(DDPCAPS_INITIALIZE
),
1084 FE(DDPCAPS_PRIMARYSURFACE
),
1085 FE(DDPCAPS_PRIMARYSURFACELEFT
),
1086 FE(DDPCAPS_ALLOW256
),
1092 static const flag_info flags7
[] =
1094 FE(DDSVCAPS_RESERVED1
),
1095 FE(DDSVCAPS_RESERVED2
),
1096 FE(DDSVCAPS_RESERVED3
),
1097 FE(DDSVCAPS_RESERVED4
),
1098 FE(DDSVCAPS_STEREOSEQUENTIAL
),
1101 DPRINTF(" - dwSize : %d\n", lpcaps
->dwSize
);
1102 DPRINTF(" - dwCaps : "); DDRAW_dump_flags(lpcaps
->dwCaps
, flags1
, sizeof(flags1
)/sizeof(flags1
[0]));
1103 DPRINTF(" - dwCaps2 : "); DDRAW_dump_flags(lpcaps
->dwCaps2
, flags2
, sizeof(flags2
)/sizeof(flags2
[0]));
1104 DPRINTF(" - dwCKeyCaps : "); DDRAW_dump_flags(lpcaps
->dwCKeyCaps
, flags3
, sizeof(flags3
)/sizeof(flags3
[0]));
1105 DPRINTF(" - dwFXCaps : "); DDRAW_dump_flags(lpcaps
->dwFXCaps
, flags4
, sizeof(flags4
)/sizeof(flags4
[0]));
1106 DPRINTF(" - dwFXAlphaCaps : "); DDRAW_dump_flags(lpcaps
->dwFXAlphaCaps
, flags5
, sizeof(flags5
)/sizeof(flags5
[0]));
1107 DPRINTF(" - dwPalCaps : "); DDRAW_dump_flags(lpcaps
->dwPalCaps
, flags6
, sizeof(flags6
)/sizeof(flags6
[0]));
1108 DPRINTF(" - dwSVCaps : "); DDRAW_dump_flags(lpcaps
->dwSVCaps
, flags7
, sizeof(flags7
)/sizeof(flags7
[0]));
1110 DPRINTF(" - dwNumFourCCCodes : %d\n", lpcaps
->dwNumFourCCCodes
);
1111 DPRINTF(" - dwCurrVisibleOverlays : %d\n", lpcaps
->dwCurrVisibleOverlays
);
1112 DPRINTF(" - dwMinOverlayStretch : %d\n", lpcaps
->dwMinOverlayStretch
);
1113 DPRINTF(" - dwMaxOverlayStretch : %d\n", lpcaps
->dwMaxOverlayStretch
);
1115 DPRINTF(" - ddsCaps : "); DDRAW_dump_DDSCAPS2(&lpcaps
->ddsCaps
); DPRINTF("\n");
1118 /*****************************************************************************
1121 * Multiplies 2 4x4 matrices src1 and src2, and stores the result in dest.
1124 * dest: Pointer to the destination matrix
1125 * src1: Pointer to the first source matrix
1126 * src2: Pointer to the second source matrix
1128 *****************************************************************************/
1130 multiply_matrix(D3DMATRIX
*dest
,
1136 /* Now do the multiplication 'by hand'.
1137 I know that all this could be optimised, but this will be done later :-) */
1138 temp
._11
= (src1
->_11
* src2
->_11
) + (src1
->_21
* src2
->_12
) + (src1
->_31
* src2
->_13
) + (src1
->_41
* src2
->_14
);
1139 temp
._21
= (src1
->_11
* src2
->_21
) + (src1
->_21
* src2
->_22
) + (src1
->_31
* src2
->_23
) + (src1
->_41
* src2
->_24
);
1140 temp
._31
= (src1
->_11
* src2
->_31
) + (src1
->_21
* src2
->_32
) + (src1
->_31
* src2
->_33
) + (src1
->_41
* src2
->_34
);
1141 temp
._41
= (src1
->_11
* src2
->_41
) + (src1
->_21
* src2
->_42
) + (src1
->_31
* src2
->_43
) + (src1
->_41
* src2
->_44
);
1143 temp
._12
= (src1
->_12
* src2
->_11
) + (src1
->_22
* src2
->_12
) + (src1
->_32
* src2
->_13
) + (src1
->_42
* src2
->_14
);
1144 temp
._22
= (src1
->_12
* src2
->_21
) + (src1
->_22
* src2
->_22
) + (src1
->_32
* src2
->_23
) + (src1
->_42
* src2
->_24
);
1145 temp
._32
= (src1
->_12
* src2
->_31
) + (src1
->_22
* src2
->_32
) + (src1
->_32
* src2
->_33
) + (src1
->_42
* src2
->_34
);
1146 temp
._42
= (src1
->_12
* src2
->_41
) + (src1
->_22
* src2
->_42
) + (src1
->_32
* src2
->_43
) + (src1
->_42
* src2
->_44
);
1148 temp
._13
= (src1
->_13
* src2
->_11
) + (src1
->_23
* src2
->_12
) + (src1
->_33
* src2
->_13
) + (src1
->_43
* src2
->_14
);
1149 temp
._23
= (src1
->_13
* src2
->_21
) + (src1
->_23
* src2
->_22
) + (src1
->_33
* src2
->_23
) + (src1
->_43
* src2
->_24
);
1150 temp
._33
= (src1
->_13
* src2
->_31
) + (src1
->_23
* src2
->_32
) + (src1
->_33
* src2
->_33
) + (src1
->_43
* src2
->_34
);
1151 temp
._43
= (src1
->_13
* src2
->_41
) + (src1
->_23
* src2
->_42
) + (src1
->_33
* src2
->_43
) + (src1
->_43
* src2
->_44
);
1153 temp
._14
= (src1
->_14
* src2
->_11
) + (src1
->_24
* src2
->_12
) + (src1
->_34
* src2
->_13
) + (src1
->_44
* src2
->_14
);
1154 temp
._24
= (src1
->_14
* src2
->_21
) + (src1
->_24
* src2
->_22
) + (src1
->_34
* src2
->_23
) + (src1
->_44
* src2
->_24
);
1155 temp
._34
= (src1
->_14
* src2
->_31
) + (src1
->_24
* src2
->_32
) + (src1
->_34
* src2
->_33
) + (src1
->_44
* src2
->_34
);
1156 temp
._44
= (src1
->_14
* src2
->_41
) + (src1
->_24
* src2
->_42
) + (src1
->_34
* src2
->_43
) + (src1
->_44
* src2
->_44
);
1158 /* And copy the new matrix in the good storage.. */
1159 memcpy(dest
, &temp
, 16 * sizeof(D3DVALUE
));
1164 hr_ddraw_from_wined3d(HRESULT hr
)
1168 case WINED3DERR_INVALIDCALL
: return DDERR_INVALIDPARAMS
;