Const correctness, pointer cast correctness, removed extraneous ';'.
[wine.git] / dlls / d3d8 / directx.c
blobb5a9cb794c36ef10b99a624356464898a90a01d8
1 /*
2 * IDirect3D8 implementation
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2003-2004 Raphael Junqueira
6 * Copyright 2004 Christian Costa
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "config.h"
25 #include <stdarg.h>
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 #include "d3d8_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
39 WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
41 /* x11drv GDI escapes */
42 #define X11DRV_ESCAPE 6789
43 enum x11drv_escape_codes
45 X11DRV_GET_DISPLAY, /* get X11 display for a DC */
46 X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
47 X11DRV_GET_FONT, /* get current X font for a DC */
50 #define NUM_FORMATS 7
51 static const D3DFORMAT device_formats[NUM_FORMATS] = {
52 D3DFMT_P8,
53 D3DFMT_R3G3B2,
54 D3DFMT_R5G6B5,
55 D3DFMT_X1R5G5B5,
56 D3DFMT_X4R4G4B4,
57 D3DFMT_R8G8B8,
58 D3DFMT_X8R8G8B8
61 static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display);
64 /* retrieve the X display to use on a given DC */
65 inline static Display *get_display( HDC hdc )
67 Display *display;
68 enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
70 if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
71 sizeof(display), (LPSTR)&display )) display = NULL;
72 return display;
75 /**
76 * Note: GL seems to trap if GetDeviceCaps is called before any HWND's created
77 * ie there is no GL Context - Get a default rendering context to enable the
78 * function query some info from GL
79 */
80 static
81 WineD3D_Context* WineD3DCreateFakeGLContext(void) {
82 static WineD3D_Context ctx = { NULL, NULL, NULL, 0, 0 };
83 WineD3D_Context* ret = NULL;
85 if (glXGetCurrentContext() == NULL) {
86 BOOL gotContext = FALSE;
87 BOOL created = FALSE;
88 XVisualInfo template;
89 HDC device_context;
90 Visual* visual;
91 BOOL failed = FALSE;
92 int num;
93 XWindowAttributes win_attr;
95 TRACE_(d3d_caps)("Creating Fake GL Context\n");
97 ctx.drawable = (Drawable) GetPropA(GetDesktopWindow(), "__wine_x11_whole_window");
99 /* Get the display */
100 device_context = GetDC(0);
101 ctx.display = get_display(device_context);
102 ReleaseDC(0, device_context);
104 /* Get the X visual */
105 ENTER_GL();
106 if (XGetWindowAttributes(ctx.display, ctx.drawable, &win_attr)) {
107 visual = win_attr.visual;
108 } else {
109 visual = DefaultVisual(ctx.display, DefaultScreen(ctx.display));
111 template.visualid = XVisualIDFromVisual(visual);
112 ctx.visInfo = XGetVisualInfo(ctx.display, VisualIDMask, &template, &num);
113 if (ctx.visInfo == NULL) {
114 LEAVE_GL();
115 WARN_(d3d_caps)("Error creating visual info for capabilities initialization\n");
116 failed = TRUE;
119 /* Create a GL context */
120 if (!failed) {
121 ctx.glCtx = glXCreateContext(ctx.display, ctx.visInfo, NULL, GL_TRUE);
123 if (ctx.glCtx == NULL) {
124 LEAVE_GL();
125 WARN_(d3d_caps)("Error creating default context for capabilities initialization\n");
126 failed = TRUE;
130 /* Make it the current GL context */
131 if (!failed && glXMakeCurrent(ctx.display, ctx.drawable, ctx.glCtx) == False) {
132 glXDestroyContext(ctx.display, ctx.glCtx);
133 LEAVE_GL();
134 WARN_(d3d_caps)("Error setting default context as current for capabilities initialization\n");
135 failed = TRUE;
138 /* It worked! Wow... */
139 if (!failed) {
140 gotContext = TRUE;
141 created = TRUE;
142 ret = &ctx;
143 } else {
144 ret = NULL;
146 } else {
147 if (ctx.ref > 0) ret = &ctx;
150 if (NULL != ret) ++ret->ref;
152 return ret;
155 static
156 void WineD3DReleaseFakeGLContext(WineD3D_Context* ctx) {
157 /* If we created a dummy context, throw it away */
158 if (NULL != ctx) {
159 --ctx->ref;
160 if (0 == ctx->ref) {
161 glXMakeCurrent(ctx->display, None, NULL);
162 glXDestroyContext(ctx->display, ctx->glCtx);
163 ctx->display = NULL;
164 ctx->glCtx = NULL;
165 LEAVE_GL();
171 /* IDirect3D IUnknown parts follow: */
172 HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface,REFIID riid,LPVOID *ppobj)
174 ICOM_THIS(IDirect3D8Impl,iface);
176 if (IsEqualGUID(riid, &IID_IUnknown)
177 || IsEqualGUID(riid, &IID_IDirect3D8)) {
178 IDirect3D8Impl_AddRef(iface);
179 *ppobj = This;
180 return D3D_OK;
183 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
184 return E_NOINTERFACE;
187 ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) {
188 ICOM_THIS(IDirect3D8Impl,iface);
189 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
190 return ++(This->ref);
193 ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) {
194 ICOM_THIS(IDirect3D8Impl,iface);
195 ULONG ref = --This->ref;
196 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
197 if (ref == 0)
198 HeapFree(GetProcessHeap(), 0, This);
199 return ref;
202 /* IDirect3D Interface follow: */
203 HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) {
204 ICOM_THIS(IDirect3D8Impl,iface);
205 FIXME_(d3d_caps)("(%p)->(%p): stub\n", This, pInitializeFunction);
206 return D3D_OK;
209 UINT WINAPI IDirect3D8Impl_GetAdapterCount (LPDIRECT3D8 iface) {
210 ICOM_THIS(IDirect3D8Impl,iface);
211 /* FIXME: Set to one for now to imply the display */
212 TRACE_(d3d_caps)("(%p): Mostly stub, only returns primary display\n", This);
213 return 1;
216 HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
217 UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) {
218 ICOM_THIS(IDirect3D8Impl,iface);
220 TRACE_(d3d_caps)("(%p}->(Adapter: %d, Flags: %lx, pId=%p)\n", This, Adapter, Flags, pIdentifier);
222 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
223 return D3DERR_INVALIDCALL;
226 if (Adapter == 0) { /* Display */
227 /* If we don't know the device settings, go query them now */
228 if (This->isGLInfoValid == FALSE) {
229 WineD3D_Context* ctx = WineD3DCreateFakeGLContext();
230 if (NULL != ctx) IDirect3D8Impl_FillGLCaps(iface, ctx->display);
231 WineD3DReleaseFakeGLContext(ctx);
233 if (This->isGLInfoValid == TRUE) {
234 TRACE_(d3d_caps)("device/Vendor Name and Version detection using FillGLCaps\n");
235 strcpy(pIdentifier->Driver, "Display");
236 strcpy(pIdentifier->Description, "Direct3D HAL");
237 pIdentifier->DriverVersion.u.HighPart = 0xa;
238 pIdentifier->DriverVersion.u.LowPart = This->gl_info.gl_driver_version;
239 pIdentifier->VendorId = This->gl_info.gl_vendor;
240 pIdentifier->DeviceId = This->gl_info.gl_card;
241 pIdentifier->SubSysId = 0;
242 pIdentifier->Revision = 0;
243 } else {
244 WARN_(d3d_caps)("Cannot get GLCaps for device/Vendor Name and Version detection using FillGLCaps, currently using NVIDIA identifiers\n");
245 strcpy(pIdentifier->Driver, "Display");
246 strcpy(pIdentifier->Description, "Direct3D HAL");
247 pIdentifier->DriverVersion.u.HighPart = 0xa;
248 pIdentifier->DriverVersion.u.LowPart = MAKEDWORD_VERSION(53, 96); /* last Linux Nvidia drivers */
249 pIdentifier->VendorId = VENDOR_NVIDIA;
250 pIdentifier->DeviceId = CARD_NVIDIA_GEFORCE4_TI4600;
251 pIdentifier->SubSysId = 0;
252 pIdentifier->Revision = 0;
254 /*FIXME: memcpy(&pIdentifier->DeviceIdentifier, ??, sizeof(??GUID)); */
255 if (Flags & D3DENUM_NO_WHQL_LEVEL) {
256 pIdentifier->WHQLLevel = 0;
257 } else {
258 pIdentifier->WHQLLevel = 1;
260 } else {
261 FIXME_(d3d_caps)("Adapter not primary display\n");
264 return D3D_OK;
268 /*#define DEBUG_SINGLE_MODE*/
269 #undef DEBUG_SINGLE_MODE
271 UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,
272 UINT Adapter) {
273 ICOM_THIS(IDirect3D8Impl,iface);
275 TRACE_(d3d_caps)("(%p}->(Adapter: %d)\n", This, Adapter);
277 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
278 return D3DERR_INVALIDCALL;
281 if (Adapter == 0) { /* Display */
282 int i = 0;
283 #if !defined( DEBUG_SINGLE_MODE )
284 DEVMODEW DevModeW;
285 while (EnumDisplaySettingsExW(NULL, i, &DevModeW, 0)) {
286 i++;
288 #else
289 i = 1;
290 #endif
292 TRACE_(d3d_caps)("(%p}->(Adapter: %d) => %d\n", This, Adapter, i);
293 return i;
294 } else {
295 FIXME_(d3d_caps)("Adapter not primary display\n");
298 return 0;
301 HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
302 UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) {
303 ICOM_THIS(IDirect3D8Impl,iface);
305 TRACE_(d3d_caps)("(%p}->(Adapter:%d, mode:%d, pMode:%p)\n", This, Adapter, Mode, pMode);
307 if (NULL == pMode ||
308 Adapter >= IDirect3D8Impl_GetAdapterCount(iface) ||
309 Mode >= IDirect3D8Impl_GetAdapterModeCount(iface, Adapter)) {
310 return D3DERR_INVALIDCALL;
313 if (Adapter == 0) { /* Display */
314 int bpp = 0;
315 #if !defined( DEBUG_SINGLE_MODE )
316 HDC hdc;
317 DEVMODEW DevModeW;
319 if (EnumDisplaySettingsExW(NULL, Mode, &DevModeW, 0))
321 pMode->Width = DevModeW.dmPelsWidth;
322 pMode->Height = DevModeW.dmPelsHeight;
323 bpp = DevModeW.dmBitsPerPel;
324 pMode->RefreshRate = D3DADAPTER_DEFAULT;
325 if (DevModeW.dmFields&DM_DISPLAYFREQUENCY)
327 pMode->RefreshRate = DevModeW.dmDisplayFrequency;
330 else
332 TRACE_(d3d_caps)("Requested mode out of range %d\n", Mode);
333 return D3DERR_INVALIDCALL;
336 hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
337 bpp = min(GetDeviceCaps(hdc, BITSPIXEL), bpp);
338 DeleteDC(hdc);
340 switch (bpp) {
341 case 8: pMode->Format = D3DFMT_R3G3B2; break;
342 case 16: pMode->Format = D3DFMT_R5G6B5; break;
343 case 24: /* pMode->Format = D3DFMT_R5G6B5; break;*/ /* Make 24bit appear as 32 bit */
344 case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
345 default: pMode->Format = D3DFMT_UNKNOWN;
347 #else
348 if (Mode > 0) return D3DERR_INVALIDCALL;
349 pMode->Width = 800;
350 pMode->Height = 600;
351 pMode->RefreshRate = D3DADAPTER_DEFAULT;
352 pMode->Format = D3DFMT_A8R8G8B8;
353 bpp = 32;
354 #endif
355 TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x,%s) bpp %u\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format, debug_d3dformat(pMode->Format), bpp);
357 } else {
358 FIXME_(d3d_caps)("Adapter not primary display\n");
361 return D3D_OK;
364 HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface,
365 UINT Adapter, D3DDISPLAYMODE* pMode) {
366 ICOM_THIS(IDirect3D8Impl,iface);
367 TRACE_(d3d_caps)("(%p}->(Adapter: %d, pMode: %p)\n", This, Adapter, pMode);
369 if (NULL == pMode ||
370 Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
371 return D3DERR_INVALIDCALL;
374 if (Adapter == 0) { /* Display */
375 int bpp = 0;
376 DEVMODEW DevModeW;
378 EnumDisplaySettingsExW(NULL, (DWORD)-1, &DevModeW, 0);
379 pMode->Width = DevModeW.dmPelsWidth;
380 pMode->Height = DevModeW.dmPelsHeight;
381 bpp = DevModeW.dmBitsPerPel;
382 pMode->RefreshRate = D3DADAPTER_DEFAULT;
383 if (DevModeW.dmFields&DM_DISPLAYFREQUENCY)
385 pMode->RefreshRate = DevModeW.dmDisplayFrequency;
388 switch (bpp) {
389 case 8: pMode->Format = D3DFMT_R3G3B2; break;
390 case 16: pMode->Format = D3DFMT_R5G6B5; break;
391 case 24: /*pMode->Format = D3DFMT_R5G6B5; break;*/ /* Make 24bit appear as 32 bit */
392 case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
393 default: pMode->Format = D3DFMT_UNKNOWN;
396 } else {
397 FIXME_(d3d_caps)("Adapter not primary display\n");
400 TRACE_(d3d_caps)("returning w:%d, h:%d, ref:%d, fmt:%x\n", pMode->Width,
401 pMode->Height, pMode->RefreshRate, pMode->Format);
402 return D3D_OK;
405 HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface,
406 UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
407 D3DFORMAT BackBufferFormat, BOOL Windowed) {
408 ICOM_THIS(IDirect3D8Impl,iface);
409 TRACE_(d3d_caps)("(%p)->(Adptr:%d, CheckType:(%x,%s), DispFmt:(%x,%s), BackBuf:(%x,%s), Win?%d): stub\n",
410 This,
411 Adapter,
412 CheckType, debug_d3ddevicetype(CheckType),
413 DisplayFormat, debug_d3dformat(DisplayFormat),
414 BackBufferFormat, debug_d3dformat(BackBufferFormat),
415 Windowed);
417 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
418 return D3DERR_INVALIDCALL;
422 switch (DisplayFormat) {
423 case D3DFMT_A8R8G8B8:
424 return D3DERR_NOTAVAILABLE;
425 default:
426 break;
429 switch (DisplayFormat) {
430 /*case D3DFMT_R5G6B5:*/
431 case D3DFMT_R3G3B2:
432 return D3DERR_NOTAVAILABLE;
433 default:
434 break;
436 return D3D_OK;
439 HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
440 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
441 DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
442 ICOM_THIS(IDirect3D8Impl,iface);
443 TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ",
444 This,
445 Adapter,
446 DeviceType, debug_d3ddevicetype(DeviceType),
447 AdapterFormat, debug_d3dformat(AdapterFormat),
448 Usage, debug_d3dusage(Usage),
449 RType, debug_d3dressourcetype(RType),
450 CheckFormat, debug_d3dformat(CheckFormat));
452 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
453 return D3DERR_INVALIDCALL;
456 if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
457 switch (CheckFormat) {
458 case D3DFMT_DXT1:
459 case D3DFMT_DXT3:
460 case D3DFMT_DXT5:
461 TRACE_(d3d_caps)("[OK]\n");
462 return D3D_OK;
463 default:
464 break; /* Avoid compiler warnings */
468 switch (CheckFormat) {
469 /*****
470 * check supported using GL_SUPPORT
472 case D3DFMT_DXT1:
473 case D3DFMT_DXT2:
474 case D3DFMT_DXT3:
475 case D3DFMT_DXT4:
476 case D3DFMT_DXT5:
478 /*****
479 * supported
481 /*case D3DFMT_R5G6B5: */
482 /*case D3DFMT_X1R5G5B5:*/
483 /*case D3DFMT_A1R5G5B5: */
484 /*case D3DFMT_A4R4G4B4:*/
486 /*****
487 * unsupported
490 /* color buffer */
491 /*case D3DFMT_X8R8G8B8:*/
492 case D3DFMT_A8R3G3B2:
494 /* Paletted */
495 case D3DFMT_P8:
496 case D3DFMT_A8P8:
498 /* Luminance */
499 case D3DFMT_L8:
500 case D3DFMT_A8L8:
501 case D3DFMT_A4L4:
503 /* Bump */
504 #if 0
505 case D3DFMT_V8U8:
506 case D3DFMT_V16U16:
507 #endif
508 case D3DFMT_L6V5U5:
509 case D3DFMT_X8L8V8U8:
510 case D3DFMT_Q8W8V8U8:
511 case D3DFMT_W11V11U10:
513 /****
514 * currently hard to support
516 case D3DFMT_UYVY:
517 case D3DFMT_YUY2:
519 /* Since we do not support these formats right now, don't pretend to. */
520 TRACE_(d3d_caps)("[FAILED]\n");
521 return D3DERR_NOTAVAILABLE;
522 default:
523 break;
526 TRACE_(d3d_caps)("[OK]\n");
527 return D3D_OK;
530 HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface,
531 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
532 BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) {
533 ICOM_THIS(IDirect3D8Impl,iface);
534 TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x)\n",
535 This,
536 Adapter,
537 DeviceType, debug_d3ddevicetype(DeviceType),
538 SurfaceFormat, debug_d3dformat(SurfaceFormat),
539 Windowed,
540 MultiSampleType);
542 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
543 return D3DERR_INVALIDCALL;
546 if (D3DMULTISAMPLE_NONE == MultiSampleType)
547 return D3D_OK;
548 return D3DERR_NOTAVAILABLE;
551 HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface,
552 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
553 D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
554 ICOM_THIS(IDirect3D8Impl,iface);
555 TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n",
556 This,
557 Adapter,
558 DeviceType, debug_d3ddevicetype(DeviceType),
559 AdapterFormat, debug_d3dformat(AdapterFormat),
560 RenderTargetFormat, debug_d3dformat(RenderTargetFormat),
561 DepthStencilFormat, debug_d3dformat(DepthStencilFormat));
563 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
564 return D3DERR_INVALIDCALL;
567 #if 0
568 switch (DepthStencilFormat) {
569 case D3DFMT_D24X4S4:
570 case D3DFMT_D24X8:
571 case D3DFMT_D24S8:
572 case D3DFMT_D32:
574 * as i don't know how to really check hard caps of graphics cards
575 * i prefer to not permit 32bit zbuffers enumeration (as few cards can do it)
577 return D3DERR_NOTAVAILABLE;
578 default:
579 break;
581 #endif
582 return D3D_OK;
585 HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) {
587 BOOL gotContext = FALSE;
588 GLint gl_tex_size = 0;
589 WineD3D_Context* fake_ctx = NULL;
590 ICOM_THIS(IDirect3D8Impl,iface);
592 TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps);
594 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
595 return D3DERR_INVALIDCALL;
598 /* Note: GL seems to trap if GetDeviceCaps is called before any HWND's created
599 ie there is no GL Context - Get a default rendering context to enable the
600 function query some info from GL */
601 if (glXGetCurrentContext() == NULL) {
602 fake_ctx = WineD3DCreateFakeGLContext();
603 if (NULL != fake_ctx) gotContext = TRUE;
604 } else {
605 gotContext = TRUE;
608 if (gotContext == FALSE) {
610 FIXME_(d3d_caps)("GetDeviceCaps called but no GL Context - Returning dummy values\n");
611 gl_tex_size=65535;
612 pCaps->MaxTextureBlendStages = 2;
613 pCaps->MaxSimultaneousTextures = 2;
614 pCaps->MaxUserClipPlanes = 8;
615 pCaps->MaxActiveLights = 8;
616 pCaps->MaxVertexBlendMatrices = 0;
617 pCaps->MaxVertexBlendMatrixIndex = 1;
618 pCaps->MaxAnisotropy = 0;
619 pCaps->MaxPointSize = 255.0;
620 } else {
621 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_tex_size);
624 /* If we don't know the device settings, go query them now */
625 if (This->isGLInfoValid == FALSE) IDirect3D8Impl_FillGLCaps(iface, NULL);
627 pCaps->DeviceType = (DeviceType == D3DDEVTYPE_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; /* Not quite true, but use h/w supported by opengl I suppose */
628 pCaps->AdapterOrdinal = Adapter;
630 pCaps->Caps = 0;
631 pCaps->Caps2 = D3DCAPS2_CANRENDERWINDOWED;
632 pCaps->Caps3 = D3DDEVCAPS_HWTRANSFORMANDLIGHT;
633 pCaps->PresentationIntervals = D3DPRESENT_INTERVAL_IMMEDIATE;
635 pCaps->CursorCaps = 0;
637 pCaps->DevCaps = D3DDEVCAPS_DRAWPRIMTLVERTEX |
638 D3DDEVCAPS_HWTRANSFORMANDLIGHT |
639 D3DDEVCAPS_PUREDEVICE;
641 pCaps->PrimitiveMiscCaps = D3DPMISCCAPS_CULLCCW |
642 D3DPMISCCAPS_CULLCW |
643 D3DPMISCCAPS_COLORWRITEENABLE |
644 D3DPMISCCAPS_CLIPTLVERTS |
645 D3DPMISCCAPS_CLIPPLANESCALEDPOINTS |
646 D3DPMISCCAPS_MASKZ;
647 /*NOT: D3DPMISCCAPS_TSSARGTEMP*/
649 pCaps->RasterCaps = D3DPRASTERCAPS_DITHER |
650 D3DPRASTERCAPS_PAT |
651 D3DPRASTERCAPS_WFOG |
652 D3DPRASTERCAPS_ZFOG |
653 D3DPRASTERCAPS_FOGVERTEX |
654 D3DPRASTERCAPS_FOGTABLE |
655 D3DPRASTERCAPS_FOGRANGE;
657 if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
658 pCaps->RasterCaps |= D3DPRASTERCAPS_ANISOTROPY;
660 /* FIXME Add:
661 D3DPRASTERCAPS_MIPMAPLODBIAS
662 D3DPRASTERCAPS_ZBIAS
663 D3DPRASTERCAPS_COLORPERSPECTIVE
664 D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE
665 D3DPRASTERCAPS_ANTIALIASEDGES
666 D3DPRASTERCAPS_ZBUFFERLESSHSR
667 D3DPRASTERCAPS_WBUFFER */
669 pCaps->ZCmpCaps = D3DPCMPCAPS_ALWAYS |
670 D3DPCMPCAPS_EQUAL |
671 D3DPCMPCAPS_GREATER |
672 D3DPCMPCAPS_GREATEREQUAL |
673 D3DPCMPCAPS_LESS |
674 D3DPCMPCAPS_LESSEQUAL |
675 D3DPCMPCAPS_NEVER |
676 D3DPCMPCAPS_NOTEQUAL;
678 pCaps->SrcBlendCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */
679 pCaps->DestBlendCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */
680 pCaps->AlphaCmpCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */
682 pCaps->ShadeCaps = D3DPSHADECAPS_SPECULARGOURAUDRGB |
683 D3DPSHADECAPS_COLORGOURAUDRGB;
685 pCaps->TextureCaps = D3DPTEXTURECAPS_ALPHA |
686 D3DPTEXTURECAPS_ALPHAPALETTE |
687 D3DPTEXTURECAPS_POW2 |
688 D3DPTEXTURECAPS_VOLUMEMAP |
689 D3DPTEXTURECAPS_MIPMAP |
690 D3DPTEXTURECAPS_PROJECTED;
692 if (GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {
693 pCaps->TextureCaps |= D3DPTEXTURECAPS_CUBEMAP |
694 D3DPTEXTURECAPS_MIPCUBEMAP |
695 D3DPTEXTURECAPS_CUBEMAP_POW2;
698 pCaps->TextureFilterCaps = D3DPTFILTERCAPS_MAGFLINEAR |
699 D3DPTFILTERCAPS_MAGFPOINT |
700 D3DPTFILTERCAPS_MINFLINEAR |
701 D3DPTFILTERCAPS_MINFPOINT |
702 D3DPTFILTERCAPS_MIPFLINEAR |
703 D3DPTFILTERCAPS_MIPFPOINT;
705 pCaps->CubeTextureFilterCaps = 0;
706 pCaps->VolumeTextureFilterCaps = 0;
708 pCaps->TextureAddressCaps = D3DPTADDRESSCAPS_BORDER |
709 D3DPTADDRESSCAPS_CLAMP |
710 D3DPTADDRESSCAPS_WRAP;
712 if (GL_SUPPORT(ARB_TEXTURE_BORDER_CLAMP)) {
713 pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_BORDER;
715 if (GL_SUPPORT(ARB_TEXTURE_MIRRORED_REPEAT)) {
716 pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRROR;
718 if (GL_SUPPORT(ATI_TEXTURE_MIRROR_ONCE)) {
719 pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRRORONCE;
722 pCaps->VolumeTextureAddressCaps = 0;
724 pCaps->LineCaps = D3DLINECAPS_TEXTURE |
725 D3DLINECAPS_ZTEST;
726 /* FIXME: Add
727 D3DLINECAPS_BLEND
728 D3DLINECAPS_ALPHACMP
729 D3DLINECAPS_FOG */
731 pCaps->MaxTextureWidth = gl_tex_size;
732 pCaps->MaxTextureHeight = gl_tex_size;
734 pCaps->MaxVolumeExtent = 0;
736 pCaps->MaxTextureRepeat = 32768;
737 pCaps->MaxTextureAspectRatio = 32768;
738 pCaps->MaxVertexW = 1.0;
740 pCaps->GuardBandLeft = 0;
741 pCaps->GuardBandTop = 0;
742 pCaps->GuardBandRight = 0;
743 pCaps->GuardBandBottom = 0;
745 pCaps->ExtentsAdjust = 0;
747 pCaps->StencilCaps = D3DSTENCILCAPS_DECRSAT |
748 D3DSTENCILCAPS_INCRSAT |
749 D3DSTENCILCAPS_INVERT |
750 D3DSTENCILCAPS_KEEP |
751 D3DSTENCILCAPS_REPLACE |
752 D3DSTENCILCAPS_ZERO;
753 if (GL_SUPPORT(EXT_STENCIL_WRAP)) {
754 pCaps->StencilCaps |= D3DSTENCILCAPS_DECR |
755 D3DSTENCILCAPS_INCR;
758 pCaps->FVFCaps = D3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */
760 pCaps->TextureOpCaps = D3DTEXOPCAPS_ADD |
761 D3DTEXOPCAPS_ADDSIGNED |
762 D3DTEXOPCAPS_ADDSIGNED2X |
763 D3DTEXOPCAPS_MODULATE |
764 D3DTEXOPCAPS_MODULATE2X |
765 D3DTEXOPCAPS_MODULATE4X |
766 D3DTEXOPCAPS_SELECTARG1 |
767 D3DTEXOPCAPS_SELECTARG2 |
768 D3DTEXOPCAPS_DISABLE;
769 #if defined(GL_VERSION_1_3)
770 pCaps->TextureOpCaps |= D3DTEXOPCAPS_DOTPRODUCT3 |
771 D3DTEXOPCAPS_SUBTRACT;
772 #endif
773 if (GL_SUPPORT(ARB_TEXTURE_ENV_COMBINE) ||
774 GL_SUPPORT(EXT_TEXTURE_ENV_COMBINE) ||
775 GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
776 pCaps->TextureOpCaps |= D3DTEXOPCAPS_BLENDDIFFUSEALPHA |
777 D3DTEXOPCAPS_BLENDTEXTUREALPHA |
778 D3DTEXOPCAPS_BLENDFACTORALPHA |
779 D3DTEXOPCAPS_BLENDCURRENTALPHA |
780 D3DTEXOPCAPS_LERP;
782 if (GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
783 pCaps->TextureOpCaps |= D3DTEXOPCAPS_ADDSMOOTH |
784 D3DTEXOPCAPS_MULTIPLYADD |
785 D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR |
786 D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
787 D3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
790 #if 0
791 pCaps->TextureOpCaps |= D3DTEXOPCAPS_BUMPENVMAP;
792 /* FIXME: Add
793 D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
794 D3DTEXOPCAPS_PREMODULATE */
795 #endif
797 if (gotContext) {
798 GLint gl_max;
799 GLfloat gl_float;
800 #if defined(GL_VERSION_1_3)
801 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max);
802 #else
803 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
804 #endif
805 TRACE_(d3d_caps)("GLCaps: GL_MAX_TEXTURE_UNITS_ARB=%d\n", gl_max);
806 pCaps->MaxTextureBlendStages = min(8, gl_max);
807 pCaps->MaxSimultaneousTextures = min(8, gl_max);
809 glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
810 pCaps->MaxUserClipPlanes = min(MAX_CLIPPLANES, gl_max);
811 TRACE_(d3d_caps)("GLCaps: GL_MAX_CLIP_PLANES=%ld\n", pCaps->MaxUserClipPlanes);
813 glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
814 pCaps->MaxActiveLights = gl_max;
815 TRACE_(d3d_caps)("GLCaps: GL_MAX_LIGHTS=%ld\n", pCaps->MaxActiveLights);
817 if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
818 glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
819 pCaps->MaxVertexBlendMatrices = gl_max;
820 pCaps->MaxVertexBlendMatrixIndex = 1;
821 } else {
822 pCaps->MaxVertexBlendMatrices = 0;
823 pCaps->MaxVertexBlendMatrixIndex = 1;
826 if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
827 glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
828 checkGLcall("glGetInterv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)");
829 pCaps->MaxAnisotropy = gl_max;
830 } else {
831 pCaps->MaxAnisotropy = 0;
834 glGetFloatv(GL_POINT_SIZE_RANGE, &gl_float);
835 pCaps->MaxPointSize = gl_float;
838 pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS |
839 D3DVTXPCAPS_MATERIALSOURCE7 |
840 D3DVTXPCAPS_POSITIONALLIGHTS |
841 D3DVTXPCAPS_LOCALVIEWER |
842 D3DVTXPCAPS_TEXGEN;
843 /* FIXME: Add
844 D3DVTXPCAPS_TWEENING */
846 pCaps->MaxPrimitiveCount = 0xFFFFFFFF;
847 pCaps->MaxVertexIndex = 0xFFFFFFFF;
848 pCaps->MaxStreams = MAX_STREAMS;
849 pCaps->MaxStreamStride = 1024;
851 if (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF)) {
852 pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
854 if (This->gl_info.gl_vendor == VENDOR_MESA ||
855 This->gl_info.gl_vendor == VENDOR_WINE) {
856 pCaps->MaxVertexShaderConst = 95;
857 } else {
858 pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
860 } else {
861 pCaps->VertexShaderVersion = 0;
862 pCaps->MaxVertexShaderConst = 0;
865 if ((ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
866 pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
867 pCaps->MaxPixelShaderValue = 1.0;
868 } else {
869 pCaps->PixelShaderVersion = 0;
870 pCaps->MaxPixelShaderValue = 0.0;
873 /* If we created a dummy context, throw it away */
874 WineD3DReleaseFakeGLContext(fake_ctx);
875 return D3D_OK;
878 HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) {
879 ICOM_THIS(IDirect3D8Impl,iface);
880 FIXME_(d3d_caps)("(%p)->(Adptr:%d)\n", This, Adapter);
882 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
883 return NULL;
886 return D3D_OK;
890 static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
891 const char *GL_Extensions = NULL;
892 const char *GLX_Extensions = NULL;
893 GLint gl_max;
894 const char* gl_string = NULL;
895 const char* gl_string_cursor = NULL;
896 Bool test = 0;
897 int major, minor;
898 ICOM_THIS(IDirect3D8Impl,iface);
900 if (This->gl_info.bIsFilled) return;
901 This->gl_info.bIsFilled = 1;
903 TRACE_(d3d_caps)("(%p, %p)\n", This, display);
905 if (NULL != display) {
906 test = glXQueryVersion(display, &major, &minor);
907 This->gl_info.glx_version = ((major & 0x0000FFFF) << 16) | (minor & 0x0000FFFF);
908 gl_string = glXGetClientString(display, GLX_VENDOR);
909 } else {
910 gl_string = glGetString(GL_VENDOR);
913 if (strstr(gl_string, "NVIDIA")) {
914 This->gl_info.gl_vendor = VENDOR_NVIDIA;
915 } else if (strstr(gl_string, "ATI")) {
916 This->gl_info.gl_vendor = VENDOR_ATI;
917 } else {
918 This->gl_info.gl_vendor = VENDOR_WINE;
921 TRACE_(d3d_caps)("found GL_VENDOR (%s)->(0x%04x)\n", debugstr_a(gl_string), This->gl_info.gl_vendor);
923 gl_string = glGetString(GL_VERSION);
924 switch (This->gl_info.gl_vendor) {
925 case VENDOR_NVIDIA:
926 gl_string_cursor = strstr(gl_string, "NVIDIA");
927 gl_string_cursor = strstr(gl_string_cursor, " ");
928 while (*gl_string_cursor && ' ' == *gl_string_cursor) ++gl_string_cursor;
929 if (*gl_string_cursor) {
930 char tmp[16];
931 int cursor = 0;
933 while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
934 tmp[cursor++] = *gl_string_cursor;
935 ++gl_string_cursor;
937 tmp[cursor] = 0;
938 major = atoi(tmp);
940 if (*gl_string_cursor != '.') WARN_(d3d_caps)("malformed GL_VERSION (%s)\n", debugstr_a(gl_string));
941 ++gl_string_cursor;
943 while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
944 tmp[cursor++] = *gl_string_cursor;
945 ++gl_string_cursor;
947 tmp[cursor] = 0;
948 minor = atoi(tmp);
949 break;
951 case VENDOR_ATI:
952 major = minor = 0;
953 gl_string_cursor = strchr(gl_string, '-');
954 if (gl_string_cursor++) {
955 int error = 0;
956 /* Check if version number is of the form x.y.z */
957 if (*gl_string_cursor > '9' && *gl_string_cursor < '0')
958 error = 1;
959 if (!error && *(gl_string_cursor+2) > '9' && *(gl_string_cursor+2) < '0')
960 error = 1;
961 if (!error && *(gl_string_cursor+4) > '9' && *(gl_string_cursor+4) < '0')
962 error = 1;
963 if (!error && *(gl_string_cursor+1) != '.' && *(gl_string_cursor+3) != '.')
964 error = 1;
965 /* Mark version number as malformed */
966 if (error)
967 gl_string_cursor = 0;
969 if (!gl_string_cursor)
970 WARN_(d3d_caps)("malformed GL_VERSION (%s)\n", debugstr_a(gl_string));
971 else {
972 major = *gl_string_cursor - '0';
973 minor = (*(gl_string_cursor+2) - '0') * 256 + (*(gl_string_cursor+4) - '0');
975 break;
976 default:
977 major = 0;
978 minor = 9;
980 This->gl_info.gl_driver_version = MAKEDWORD_VERSION(major, minor);
982 FIXME_(d3d_caps)("found GL_VERSION (%s)->(0x%08lx)\n", debugstr_a(gl_string), This->gl_info.gl_driver_version);
984 gl_string = glGetString(GL_RENDERER);
985 strcpy(This->gl_info.gl_renderer, gl_string);
987 switch (This->gl_info.gl_vendor) {
988 case VENDOR_NVIDIA:
989 if (strstr(This->gl_info.gl_renderer, "GeForce4 Ti")) {
990 This->gl_info.gl_card = CARD_NVIDIA_GEFORCE4_TI4600;
991 } else if (strstr(This->gl_info.gl_renderer, "GeForceFX")) {
992 This->gl_info.gl_card = CARD_NVIDIA_GEFORCEFX_5900ULTRA;
993 } else {
994 This->gl_info.gl_card = CARD_NVIDIA_GEFORCE4_TI4600;
996 break;
997 case VENDOR_ATI:
998 if (strstr(This->gl_info.gl_renderer, "RADEON 9800 PRO")) {
999 This->gl_info.gl_card = CARD_ATI_RADEON_9800PRO;
1000 } else if (strstr(This->gl_info.gl_renderer, "RADEON 9700 PRO")) {
1001 This->gl_info.gl_card = CARD_ATI_RADEON_9700PRO;
1002 } else {
1003 This->gl_info.gl_card = CARD_ATI_RADEON_8500;
1005 break;
1006 default:
1007 This->gl_info.gl_card = CARD_WINE;
1008 break;
1011 FIXME_(d3d_caps)("found GL_RENDERER (%s)->(0x%04x)\n", debugstr_a(This->gl_info.gl_renderer), This->gl_info.gl_card);
1014 * Initialize openGL extension related variables
1015 * with Default values
1017 memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported));
1018 This->gl_info.max_textures = 1;
1019 This->gl_info.ps_arb_version = PS_VERSION_NOT_SUPPORTED;
1020 This->gl_info.vs_arb_version = VS_VERSION_NOT_SUPPORTED;
1021 This->gl_info.vs_nv_version = VS_VERSION_NOT_SUPPORTED;
1022 This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
1024 #define USE_GL_FUNC(type, pfn) This->gl_info.pfn = NULL;
1025 GL_EXT_FUNCS_GEN;
1026 #undef USE_GL_FUNC
1028 /* Retrieve opengl defaults */
1029 glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
1030 This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max);
1031 TRACE_(d3d_caps)("ClipPlanes support - num Planes=%d\n", gl_max);
1033 glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
1034 This->gl_info.max_lights = gl_max;
1035 TRACE_(d3d_caps)("Lights support - max lights=%d\n", gl_max);
1037 /* Parse the gl supported features, in theory enabling parts of our code appropriately */
1038 GL_Extensions = glGetString(GL_EXTENSIONS);
1039 TRACE_(d3d_caps)("GL_Extensions reported:\n");
1041 if (NULL == GL_Extensions) {
1042 ERR(" GL_Extensions returns NULL\n");
1043 } else {
1044 while (*GL_Extensions != 0x00) {
1045 const char *Start = GL_Extensions;
1046 char ThisExtn[256];
1048 memset(ThisExtn, 0x00, sizeof(ThisExtn));
1049 while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
1050 GL_Extensions++;
1052 memcpy(ThisExtn, Start, (GL_Extensions - Start));
1053 TRACE_(d3d_caps)("- %s\n", ThisExtn);
1056 * ARB
1058 if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) {
1059 This->gl_info.ps_arb_version = PS_VERSION_11;
1060 TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - version=%02x\n", This->gl_info.ps_arb_version);
1061 This->gl_info.supported[ARB_FRAGMENT_PROGRAM] = TRUE;
1062 } else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) {
1063 TRACE_(d3d_caps)(" FOUND: ARB Multisample support\n");
1064 This->gl_info.supported[ARB_MULTISAMPLE] = TRUE;
1065 } else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
1066 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
1067 TRACE_(d3d_caps)(" FOUND: ARB Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%u\n", gl_max);
1068 This->gl_info.supported[ARB_MULTITEXTURE] = TRUE;
1069 This->gl_info.max_textures = min(8, gl_max);
1070 } else if (strcmp(ThisExtn, "GL_ARB_texture_cube_map") == 0) {
1071 TRACE_(d3d_caps)(" FOUND: ARB Texture Cube Map support\n");
1072 This->gl_info.supported[ARB_TEXTURE_CUBE_MAP] = TRUE;
1073 TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support\n");
1074 This->gl_info.supported[NV_TEXGEN_REFLECTION] = TRUE;
1075 } else if (strcmp(ThisExtn, "GL_ARB_texture_compression") == 0) {
1076 TRACE_(d3d_caps)(" FOUND: ARB Texture Compression support\n");
1077 This->gl_info.supported[ARB_TEXTURE_COMPRESSION] = TRUE;
1078 } else if (strcmp(ThisExtn, "GL_ARB_texture_env_add") == 0) {
1079 TRACE_(d3d_caps)(" FOUND: ARB Texture Env Add support\n");
1080 This->gl_info.supported[ARB_TEXTURE_ENV_ADD] = TRUE;
1081 } else if (strcmp(ThisExtn, "GL_ARB_texture_env_combine") == 0) {
1082 TRACE_(d3d_caps)(" FOUND: ARB Texture Env combine support\n");
1083 This->gl_info.supported[ARB_TEXTURE_ENV_COMBINE] = TRUE;
1084 } else if (strcmp(ThisExtn, "GL_ARB_texture_env_dot3") == 0) {
1085 TRACE_(d3d_caps)(" FOUND: ARB Dot3 support\n");
1086 This->gl_info.supported[ARB_TEXTURE_ENV_DOT3] = TRUE;
1087 } else if (strcmp(ThisExtn, "GL_ARB_texture_border_clamp") == 0) {
1088 TRACE_(d3d_caps)(" FOUND: ARB Texture border clamp support\n");
1089 This->gl_info.supported[ARB_TEXTURE_BORDER_CLAMP] = TRUE;
1090 } else if (strcmp(ThisExtn, "GL_ARB_texture_mirrored_repeat") == 0) {
1091 TRACE_(d3d_caps)(" FOUND: ARB Texture mirrored repeat support\n");
1092 This->gl_info.supported[ARB_TEXTURE_MIRRORED_REPEAT] = TRUE;
1093 } else if (strstr(ThisExtn, "GL_ARB_vertex_program")) {
1094 This->gl_info.vs_arb_version = VS_VERSION_11;
1095 TRACE_(d3d_caps)(" FOUND: ARB Vertex Shader support - version=%02x\n", This->gl_info.vs_arb_version);
1096 This->gl_info.supported[ARB_VERTEX_PROGRAM] = TRUE;
1099 * EXT
1101 } else if (strcmp(ThisExtn, "GL_EXT_fog_coord") == 0) {
1102 TRACE_(d3d_caps)(" FOUND: EXT Fog coord support\n");
1103 This->gl_info.supported[EXT_FOG_COORD] = TRUE;
1104 } else if (strcmp(ThisExtn, "GL_EXT_paletted_texture") == 0) { /* handle paletted texture extensions */
1105 TRACE_(d3d_caps)(" FOUND: EXT Paletted texture support\n");
1106 This->gl_info.supported[EXT_PALETTED_TEXTURE] = TRUE;
1107 } else if (strcmp(ThisExtn, "GL_EXT_point_parameters") == 0) {
1108 TRACE_(d3d_caps)(" FOUND: EXT Point parameters support\n");
1109 This->gl_info.supported[EXT_POINT_PARAMETERS] = TRUE;
1110 } else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) {
1111 TRACE_(d3d_caps)(" FOUND: EXT Secondary coord support\n");
1112 This->gl_info.supported[EXT_SECONDARY_COLOR] = TRUE;
1113 } else if (strcmp(ThisExtn, "GL_EXT_stencil_wrap") == 0) {
1114 TRACE_(d3d_caps)(" FOUND: EXT Stencil wrap support\n");
1115 This->gl_info.supported[EXT_STENCIL_WRAP] = TRUE;
1116 } else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
1117 TRACE_(d3d_caps)(" FOUND: EXT Texture S3TC compression support\n");
1118 This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
1119 } else if (strcmp(ThisExtn, "GL_EXT_texture_env_add") == 0) {
1120 TRACE_(d3d_caps)(" FOUND: EXT Texture Env Add support\n");
1121 This->gl_info.supported[EXT_TEXTURE_ENV_ADD] = TRUE;
1122 } else if (strcmp(ThisExtn, "GL_EXT_texture_env_combine") == 0) {
1123 TRACE_(d3d_caps)(" FOUND: EXT Texture Env combine support\n");
1124 This->gl_info.supported[EXT_TEXTURE_ENV_COMBINE] = TRUE;
1125 } else if (strcmp(ThisExtn, "GL_EXT_texture_env_dot3") == 0) {
1126 TRACE_(d3d_caps)(" FOUND: EXT Dot3 support\n");
1127 This->gl_info.supported[EXT_TEXTURE_ENV_DOT3] = TRUE;
1128 } else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) {
1129 TRACE_(d3d_caps)(" FOUND: EXT Texture Anisotropic filter support\n");
1130 This->gl_info.supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE;
1131 } else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) {
1132 TRACE_(d3d_caps)(" FOUND: EXT Texture LOD support\n");
1133 This->gl_info.supported[EXT_TEXTURE_LOD] = TRUE;
1134 } else if (strcmp(ThisExtn, "GL_EXT_texture_lod_bias") == 0) {
1135 TRACE_(d3d_caps)(" FOUND: EXT Texture LOD bias support\n");
1136 This->gl_info.supported[EXT_TEXTURE_LOD_BIAS] = TRUE;
1137 } else if (strcmp(ThisExtn, "GL_EXT_vertex_weighting") == 0) {
1138 TRACE_(d3d_caps)(" FOUND: EXT Vertex weighting support\n");
1139 This->gl_info.supported[EXT_VERTEX_WEIGHTING] = TRUE;
1142 * NVIDIA
1144 } else if (strstr(ThisExtn, "GL_NV_fog_distance")) {
1145 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Fog Distance support\n");
1146 This->gl_info.supported[NV_FOG_DISTANCE] = TRUE;
1147 } else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
1148 This->gl_info.ps_nv_version = PS_VERSION_11;
1149 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
1150 } else if (strcmp(ThisExtn, "GL_NV_register_combiners") == 0) {
1151 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (1) support\n");
1152 This->gl_info.supported[NV_REGISTER_COMBINERS] = TRUE;
1153 } else if (strcmp(ThisExtn, "GL_NV_register_combiners2") == 0) {
1154 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (2) support\n");
1155 This->gl_info.supported[NV_REGISTER_COMBINERS2] = TRUE;
1156 } else if (strcmp(ThisExtn, "GL_NV_texgen_reflection") == 0) {
1157 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Gen Reflection support\n");
1158 This->gl_info.supported[NV_TEXGEN_REFLECTION] = TRUE;
1159 } else if (strcmp(ThisExtn, "GL_NV_texture_env_combine4") == 0) {
1160 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Env combine (4) support\n");
1161 This->gl_info.supported[NV_TEXTURE_ENV_COMBINE4] = TRUE;
1162 } else if (strcmp(ThisExtn, "GL_NV_texture_shader") == 0) {
1163 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (1) support\n");
1164 This->gl_info.supported[NV_TEXTURE_SHADER] = TRUE;
1165 } else if (strcmp(ThisExtn, "GL_NV_texture_shader2") == 0) {
1166 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (2) support\n");
1167 This->gl_info.supported[NV_TEXTURE_SHADER2] = TRUE;
1168 } else if (strcmp(ThisExtn, "GL_NV_texture_shader3") == 0) {
1169 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (3) support\n");
1170 This->gl_info.supported[NV_TEXTURE_SHADER3] = TRUE;
1171 } else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
1172 This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
1173 This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2")) ? VS_VERSION_20 : VS_VERSION_10);
1174 TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Vertex Shader support - version=%02x\n", This->gl_info.vs_nv_version);
1175 This->gl_info.supported[NV_VERTEX_PROGRAM] = TRUE;
1178 * ATI
1180 /** TODO */
1181 } else if (strcmp(ThisExtn, "GL_ATI_texture_env_combine3") == 0) {
1182 TRACE_(d3d_caps)(" FOUND: ATI Texture Env combine (3) support\n");
1183 This->gl_info.supported[ATI_TEXTURE_ENV_COMBINE3] = TRUE;
1184 } else if (strcmp(ThisExtn, "GL_ATI_texture_mirror_once") == 0) {
1185 TRACE_(d3d_caps)(" FOUND: ATI Texture Mirror Once support\n");
1186 This->gl_info.supported[ATI_TEXTURE_MIRROR_ONCE] = TRUE;
1187 } else if (strcmp(ThisExtn, "GL_EXT_vertex_shader") == 0) {
1188 This->gl_info.vs_ati_version = VS_VERSION_11;
1189 TRACE_(d3d_caps)(" FOUND: ATI (EXT) Vertex Shader support - version=%02x\n", This->gl_info.vs_ati_version);
1190 This->gl_info.supported[EXT_VERTEX_SHADER] = TRUE;
1194 if (*GL_Extensions == ' ') GL_Extensions++;
1198 #define USE_GL_FUNC(type, pfn) This->gl_info.pfn = (type) glXGetProcAddressARB(#pfn);
1199 GL_EXT_FUNCS_GEN;
1200 #undef USE_GL_FUNC
1202 if (display != NULL) {
1203 GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
1204 TRACE_(d3d_caps)("GLX_Extensions reported:\n");
1206 if (NULL == GLX_Extensions) {
1207 ERR(" GLX_Extensions returns NULL\n");
1208 } else {
1209 while (*GLX_Extensions != 0x00) {
1210 const char *Start = GLX_Extensions;
1211 char ThisExtn[256];
1213 memset(ThisExtn, 0x00, sizeof(ThisExtn));
1214 while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
1215 GLX_Extensions++;
1217 memcpy(ThisExtn, Start, (GLX_Extensions - Start));
1218 TRACE_(d3d_caps)("- %s\n", ThisExtn);
1219 if (*GLX_Extensions == ' ') GLX_Extensions++;
1224 #define USE_GL_FUNC(type, pfn) This->gl_info.pfn = (type) glXGetProcAddressARB(#pfn);
1225 GLX_EXT_FUNCS_GEN;
1226 #undef USE_GL_FUNC
1228 /* Only save the values obtained when a display is provided */
1229 if (display != NULL) This->isGLInfoValid = TRUE;
1233 HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
1234 UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
1235 DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
1236 IDirect3DDevice8** ppReturnedDeviceInterface) {
1237 IDirect3DDevice8Impl *object;
1238 HWND whichHWND;
1239 int num;
1240 XVisualInfo template;
1241 HDC hDc;
1243 ICOM_THIS(IDirect3D8Impl,iface);
1244 TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
1245 hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
1247 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
1248 return D3DERR_INVALIDCALL;
1251 /* Allocate the storage for the device */
1252 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
1253 if (NULL == object) {
1254 return D3DERR_OUTOFVIDEOMEMORY;
1256 object->lpVtbl = &Direct3DDevice8_Vtbl;
1257 object->ref = 1;
1258 object->direct3d8 = This;
1259 /** The device AddRef the direct3d8 Interface else crash in propers clients codes */
1260 IDirect3D8_AddRef((LPDIRECT3D8) object->direct3d8);
1262 /** use StateBlock Factory here, for creating the startup stateBlock */
1263 object->StateBlock = NULL;
1264 IDirect3DDeviceImpl_CreateStateBlock(object, D3DSBT_ALL, NULL);
1265 object->UpdateStateBlock = object->StateBlock;
1267 /* Save the creation parameters */
1268 object->CreateParms.AdapterOrdinal = Adapter;
1269 object->CreateParms.DeviceType = DeviceType;
1270 object->CreateParms.hFocusWindow = hFocusWindow;
1271 object->CreateParms.BehaviorFlags = BehaviourFlags;
1273 *ppReturnedDeviceInterface = (LPDIRECT3DDEVICE8) object;
1275 /* Initialize settings */
1276 object->PresentParms.BackBufferCount = 1; /* Opengl only supports one? */
1277 object->adapterNo = Adapter;
1278 object->devType = DeviceType;
1280 /* Initialize openGl - Note the visual is chosen as the window is created and the glcontext cannot
1281 use different properties after that point in time. FIXME: How to handle when requested format
1282 doesn't match actual visual? Cannot choose one here - code removed as it ONLY works if the one
1283 it chooses is identical to the one already being used! */
1284 /* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
1286 /* Which hwnd are we using? */
1287 whichHWND = pPresentationParameters->hDeviceWindow;
1288 if (!whichHWND) {
1289 whichHWND = hFocusWindow;
1291 object->win_handle = whichHWND;
1292 object->win = (Window)GetPropA( whichHWND, "__wine_x11_client_window" );
1294 hDc = GetDC(whichHWND);
1295 object->display = get_display(hDc);
1297 TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
1298 pPresentationParameters->AutoDepthStencilFormat, debug_d3dformat(pPresentationParameters->AutoDepthStencilFormat),
1299 pPresentationParameters->BackBufferFormat, debug_d3dformat(pPresentationParameters->BackBufferFormat));
1301 ENTER_GL();
1303 /* Create a context based off the properties of the existing visual */
1304 template.visualid = (VisualID)GetPropA(GetDesktopWindow(), "__wine_x11_visual_id");
1305 object->visInfo = XGetVisualInfo(object->display, VisualIDMask, &template, &num);
1306 if (NULL == object->visInfo) {
1307 ERR("cannot really get XVisual\n");
1308 LEAVE_GL();
1309 return D3DERR_NOTAVAILABLE;
1311 object->glCtx = glXCreateContext(object->display, object->visInfo, NULL, GL_TRUE);
1312 if (NULL == object->glCtx) {
1313 ERR("cannot create glxContext\n");
1314 LEAVE_GL();
1315 return D3DERR_NOTAVAILABLE;
1317 LEAVE_GL();
1319 ReleaseDC(whichHWND, hDc);
1321 if (object->glCtx == NULL) {
1322 ERR("Error in context creation !\n");
1323 return D3DERR_INVALIDCALL;
1324 } else {
1325 TRACE("Context created (HWND=%p, glContext=%p, Window=%ld, VisInfo=%p)\n",
1326 whichHWND, object->glCtx, object->win, object->visInfo);
1329 /* If not windowed, need to go fullscreen, and resize the HWND to the appropriate */
1330 /* dimensions */
1331 if (!pPresentationParameters->Windowed) {
1332 #if 1
1333 DEVMODEW devmode;
1334 HDC hdc;
1335 int bpp = 0;
1336 memset(&devmode, 0, sizeof(DEVMODEW));
1337 devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
1338 MultiByteToWideChar(CP_ACP, 0, "Gamers CG", -1, devmode.dmDeviceName, CCHDEVICENAME);
1339 hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
1340 bpp = GetDeviceCaps(hdc, BITSPIXEL);
1341 DeleteDC(hdc);
1342 devmode.dmBitsPerPel = (bpp >= 24) ? 32 : bpp;/*Stupid XVidMode cannot change bpp D3DFmtGetBpp(object, pPresentationParameters->BackBufferFormat);*/
1343 devmode.dmPelsWidth = pPresentationParameters->BackBufferWidth;
1344 devmode.dmPelsHeight = pPresentationParameters->BackBufferHeight;
1345 ChangeDisplaySettingsExW(devmode.dmDeviceName, &devmode, object->win_handle, CDS_FULLSCREEN, NULL);
1346 #else
1347 FIXME("Requested full screen support not implemented, expect windowed operation\n");
1348 #endif
1350 /* Make popup window */
1351 ShowWindow(whichHWND, SW_HIDE);
1352 SetWindowLongA(whichHWND, GWL_STYLE, WS_POPUP);
1353 SetWindowPos(object->win_handle, HWND_TOP, 0, 0,
1354 pPresentationParameters->BackBufferWidth,
1355 pPresentationParameters->BackBufferHeight, SWP_SHOWWINDOW | SWP_FRAMECHANGED);
1356 ShowWindow(whichHWND, SW_SHOW);
1359 TRACE("Creating back buffer\n");
1360 /* MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
1361 then the corresponding dimension of the client area of the hDeviceWindow
1362 (or the focus window, if hDeviceWindow is NULL) is taken. */
1363 if (pPresentationParameters->Windowed && ((pPresentationParameters->BackBufferWidth == 0) ||
1364 (pPresentationParameters->BackBufferHeight == 0))) {
1365 RECT Rect;
1367 GetClientRect(whichHWND, &Rect);
1369 if (pPresentationParameters->BackBufferWidth == 0) {
1370 pPresentationParameters->BackBufferWidth = Rect.right;
1371 TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
1373 if (pPresentationParameters->BackBufferHeight == 0) {
1374 pPresentationParameters->BackBufferHeight = Rect.bottom;
1375 TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
1379 /* Save the presentation parms now filled in correctly */
1380 memcpy(&object->PresentParms, pPresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
1383 IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
1384 pPresentationParameters->BackBufferWidth,
1385 pPresentationParameters->BackBufferHeight,
1386 pPresentationParameters->BackBufferFormat,
1387 pPresentationParameters->MultiSampleType,
1388 TRUE,
1389 (LPDIRECT3DSURFACE8*) &object->frontBuffer);
1391 IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
1392 pPresentationParameters->BackBufferWidth,
1393 pPresentationParameters->BackBufferHeight,
1394 pPresentationParameters->BackBufferFormat,
1395 pPresentationParameters->MultiSampleType,
1396 TRUE,
1397 (LPDIRECT3DSURFACE8*) &object->backBuffer);
1399 if (pPresentationParameters->EnableAutoDepthStencil) {
1400 IDirect3DDevice8Impl_CreateDepthStencilSurface((LPDIRECT3DDEVICE8) object,
1401 pPresentationParameters->BackBufferWidth,
1402 pPresentationParameters->BackBufferHeight,
1403 pPresentationParameters->AutoDepthStencilFormat,
1404 D3DMULTISAMPLE_NONE,
1405 (LPDIRECT3DSURFACE8*) &object->depthStencilBuffer);
1406 } else {
1407 object->depthStencilBuffer = NULL;
1409 TRACE("FrontBuf @ %p, BackBuf @ %p, DepthStencil @ %p\n",object->frontBuffer, object->backBuffer, object->depthStencilBuffer);
1411 /* init the default renderTarget management */
1412 object->drawable = object->win;
1413 object->render_ctx = object->glCtx;
1414 object->renderTarget = object->backBuffer;
1415 IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->renderTarget);
1416 object->stencilBufferTarget = object->depthStencilBuffer;
1417 if (NULL != object->stencilBufferTarget) {
1418 IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
1421 ENTER_GL();
1423 if (glXMakeCurrent(object->display, object->win, object->glCtx) == False) {
1424 ERR("Error in setting current context (context %p drawable %ld)!\n", object->glCtx, object->win);
1426 checkGLcall("glXMakeCurrent");
1428 /* Clear the screen */
1429 glClearColor(1.0, 0.0, 0.0, 0.0);
1430 checkGLcall("glClearColor");
1431 glColor3f(1.0, 1.0, 1.0);
1432 checkGLcall("glColor3f");
1434 glEnable(GL_LIGHTING);
1435 checkGLcall("glEnable");
1437 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
1438 checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);");
1440 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1441 checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
1443 glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
1444 checkGLcall("glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);");
1447 * Initialize openGL extension related variables
1448 * with Default values
1450 IDirect3D8Impl_FillGLCaps(iface, object->display);
1452 /* Setup all the devices defaults */
1453 IDirect3DDeviceImpl_InitStartupStateBlock(object);
1455 LEAVE_GL();
1457 { /* Set a default viewport */
1458 D3DVIEWPORT8 vp;
1459 vp.X = 0;
1460 vp.Y = 0;
1461 vp.Width = pPresentationParameters->BackBufferWidth;
1462 vp.Height = pPresentationParameters->BackBufferHeight;
1463 vp.MinZ = 0.0f;
1464 vp.MaxZ = 1.0f;
1465 IDirect3DDevice8Impl_SetViewport((LPDIRECT3DDEVICE8) object, &vp);
1468 /* Initialize the current view state */
1469 object->modelview_valid = 1;
1470 object->proj_valid = 0;
1471 object->view_ident = 1;
1472 object->last_was_rhw = 0;
1473 glGetIntegerv(GL_MAX_LIGHTS, &object->maxConcurrentLights);
1474 TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object);
1476 /* Clear the screen */
1477 IDirect3DDevice8Impl_Clear((LPDIRECT3DDEVICE8) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
1479 return D3D_OK;
1482 ICOM_VTABLE(IDirect3D8) Direct3D8_Vtbl =
1484 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1485 IDirect3D8Impl_QueryInterface,
1486 IDirect3D8Impl_AddRef,
1487 IDirect3D8Impl_Release,
1488 IDirect3D8Impl_RegisterSoftwareDevice,
1489 IDirect3D8Impl_GetAdapterCount,
1490 IDirect3D8Impl_GetAdapterIdentifier,
1491 IDirect3D8Impl_GetAdapterModeCount,
1492 IDirect3D8Impl_EnumAdapterModes,
1493 IDirect3D8Impl_GetAdapterDisplayMode,
1494 IDirect3D8Impl_CheckDeviceType,
1495 IDirect3D8Impl_CheckDeviceFormat,
1496 IDirect3D8Impl_CheckDeviceMultiSampleType,
1497 IDirect3D8Impl_CheckDepthStencilMatch,
1498 IDirect3D8Impl_GetDeviceCaps,
1499 IDirect3D8Impl_GetAdapterMonitor,
1500 IDirect3D8Impl_CreateDevice