Added stub implementation of cabinet.dll.
[wine/multimedia.git] / dlls / d3d8 / directx.c
blob46b07601f5e63437133a9c8f52694d6b4391e082
1 /*
2 * IDirect3D8 implementation
4 * Copyright 2002 Jason Edmeades
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winuser.h"
24 #include "wingdi.h"
25 #include "wine/debug.h"
27 #include "config.h"
28 #include "x11drv.h"
30 #include "d3d8_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
34 #define NUM_MODES 10
35 static const int modes[NUM_MODES][3] = {
36 {640, 480, 85},
37 {800, 600, 85},
38 {1024, 768, 85},
39 {1152, 864, 85},
40 {1280, 768, 85},
41 {1280, 960, 85},
42 {1280, 1024, 85},
43 {1600, 900, 85},
44 {1600, 1024, 85},
45 {1600, 1200, 85}
48 /* retrieve the X display to use on a given DC */
49 inline static Display *get_display( HDC hdc )
51 Display *display;
52 enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
54 if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
55 sizeof(display), (LPSTR)&display )) display = NULL;
56 return display;
60 /* IDirect3D IUnknown parts follow: */
61 HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface,REFIID riid,LPVOID *ppobj)
63 ICOM_THIS(IDirect3D8Impl,iface);
65 if (IsEqualGUID(riid, &IID_IUnknown)
66 || IsEqualGUID(riid, &IID_IClassFactory)) {
67 IDirect3D8Impl_AddRef(iface);
68 *ppobj = This;
69 return D3D_OK;
72 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
73 return E_NOINTERFACE;
76 ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) {
77 ICOM_THIS(IDirect3D8Impl,iface);
78 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
79 return ++(This->ref);
82 ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) {
83 ICOM_THIS(IDirect3D8Impl,iface);
84 ULONG ref = --This->ref;
85 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
86 if (ref == 0)
87 HeapFree(GetProcessHeap(), 0, This);
88 return ref;
91 /* IDirect3D Interface follow: */
92 HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) {
93 ICOM_THIS(IDirect3D8Impl,iface);
94 FIXME("(%p)->(%p): stub\n", This, pInitializeFunction);
95 return D3D_OK;
98 UINT WINAPI IDirect3D8Impl_GetAdapterCount (LPDIRECT3D8 iface) {
99 ICOM_THIS(IDirect3D8Impl,iface);
100 /* FIXME: Set to one for now to imply the display */
101 TRACE("(%p): Mostly stub, only returns primary display\n", This);
102 return 1;
105 HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
106 UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) {
107 ICOM_THIS(IDirect3D8Impl,iface);
109 TRACE("(%p}->(Adapter: %d, Flags: %lx, pId=%p)\n", This, Adapter, Flags, pIdentifier);
111 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
112 return D3DERR_INVALIDCALL;
115 if (Adapter == 0) { /* Display */
116 strcpy(pIdentifier->Driver, "Display");
117 strcpy(pIdentifier->Description, "Direct3D Display");
118 pIdentifier->DriverVersion.s.HighPart = 1;
119 pIdentifier->DriverVersion.s.LowPart = 0;
120 pIdentifier->VendorId = 0;
121 pIdentifier->DeviceId = 0;
122 pIdentifier->SubSysId = 0;
123 pIdentifier->Revision = 0;
124 /*FIXME: memcpy(&pIdentifier->DeviceIdentifier, ??, sizeof(??GUID)); */
125 if (Flags & D3DENUM_NO_WHQL_LEVEL ) {
126 pIdentifier->WHQLLevel = 0;
127 } else {
128 pIdentifier->WHQLLevel = 1;
130 } else {
131 FIXME("Adapter not primary display\n");
134 return D3D_OK;
137 UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,
138 UINT Adapter) {
139 ICOM_THIS(IDirect3D8Impl,iface);
141 TRACE("(%p}->(Adapter: %d)\n", This, Adapter);
143 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
144 return D3DERR_INVALIDCALL;
147 if (Adapter == 0) { /* Display */
148 int maxWidth = GetSystemMetrics(SM_CXSCREEN);
149 int maxHeight = GetSystemMetrics(SM_CYSCREEN);
150 int i;
152 for (i=0; i<NUM_MODES; i++) {
153 if (modes[i][0] > maxWidth || modes[i][1] > maxHeight) {
154 return i+1;
157 return NUM_MODES+1;
158 } else {
159 FIXME("Adapter not primary display\n");
162 return D3D_OK;
165 HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
166 UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) {
167 ICOM_THIS(IDirect3D8Impl,iface);
169 TRACE("(%p}->(Adapter: %d, mode: %d, pMode=%p)\n", This, Adapter, Mode, pMode);
171 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
172 return D3DERR_INVALIDCALL;
175 if (Adapter == 0) { /* Display */
176 HDC hdc;
177 int bpp = 0;
179 if (Mode == 0) {
180 pMode->Width = GetSystemMetrics(SM_CXSCREEN);
181 pMode->Height = GetSystemMetrics(SM_CYSCREEN);
182 pMode->RefreshRate = 85; /*FIXME: How to identify? */
183 } else if (Mode < (NUM_MODES+1)) {
184 pMode->Width = modes[Mode-1][0];
185 pMode->Height = modes[Mode-1][1];
186 pMode->RefreshRate = modes[Mode-1][2];
187 } else {
188 TRACE("Requested mode out of range %d\n", Mode);
189 return D3DERR_INVALIDCALL;
192 hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
193 bpp = GetDeviceCaps(hdc, BITSPIXEL);
194 DeleteDC(hdc);
196 switch (bpp) {
197 case 8: pMode->Format = D3DFMT_R3G3B2; break;
198 case 16: pMode->Format = D3DFMT_A4R4G4B4; break;
199 case 24: pMode->Format = D3DFMT_R8G8B8; break;
200 case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
201 default: pMode->Format = D3DFMT_UNKNOWN;
203 TRACE("W %d H %d rr %d fmt %x\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format);
205 } else {
206 FIXME("Adapter not primary display\n");
209 return D3D_OK;
212 HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface,
213 UINT Adapter, D3DDISPLAYMODE* pMode) {
214 ICOM_THIS(IDirect3D8Impl,iface);
215 TRACE("(%p}->(Adapter: %d, pMode: %p)\n", This, Adapter, pMode);
217 if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
218 return D3DERR_INVALIDCALL;
221 if (Adapter == 0) { /* Display */
222 HDC hdc;
223 int bpp = 0;
225 pMode->Width = GetSystemMetrics(SM_CXSCREEN);
226 pMode->Height = GetSystemMetrics(SM_CYSCREEN);
227 pMode->RefreshRate = 85; /*FIXME: How to identify? */
229 hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
230 bpp = GetDeviceCaps(hdc, BITSPIXEL);
231 DeleteDC(hdc);
233 switch (bpp) {
234 case 8: pMode->Format = D3DFMT_R3G3B2; break;
235 case 16: pMode->Format = D3DFMT_A4R4G4B4; break;
236 case 24: pMode->Format = D3DFMT_R8G8B8; break;
237 case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
238 default: pMode->Format = D3DFMT_UNKNOWN;
241 } else {
242 FIXME("Adapter not primary display\n");
245 TRACE("returning w:%d, h:%d, ref:%d, fmt:%d\n", pMode->Width,
246 pMode->Height, pMode->RefreshRate, pMode->Format);
247 return D3D_OK;
250 HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface,
251 UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
252 D3DFORMAT BackBufferFormat, BOOL Windowed) {
253 ICOM_THIS(IDirect3D8Impl,iface);
254 FIXME("(%p)->(Adptr:%d, CheckType:%x, DispFmt:%x, BackBuf:%x, Win? %d): stub\n", This, Adapter, CheckType,
255 DisplayFormat, BackBufferFormat, Windowed);
256 return D3D_OK;
259 HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
260 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
261 DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
262 ICOM_THIS(IDirect3D8Impl,iface);
263 FIXME("(%p)->(Adptr:%d, DevType: %x, AdptFmt: %d, Use: %ld, ResTyp: %x, CheckFmt: %d)\n", This, Adapter, DeviceType,
264 AdapterFormat, Usage, RType, CheckFormat);
265 return D3D_OK;
268 HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType (LPDIRECT3D8 iface,
269 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
270 BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) {
271 ICOM_THIS(IDirect3D8Impl,iface);
272 FIXME("(%p)->(Adptr:%d, DevType: %x, SurfFmt: %x, Win? %d, MultiSamp: %x)\n", This, Adapter, DeviceType,
273 SurfaceFormat, Windowed, MultiSampleType);
274 return D3D_OK;
277 HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch (LPDIRECT3D8 iface,
278 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
279 D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
280 ICOM_THIS(IDirect3D8Impl,iface);
281 FIXME("(%p)->(Adptr:%d, DevType: %x, AdptFmt: %x, RendrTgtFmt: %x, DepthStencilFmt: %x)\n", This, Adapter, DeviceType,
282 AdapterFormat, RenderTargetFormat, DepthStencilFormat);
283 return D3D_OK;
286 HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps (LPDIRECT3D8 iface,
287 UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) {
288 ICOM_THIS(IDirect3D8Impl,iface);
289 TRACE("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps);
292 /* NOTE: Most of the values here are complete garbage for now */
293 pCaps->DeviceType = D3DDEVTYPE_HAL; /* Not quite true, but use h/w supported by opengl I suppose */
294 pCaps->AdapterOrdinal = Adapter;
296 pCaps->Caps = 0;
297 pCaps->Caps2 = D3DCAPS2_CANRENDERWINDOWED;
298 pCaps->Caps3 = D3DDEVCAPS_HWTRANSFORMANDLIGHT;
299 pCaps->PresentationIntervals = D3DPRESENT_INTERVAL_IMMEDIATE;
301 pCaps->CursorCaps = 0;
303 pCaps->DevCaps = D3DDEVCAPS_DRAWPRIMTLVERTEX | D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_PUREDEVICE;
305 pCaps->PrimitiveMiscCaps = D3DPMISCCAPS_CULLCCW | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPTLVERTS |
306 D3DPMISCCAPS_CLIPPLANESCALEDPOINTS | D3DPMISCCAPS_MASKZ; /*NOT: D3DPMISCCAPS_TSSARGTEMP*/
307 pCaps->RasterCaps = D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT;
308 pCaps->ZCmpCaps = D3DPCMPCAPS_ALWAYS | D3DPCMPCAPS_EQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_GREATEREQUAL |
309 D3DPCMPCAPS_LESS | D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_NEVER | D3DPCMPCAPS_NOTEQUAL;
311 pCaps->SrcBlendCaps = 0;
312 pCaps->DestBlendCaps = 0;
313 pCaps->AlphaCmpCaps = 0;
314 pCaps->ShadeCaps = D3DPSHADECAPS_SPECULARGOURAUDRGB | D3DPSHADECAPS_COLORGOURAUDRGB ;
315 pCaps->TextureCaps = D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_ALPHAPALETTE | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_VOLUMEMAP;
316 pCaps->TextureFilterCaps = 0;
317 pCaps->CubeTextureFilterCaps = 0;
318 pCaps->VolumeTextureFilterCaps = 0;
319 pCaps->TextureAddressCaps = D3DPTADDRESSCAPS_BORDER | D3DPTADDRESSCAPS_CLAMP | D3DPTADDRESSCAPS_WRAP;
320 pCaps->VolumeTextureAddressCaps = 0;
322 pCaps->LineCaps = D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST;
324 pCaps->MaxTextureWidth = 16384;
325 pCaps->MaxTextureHeight = 16384;
326 pCaps->MaxVolumeExtent = 0;
328 pCaps->MaxTextureRepeat = 32768;
329 pCaps->MaxTextureAspectRatio = 32768;
330 pCaps->MaxAnisotropy = 0;
331 pCaps->MaxVertexW = 1.0;
333 pCaps->GuardBandLeft = 0;
334 pCaps->GuardBandTop = 0;
335 pCaps->GuardBandRight = 0;
336 pCaps->GuardBandBottom = 0;
338 pCaps->ExtentsAdjust = 0;
340 pCaps->StencilCaps = D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INCRSAT |
341 D3DSTENCILCAPS_INVERT | D3DSTENCILCAPS_KEEP |
342 D3DSTENCILCAPS_REPLACE | D3DSTENCILCAPS_ZERO /* | D3DSTENCILCAPS_DECR | D3DSTENCILCAPS_INCR */;
344 pCaps->FVFCaps = D3DFVFCAPS_PSIZE | 0x80000;
345 pCaps->TextureOpCaps = 0xFFFFFFFF;
346 pCaps->MaxTextureBlendStages = 256;
347 pCaps->MaxSimultaneousTextures = 256;
349 pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_TEXGEN;
351 pCaps->MaxActiveLights = 8;
352 pCaps->MaxUserClipPlanes = 1;
353 pCaps->MaxVertexBlendMatrices = 1;
354 pCaps->MaxVertexBlendMatrixIndex = 1;
356 pCaps->MaxPointSize = 128.0;
358 pCaps->MaxPrimitiveCount = 0xFFFFFFFF;
359 pCaps->MaxVertexIndex = 0xFFFFFFFF;
360 pCaps->MaxStreams = 1;
361 pCaps->MaxStreamStride = 1024;
363 pCaps->VertexShaderVersion = 01;
364 pCaps->MaxVertexShaderConst = 1;
366 pCaps->PixelShaderVersion = 01;
367 pCaps->MaxPixelShaderValue = 1.0;
369 return D3D_OK;
372 HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor (LPDIRECT3D8 iface,
373 UINT Adapter) {
374 ICOM_THIS(IDirect3D8Impl,iface);
375 FIXME("(%p)->(Adptr:%d)\n", This, Adapter);
376 return D3D_OK;
379 HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
380 UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
381 DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
382 IDirect3DDevice8** ppReturnedDeviceInterface) {
383 IDirect3DDevice8Impl *object;
384 HWND whichHWND;
385 const char *GL_Extensions = NULL;
387 ICOM_THIS(IDirect3D8Impl,iface);
388 TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
389 hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
391 /* Allocate the storage for the device */
392 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
393 object->lpVtbl = &Direct3DDevice8_Vtbl;
394 object->ref = 1;
395 object->direct3d8 = This;
396 object->UpdateStateBlock = &object->StateBlock;
398 /* Save the creation parameters */
399 object->CreateParms.AdapterOrdinal = Adapter;
400 object->CreateParms.DeviceType = DeviceType;
401 object->CreateParms.hFocusWindow = hFocusWindow;
402 object->CreateParms.BehaviorFlags = BehaviourFlags;
404 *ppReturnedDeviceInterface = (LPDIRECT3DDEVICE8)object;
406 /* Initialize settings */
407 memcpy(&object->PresentParms, pPresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
409 object->PresentParms.BackBufferCount = 1; /* Opengl only supports one? */
410 pPresentationParameters->BackBufferCount = 1;
412 object->adapterNo = Adapter;
413 object->devType = DeviceType;
415 /* Initialize openGl */
417 HDC hDc;
418 int dblBuf[]={GLX_STENCIL_SIZE,8,GLX_RGBA,GLX_DEPTH_SIZE,16,GLX_DOUBLEBUFFER,None};
419 /* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
421 /* Which hwnd are we using? */
422 /* if (pPresentationParameters->Windowed) { */
423 whichHWND = pPresentationParameters->hDeviceWindow;
424 if (!whichHWND) {
425 whichHWND = hFocusWindow;
427 object->win = (Window)GetPropA( whichHWND, "__wine_x11_client_window" );
429 * } else {
430 * whichHWND = (HWND) GetDesktopWindow();
431 * object->win = (Window)GetPropA(whichHWND, "__wine_x11_whole_window" );
432 * root_window
436 hDc = GetDC(whichHWND);
437 object->display = get_display(hDc);
439 ENTER_GL();
440 object->visInfo = glXChooseVisual(object->display, DefaultScreen(object->display), dblBuf);
441 object->glCtx = glXCreateContext(object->display, object->visInfo, NULL, GL_TRUE);
443 LEAVE_GL();
444 ReleaseDC(whichHWND, hDc);
448 if (object->glCtx == NULL) {
449 ERR("Error in context creation !\n");
450 return D3DERR_INVALIDCALL;
451 } else {
452 TRACE("Context created (HWND=%p, glContext=%p, Window=%ld, VisInfo=%p)\n",
453 whichHWND, object->glCtx, object->win, object->visInfo);
456 TRACE("Creating back buffer\n");
457 /* MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
458 then the corresponding dimension of the client area of the hDeviceWindow
459 (or the focus window, if hDeviceWindow is NULL) is taken. */
460 if (pPresentationParameters->Windowed && ((pPresentationParameters->BackBufferWidth == 0) ||
461 (pPresentationParameters->BackBufferHeight == 0))) {
462 RECT Rect;
464 GetClientRect(whichHWND, &Rect);
466 if (pPresentationParameters->BackBufferWidth == 0) {
467 pPresentationParameters->BackBufferWidth = Rect.right;
468 TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
470 if (pPresentationParameters->BackBufferHeight == 0) {
471 pPresentationParameters->BackBufferHeight = Rect.bottom;
472 TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
476 IDirect3DDevice8Impl_CreateImageSurface((LPDIRECT3DDEVICE8) object,
477 pPresentationParameters->BackBufferWidth,
478 pPresentationParameters->BackBufferHeight,
479 pPresentationParameters->BackBufferFormat,
480 (LPDIRECT3DSURFACE8*) &object->backBuffer);
482 /* Now override the surface's Flip method (if in double buffering) ?COPIED from DDRAW!?
483 ((x11_ds_private *) surface->private)->opengl_flip = TRUE;
485 int i;
486 struct _surface_chain *chain = surface->s.chain;
487 for (i=0;i<chain->nrofsurfaces;i++)
488 if (chain->surfaces[i]->s.surface_desc.ddsCaps.dwCaps & DDSCAPS_FLIP)
489 ((x11_ds_private *) chain->surfaces[i]->private)->opengl_flip = TRUE;
493 ENTER_GL();
494 if (glXMakeCurrent(object->display, object->win, object->glCtx) == False) {
495 ERR("Error in setting current context (context %p drawable %ld)!\n",
496 object->glCtx, object->win);
498 checkGLcall("glXMakeCurrent");
500 /* Clear the screen */
501 glClearColor(1.0, 0.0, 0.0, 0.0);
502 checkGLcall("glClearColor");
503 glColor3f(1.0, 1.0, 1.0);
504 checkGLcall("glColor3f");
506 glEnable(GL_LIGHTING);
507 checkGLcall("glEnable");
509 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
510 checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);");
512 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
513 checkGLcall("glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
515 /* Setup all the devices defaults */
516 CreateStateBlock((LPDIRECT3DDEVICE8) object);
518 /* Parse the gl supported features, in theory enabling parts of our code appropriately */
519 GL_Extensions = glGetString(GL_EXTENSIONS);
520 TRACE("GL_Extensions reported:\n");
522 while (*GL_Extensions!=0x00) {
523 const char *Start = GL_Extensions;
524 char ThisExtn[256];
526 memset(ThisExtn, 0x00, sizeof(ThisExtn));
527 while (*GL_Extensions!=' ' && *GL_Extensions!=0x00) {
528 GL_Extensions++;
530 memcpy(ThisExtn, Start, (GL_Extensions-Start));
531 TRACE (" %s\n", ThisExtn);
532 if (*GL_Extensions==' ') GL_Extensions++;
535 LEAVE_GL();
537 { /* Set a default viewport */
538 D3DVIEWPORT8 vp;
539 vp.X = 0;
540 vp.Y = 0;
541 vp.Width = pPresentationParameters->BackBufferWidth;
542 vp.Height = pPresentationParameters->BackBufferHeight;
543 vp.MinZ = 0.0f;
544 vp.MaxZ = 1.0f;
545 IDirect3DDevice8Impl_SetViewport((LPDIRECT3DDEVICE8) object, &vp);
548 TRACE("(%p,%d)\n", This, Adapter);
549 return D3D_OK;
552 ICOM_VTABLE(IDirect3D8) Direct3D8_Vtbl =
554 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
555 IDirect3D8Impl_QueryInterface,
556 IDirect3D8Impl_AddRef,
557 IDirect3D8Impl_Release,
558 IDirect3D8Impl_RegisterSoftwareDevice,
559 IDirect3D8Impl_GetAdapterCount,
560 IDirect3D8Impl_GetAdapterIdentifier,
561 IDirect3D8Impl_GetAdapterModeCount,
562 IDirect3D8Impl_EnumAdapterModes,
563 IDirect3D8Impl_GetAdapterDisplayMode,
564 IDirect3D8Impl_CheckDeviceType,
565 IDirect3D8Impl_CheckDeviceFormat,
566 IDirect3D8Impl_CheckDeviceMultiSampleType,
567 IDirect3D8Impl_CheckDepthStencilMatch,
568 IDirect3D8Impl_GetDeviceCaps,
569 IDirect3D8Impl_GetAdapterMonitor,
570 IDirect3D8Impl_CreateDevice