Changeset 25949 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/device.c
- Timestamp:
- Jan 21, 2010 9:26:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/device.c
r23571 r25949 84 84 case WINED3DFMT_D32_UNORM: return D3DFMT_D32; 85 85 case WINED3DFMT_S1_UINT_D15_UNORM: return D3DFMT_D15S1; 86 case WINED3DFMT_ S8_UINT_D24_UNORM: return D3DFMT_D24S8;86 case WINED3DFMT_D24_UNORM_S8_UINT: return D3DFMT_D24S8; 87 87 case WINED3DFMT_X8D24_UNORM: return D3DFMT_D24X8; 88 88 case WINED3DFMT_S4X4_UINT_D24_UNORM: return D3DFMT_D24X4S4; … … 135 135 case D3DFMT_D32: return WINED3DFMT_D32_UNORM; 136 136 case D3DFMT_D15S1: return WINED3DFMT_S1_UINT_D15_UNORM; 137 case D3DFMT_D24S8: return WINED3DFMT_ S8_UINT_D24_UNORM;137 case D3DFMT_D24S8: return WINED3DFMT_D24_UNORM_S8_UINT; 138 138 case D3DFMT_D24X8: return WINED3DFMT_X8D24_UNORM; 139 139 case D3DFMT_D24X4S4: return WINED3DFMT_S4X4_UINT_D24_UNORM; … … 263 263 } 264 264 265 static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain) 266 { 267 IUnknown *parent; 268 269 TRACE("swapchain %p.\n", swapchain); 270 271 IWineD3DSwapChain_GetParent(swapchain, &parent); 272 IUnknown_Release(parent); 273 return IUnknown_Release(parent); 274 } 275 265 276 /* IDirect3D IUnknown parts follow: */ 266 277 static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(LPDIRECT3DDEVICE8 iface,REFIID riid,LPVOID *ppobj) 267 278 { 268 279 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 280 281 TRACE("iface %p, riid %s, object %p.\n", 282 iface, debugstr_guid(riid), ppobj); 269 283 270 284 if (IsEqualGUID(riid, &IID_IUnknown) … … 291 305 ULONG ref = InterlockedIncrement(&This->ref); 292 306 293 TRACE(" (%p) : AddRef from %d\n", This, ref - 1);307 TRACE("%p increasing refcount to %u.\n", iface, ref); 294 308 295 309 return ref; … … 303 317 ref = InterlockedDecrement(&This->ref); 304 318 305 TRACE(" (%p) : ReleaseRef to %d\n", This, ref);319 TRACE("%p decreasing refcount to %u.\n", iface, ref); 306 320 307 321 if (ref == 0) { … … 330 344 331 345 /* IDirect3DDevice Interface follow: */ 332 static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(LPDIRECT3DDEVICE8 iface) { 333 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 334 HRESULT hr; 335 336 TRACE("(%p) : Relay\n", This); 337 338 wined3d_mutex_lock(); 339 hr = IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice); 340 wined3d_mutex_unlock(); 341 342 return hr; 346 static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(IDirect3DDevice8 *iface) 347 { 348 TRACE("iface %p.\n", iface); 349 350 return D3D_OK; 343 351 } 344 352 … … 347 355 HRESULT hr; 348 356 349 TRACE(" (%p) Relay\n", This);357 TRACE("iface %p.\n", iface); 350 358 351 359 wined3d_mutex_lock(); … … 360 368 HRESULT hr; 361 369 362 TRACE("(%p) : Relay bytes(%d)\n", This, Bytes); 370 TRACE("iface %p, byte_count %u.\n", iface, Bytes); 371 FIXME("Byte count ignored.\n"); 363 372 364 373 wined3d_mutex_lock(); … … 374 383 IWineD3D* pWineD3D; 375 384 376 TRACE(" (%p) Relay\n", This);385 TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8); 377 386 378 387 if (NULL == ppD3D8) { … … 402 411 WINED3DCAPS *pWineCaps; 403 412 404 TRACE("(%p) : Relay pCaps %p\n", This, pCaps); 413 TRACE("iface %p, caps %p.\n", iface, pCaps); 414 405 415 if(NULL == pCaps){ 406 416 return D3DERR_INVALIDCALL; … … 426 436 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 427 437 HRESULT hr; 428 TRACE("(%p) Relay\n", This); 438 439 TRACE("iface %p, mode %p.\n", iface, pMode); 429 440 430 441 wined3d_mutex_lock(); … … 440 451 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 441 452 HRESULT hr; 442 TRACE("(%p) Relay\n", This); 453 454 TRACE("iface %p, parameters %p.\n", iface, pParameters); 443 455 444 456 wined3d_mutex_lock(); … … 453 465 IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl*)pCursorBitmap; 454 466 HRESULT hr; 455 TRACE("(%p) Relay\n", This); 467 468 TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", 469 iface, XHotSpot, YHotSpot, pCursorBitmap); 470 456 471 if(!pCursorBitmap) { 457 472 WARN("No cursor bitmap, returning WINED3DERR_INVALIDCALL\n"); … … 468 483 static void WINAPI IDirect3DDevice8Impl_SetCursorPosition(LPDIRECT3DDEVICE8 iface, UINT XScreenSpace, UINT YScreenSpace, DWORD Flags) { 469 484 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 470 TRACE("(%p) Relay\n", This); 485 486 TRACE("iface %p, x %u, y %u, flags %#x.\n", 487 iface, XScreenSpace, YScreenSpace, Flags); 471 488 472 489 wined3d_mutex_lock(); … … 478 495 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 479 496 BOOL ret; 480 TRACE("(%p) Relay\n", This); 497 498 TRACE("iface %p, show %#x.\n", iface, bShow); 481 499 482 500 wined3d_mutex_lock(); … … 487 505 } 488 506 489 static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain) { 490 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 491 IDirect3DSwapChain8Impl* object; 492 HRESULT hrc = D3D_OK; 507 static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(IDirect3DDevice8 *iface, 508 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain8 **swapchain) 509 { 510 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 511 IDirect3DSwapChain8Impl *object; 512 HRESULT hr; 513 514 TRACE("iface %p, present_parameters %p, swapchain %p.\n", 515 iface, present_parameters, swapchain); 516 517 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 518 if (!object) 519 { 520 ERR("Failed to allocate swapchain memory.\n"); 521 return E_OUTOFMEMORY; 522 } 523 524 hr = swapchain_init(object, This, present_parameters); 525 if (FAILED(hr)) 526 { 527 WARN("Failed to initialize swapchain, hr %#x.\n", hr); 528 HeapFree(GetProcessHeap(), 0, object); 529 return hr; 530 } 531 532 TRACE("Created swapchain %p.\n", object); 533 *swapchain = (IDirect3DSwapChain8 *)object; 534 535 return D3D_OK; 536 } 537 538 static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) { 539 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 493 540 WINED3DPRESENT_PARAMETERS localParameters; 494 495 TRACE("(%p) Relay\n", This); 496 497 /* Fix the back buffer count */ 498 if(pPresentationParameters->BackBufferCount == 0) { 499 pPresentationParameters->BackBufferCount = 1; 500 } 501 502 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 503 if (NULL == object) { 504 FIXME("Allocation of memory failed\n"); 505 *pSwapChain = NULL; 506 return D3DERR_OUTOFVIDEOMEMORY; 507 } 508 object->ref = 1; 509 object->lpVtbl = &Direct3DSwapChain8_Vtbl; 510 511 /* Allocate an associated WineD3DDevice object */ 541 HRESULT hr; 542 543 TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters); 544 512 545 localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth; 513 546 localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight; … … 527 560 528 561 wined3d_mutex_lock(); 529 hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters, 530 &object->wineD3DSwapChain, (IUnknown *)object, SURFACE_OPENGL); 562 hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters); 563 if(SUCCEEDED(hr)) { 564 hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0); 565 } 531 566 wined3d_mutex_unlock(); 532 567 … … 545 580 pPresentationParameters->FullScreen_PresentationInterval = localParameters.PresentationInterval; 546 581 547 if (hrc != D3D_OK) {548 FIXME("(%p) call to IWineD3DDevice_CreateSwapChain failed\n", This);549 HeapFree(GetProcessHeap(), 0 , object);550 *pSwapChain = NULL;551 }else{552 IUnknown_AddRef(iface);553 object->parentDevice = iface;554 *pSwapChain = (IDirect3DSwapChain8 *)object;555 }556 TRACE("(%p) returning %p\n", This, *pSwapChain);557 return hrc;558 }559 560 static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {561 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;562 WINED3DPRESENT_PARAMETERS localParameters;563 HRESULT hr;564 565 TRACE("(%p) Relay pPresentationParameters(%p)\n", This, pPresentationParameters);566 567 localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;568 localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;569 localParameters.BackBufferFormat = wined3dformat_from_d3dformat(pPresentationParameters->BackBufferFormat);570 localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;571 localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;572 localParameters.MultiSampleQuality = 0; /* d3d9 only */573 localParameters.SwapEffect = pPresentationParameters->SwapEffect;574 localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;575 localParameters.Windowed = pPresentationParameters->Windowed;576 localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;577 localParameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);578 localParameters.Flags = pPresentationParameters->Flags;579 localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;580 localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;581 localParameters.AutoRestoreDisplayMode = TRUE;582 583 wined3d_mutex_lock();584 hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);585 wined3d_mutex_unlock();586 587 pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;588 pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;589 pPresentationParameters->BackBufferFormat = d3dformat_from_wined3dformat(localParameters.BackBufferFormat);590 pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;591 pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;592 pPresentationParameters->SwapEffect = localParameters.SwapEffect;593 pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;594 pPresentationParameters->Windowed = localParameters.Windowed;595 pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;596 pPresentationParameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(localParameters.AutoDepthStencilFormat);597 pPresentationParameters->Flags = localParameters.Flags;598 pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;599 pPresentationParameters->FullScreen_PresentationInterval = localParameters.PresentationInterval;600 601 582 return hr; 602 583 } … … 605 586 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 606 587 HRESULT hr; 607 TRACE("(%p) Relay\n", This); 588 589 TRACE("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p.\n", 590 iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); 608 591 609 592 wined3d_mutex_lock(); … … 619 602 HRESULT rc = D3D_OK; 620 603 621 TRACE("(%p) Relay\n", This); 604 TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", 605 iface, BackBuffer, Type, ppBackBuffer); 622 606 623 607 wined3d_mutex_lock(); … … 635 619 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 636 620 HRESULT hr; 637 TRACE("(%p) Relay\n", This); 621 622 TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus); 638 623 639 624 wined3d_mutex_lock(); … … 646 631 static void WINAPI IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { 647 632 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 648 TRACE("(%p) Relay\n", This); 633 634 TRACE("iface %p, flags %#x, ramp %p.\n", iface, Flags, pRamp); 649 635 650 636 /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ … … 656 642 static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) { 657 643 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 658 TRACE("(%p) Relay\n", This); 644 645 TRACE("iface %p, ramp %p.\n", iface, pRamp); 659 646 660 647 /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ … … 829 816 HRESULT hr; 830 817 831 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface); 818 TRACE("iface %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n" 819 "\tusage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n", 820 iface, Width, Height, Format, Lockable, Discard, Level, ppSurface, 821 Usage, Pool, MultiSample, MultisampleQuality); 832 822 833 823 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl)); … … 855 845 static HRESULT WINAPI IDirect3DDevice8Impl_CreateRenderTarget(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable, IDirect3DSurface8** ppSurface) { 856 846 HRESULT hr; 857 TRACE("Relay\n"); 847 848 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n", 849 iface, Width, Height, Format, MultiSample, Lockable, ppSurface); 858 850 859 851 hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */, … … 865 857 static HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, IDirect3DSurface8** ppSurface) { 866 858 HRESULT hr; 867 TRACE("Relay\n"); 859 860 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n", 861 iface, Width, Height, Format, MultiSample, ppSurface); 868 862 869 863 /* TODO: Verify that Discard is false */ … … 877 871 static HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) { 878 872 HRESULT hr; 879 TRACE("Relay\n"); 873 874 TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n", 875 iface, Width, Height, Format, ppSurface); 880 876 881 877 hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */, … … 892 888 HRESULT hr = WINED3D_OK; 893 889 WINED3DFORMAT srcFormat, destFormat; 894 UINT srcWidth, destWidth;895 UINT srcHeight, destHeight;896 UINT srcSize;897 890 WINED3DSURFACE_DESC winedesc; 898 891 899 TRACE(" (%p) pSrcSur=%p, pSourceRects=%p, cRects=%d, pDstSur=%p, pDestPtsArr=%p\n", iface,900 pSourceSurface, pSourceRects, cRects, pDestinationSurface, pDestPoints);901 902 903 /* Check that the source texture is in WINED3DPOOL_SYSTEMMEM and the destination texture is in WINED3DPOOL_DEFAULT*/892 TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n", 893 iface, pSourceSurface, pSourceRects, cRects, pDestinationSurface, pDestPoints); 894 895 /* Check that the source texture is in WINED3DPOOL_SYSTEMMEM and the 896 * destination texture is in WINED3DPOOL_DEFAULT. */ 904 897 905 898 wined3d_mutex_lock(); 906 899 IWineD3DSurface_GetDesc(Source->wineD3DSurface, &winedesc); 907 900 srcFormat = winedesc.format; 908 srcWidth = winedesc.width;909 srcHeight = winedesc.height;910 srcSize = winedesc.size;911 901 912 902 IWineD3DSurface_GetDesc(Dest->wineD3DSurface, &winedesc); 913 903 destFormat = winedesc.format; 914 destWidth = winedesc.width;915 destHeight = winedesc.height;916 904 917 905 /* Check that the source and destination formats match */ … … 923 911 TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", iface); 924 912 IWineD3DSurface_SetFormat(Dest->wineD3DSurface, srcFormat); 925 destFormat = srcFormat;926 913 } 927 914 … … 950 937 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 951 938 HRESULT hr; 952 TRACE("(%p) Relay\n" , This); 939 940 TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, pSourceTexture, pDestinationTexture); 953 941 954 942 wined3d_mutex_lock(); … … 964 952 HRESULT hr; 965 953 966 TRACE(" (%p) Relay\n" , This);954 TRACE("iface %p, dst_surface %p.\n", iface, pDestSurface); 967 955 968 956 if (pDestSurface == NULL) { … … 984 972 IWineD3DSurface *original_ds = NULL; 985 973 HRESULT hr; 986 TRACE("(%p) Relay\n" , This); 974 975 TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, pRenderTarget, pNewZStencil); 987 976 988 977 wined3d_mutex_lock(); … … 993 982 hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wineD3DSurface : NULL); 994 983 if (SUCCEEDED(hr) && pSurface) 995 hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface );984 hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface, TRUE); 996 985 if (FAILED(hr)) IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, original_ds); 997 986 } … … 1008 997 IWineD3DSurface *pRenderTarget; 1009 998 1010 TRACE(" (%p) Relay\n" , This);999 TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget); 1011 1000 1012 1001 if (ppRenderTarget == NULL) { … … 1034 1023 IWineD3DSurface *pZStencilSurface; 1035 1024 1036 TRACE("(%p) Relay\n" , This); 1025 TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface); 1026 1037 1027 if(ppZStencilSurface == NULL){ 1038 1028 return D3DERR_INVALIDCALL; … … 1057 1047 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1058 1048 HRESULT hr; 1059 TRACE("(%p) Relay\n" , This); 1049 1050 TRACE("iface %p.\n", iface); 1060 1051 1061 1052 wined3d_mutex_lock(); … … 1066 1057 } 1067 1058 1068 static HRESULT WINAPI IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) { 1069 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1070 HRESULT hr; 1071 TRACE("(%p) Relay\n" , This); 1059 static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) { 1060 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1061 HRESULT hr; 1062 1063 TRACE("iface %p.\n", iface); 1072 1064 1073 1065 wined3d_mutex_lock(); … … 1081 1073 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1082 1074 HRESULT hr; 1083 TRACE("(%p) Relay\n" , This); 1075 1076 TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n", 1077 iface, Count, pRects, Flags, Color, Z, Stencil); 1084 1078 1085 1079 /* Note: D3DRECT is compatible with WINED3DRECT */ … … 1094 1088 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1095 1089 HRESULT hr; 1096 TRACE("(%p) Relay\n" , This); 1090 1091 TRACE("iface %p, state %#x, matrix %p.\n", iface, State, lpMatrix); 1097 1092 1098 1093 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ … … 1107 1102 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1108 1103 HRESULT hr; 1109 TRACE("(%p) Relay\n" , This); 1104 1105 TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix); 1110 1106 1111 1107 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ … … 1120 1116 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1121 1117 HRESULT hr; 1122 TRACE("(%p) Relay\n" , This); 1118 1119 TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix); 1123 1120 1124 1121 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ … … 1133 1130 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1134 1131 HRESULT hr; 1135 TRACE("(%p) Relay\n" , This); 1132 1133 TRACE("iface %p, viewport %p.\n", iface, pViewport); 1136 1134 1137 1135 /* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */ … … 1146 1144 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1147 1145 HRESULT hr; 1148 TRACE("(%p) Relay\n" , This); 1146 1147 TRACE("iface %p, viewport %p.\n", iface, pViewport); 1149 1148 1150 1149 /* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */ … … 1159 1158 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1160 1159 HRESULT hr; 1161 TRACE("(%p) Relay\n" , This); 1160 1161 TRACE("iface %p, material %p.\n", iface, pMaterial); 1162 1162 1163 1163 /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */ … … 1172 1172 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1173 1173 HRESULT hr; 1174 TRACE("(%p) Relay\n" , This); 1174 1175 TRACE("iface %p, material %p.\n", iface, pMaterial); 1175 1176 1176 1177 /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */ … … 1185 1186 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1186 1187 HRESULT hr; 1187 TRACE("(%p) Relay\n" , This); 1188 1189 TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight); 1188 1190 1189 1191 /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */ … … 1198 1200 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1199 1201 HRESULT hr; 1200 TRACE("(%p) Relay\n" , This); 1202 1203 TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight); 1201 1204 1202 1205 /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */ … … 1211 1214 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1212 1215 HRESULT hr; 1213 TRACE("(%p) Relay\n" , This); 1216 1217 TRACE("iface %p, index %u, enable %#x.\n", iface, Index, Enable); 1214 1218 1215 1219 wined3d_mutex_lock(); … … 1223 1227 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1224 1228 HRESULT hr; 1225 TRACE("(%p) Relay\n" , This); 1229 1230 TRACE("iface %p, index %u, enable %p.\n", iface, Index, pEnable); 1226 1231 1227 1232 wined3d_mutex_lock(); … … 1235 1240 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1236 1241 HRESULT hr; 1237 TRACE("(%p) Relay\n" , This); 1242 1243 TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane); 1238 1244 1239 1245 wined3d_mutex_lock(); … … 1247 1253 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1248 1254 HRESULT hr; 1249 TRACE("(%p) Relay\n" , This); 1255 1256 TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane); 1250 1257 1251 1258 wined3d_mutex_lock(); … … 1259 1266 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1260 1267 HRESULT hr; 1261 TRACE("(%p) Relay\n" , This); 1268 1269 TRACE("iface %p, state %#x, value %#x.\n", iface, State, Value); 1262 1270 1263 1271 wined3d_mutex_lock(); … … 1271 1279 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1272 1280 HRESULT hr; 1273 TRACE("(%p) Relay\n" , This); 1281 1282 TRACE("iface %p, state %#x, value %p.\n", iface, State, pValue); 1274 1283 1275 1284 wined3d_mutex_lock(); … … 1283 1292 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1284 1293 HRESULT hr; 1285 TRACE("(%p)\n", This); 1294 1295 TRACE("iface %p.\n", iface); 1286 1296 1287 1297 wined3d_mutex_lock(); … … 1294 1304 static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface, DWORD* pToken) { 1295 1305 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1296 HRESULT hr; 1297 IWineD3DStateBlock* wineD3DStateBlock; 1298 IDirect3DStateBlock8Impl* object; 1299 1300 TRACE("(%p) Relay\n", This); 1306 IWineD3DStateBlock *stateblock; 1307 HRESULT hr; 1308 1309 TRACE("iface %p, token %p.\n", iface, pToken); 1301 1310 1302 1311 /* Tell wineD3D to endstateblock before anything else (in case we run out … … 1304 1313 */ 1305 1314 wined3d_mutex_lock(); 1306 hr = IWineD3DDevice_EndStateBlock(This->WineD3DDevice , & wineD3DStateBlock);1315 hr = IWineD3DDevice_EndStateBlock(This->WineD3DDevice , &stateblock); 1307 1316 if (hr != D3D_OK) { 1308 1317 WARN("IWineD3DDevice_EndStateBlock returned an error\n"); … … 1311 1320 } 1312 1321 1313 /* allocate a new IDirectD3DStateBlock */ 1314 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,sizeof(IDirect3DStateBlock8Impl)); 1315 object->ref = 1; 1316 object->lpVtbl = &Direct3DStateBlock8_Vtbl; 1317 1318 object->wineD3DStateBlock = wineD3DStateBlock; 1319 1320 *pToken = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_SB); 1322 *pToken = d3d8_allocate_handle(&This->handle_table, stateblock, D3D8_HANDLE_SB); 1321 1323 wined3d_mutex_unlock(); 1322 1324 … … 1324 1326 { 1325 1327 ERR("Failed to create a handle\n"); 1326 IDirect3DStateBlock8_Release((IDirect3DStateBlock8 *)object); 1328 wined3d_mutex_lock(); 1329 IWineD3DStateBlock_Release(stateblock); 1330 wined3d_mutex_unlock(); 1327 1331 return E_FAIL; 1328 1332 } 1329 1333 ++*pToken; 1330 1334 1331 TRACE("Returning %#x (%p).\n", *pToken, object);1335 TRACE("Returning %#x (%p).\n", *pToken, stateblock); 1332 1336 1333 1337 return hr; … … 1336 1340 static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) { 1337 1341 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1338 I Direct3DStateBlock8Impl *pSB;1339 HRESULT hr; 1340 1341 TRACE(" (%p) %#x Relay\n", This, Token);1342 1343 wined3d_mutex_lock(); 1344 pSB= d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB);1345 if (! pSB)1342 IWineD3DStateBlock *stateblock; 1343 HRESULT hr; 1344 1345 TRACE("iface %p, token %#x.\n", iface, Token); 1346 1347 wined3d_mutex_lock(); 1348 stateblock = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB); 1349 if (!stateblock) 1346 1350 { 1347 1351 WARN("Invalid handle (%#x) passed.\n", Token); … … 1349 1353 return D3DERR_INVALIDCALL; 1350 1354 } 1351 hr = IWineD3DStateBlock_Apply( pSB->wineD3DStateBlock);1355 hr = IWineD3DStateBlock_Apply(stateblock); 1352 1356 wined3d_mutex_unlock(); 1353 1357 … … 1357 1361 static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) { 1358 1362 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1359 I Direct3DStateBlock8Impl *pSB;1360 HRESULT hr; 1361 1362 TRACE(" (%p) %#x Relay\n", This, Token);1363 1364 wined3d_mutex_lock(); 1365 pSB= d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB);1366 if (! pSB)1363 IWineD3DStateBlock *stateblock; 1364 HRESULT hr; 1365 1366 TRACE("iface %p, token %#x.\n", iface, Token); 1367 1368 wined3d_mutex_lock(); 1369 stateblock = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB); 1370 if (!stateblock) 1367 1371 { 1368 1372 WARN("Invalid handle (%#x) passed.\n", Token); … … 1370 1374 return D3DERR_INVALIDCALL; 1371 1375 } 1372 hr = IWineD3DStateBlock_Capture( pSB->wineD3DStateBlock);1376 hr = IWineD3DStateBlock_Capture(stateblock); 1373 1377 wined3d_mutex_unlock(); 1374 1378 … … 1378 1382 static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) { 1379 1383 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1380 IDirect3DStateBlock8Impl *pSB; 1381 1382 TRACE("(%p) Relay\n", This); 1383 1384 wined3d_mutex_lock(); 1385 pSB = d3d8_free_handle(&This->handle_table, Token - 1, D3D8_HANDLE_SB); 1386 wined3d_mutex_unlock(); 1387 1388 if (!pSB) 1384 IWineD3DStateBlock *stateblock; 1385 1386 TRACE("iface %p, token %#x.\n", iface, Token); 1387 1388 wined3d_mutex_lock(); 1389 stateblock = d3d8_free_handle(&This->handle_table, Token - 1, D3D8_HANDLE_SB); 1390 1391 if (!stateblock) 1389 1392 { 1390 1393 WARN("Invalid handle (%#x) passed.\n", Token); 1394 wined3d_mutex_unlock(); 1391 1395 return D3DERR_INVALIDCALL; 1392 1396 } 1393 1397 1394 if (IUnknown_Release((IUnknown *)pSB)) 1395 { 1396 ERR("Stateblock %p has references left, this shouldn't happen.\n", pSB); 1397 } 1398 if (IWineD3DStateBlock_Release((IUnknown *)stateblock)) 1399 { 1400 ERR("Stateblock %p has references left, this shouldn't happen.\n", stateblock); 1401 } 1402 wined3d_mutex_unlock(); 1398 1403 1399 1404 return D3D_OK; … … 1404 1409 { 1405 1410 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1406 I Direct3DStateBlock8Impl *object;1407 HRESULT hr; 1408 1409 TRACE(" (%p) Relay\n", This);1411 IWineD3DStateBlock *stateblock; 1412 HRESULT hr; 1413 1414 TRACE("iface %p, type %#x, handle %p.\n", iface, Type, handle); 1410 1415 1411 1416 if (Type != D3DSBT_ALL … … 1417 1422 } 1418 1423 1419 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock8Impl));1420 if (!object)1421 {1422 ERR("Failed to allocate memory.\n");1423 return E_OUTOFMEMORY;1424 }1425 1426 object->lpVtbl = &Direct3DStateBlock8_Vtbl;1427 object->ref = 1;1428 1429 1424 wined3d_mutex_lock(); 1430 1425 hr = IWineD3DDevice_CreateStateBlock(This->WineD3DDevice, (WINED3DSTATEBLOCKTYPE)Type, 1431 & object->wineD3DStateBlock, (IUnknown *)object);1426 &stateblock, NULL); 1432 1427 if (FAILED(hr)) 1433 1428 { 1434 1429 wined3d_mutex_unlock(); 1435 1430 ERR("IWineD3DDevice_CreateStateBlock failed, hr %#x\n", hr); 1436 HeapFree(GetProcessHeap(), 0, object);1437 1431 return hr; 1438 1432 } 1439 1433 1440 *handle = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_SB);1434 *handle = d3d8_allocate_handle(&This->handle_table, stateblock, D3D8_HANDLE_SB); 1441 1435 wined3d_mutex_unlock(); 1442 1436 … … 1444 1438 { 1445 1439 ERR("Failed to allocate a handle.\n"); 1446 IDirect3DStateBlock8_Release((IDirect3DStateBlock8 *)object); 1440 wined3d_mutex_lock(); 1441 IWineD3DStateBlock_Release(stateblock); 1442 wined3d_mutex_unlock(); 1447 1443 return E_FAIL; 1448 1444 } 1449 1445 ++*handle; 1450 1446 1451 TRACE("Returning %#x (%p).\n", *handle, object);1447 TRACE("Returning %#x (%p).\n", *handle, stateblock); 1452 1448 1453 1449 return hr; … … 1457 1453 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1458 1454 HRESULT hr; 1459 TRACE("(%p) Relay\n" , This); 1455 1456 TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); 1460 1457 /* FIXME: Verify that D3DCLIPSTATUS8 ~= WINED3DCLIPSTATUS */ 1461 1458 … … 1470 1467 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1471 1468 HRESULT hr; 1472 TRACE("(%p) Relay\n" , This); 1469 1470 TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); 1473 1471 1474 1472 wined3d_mutex_lock(); … … 1484 1482 HRESULT hr; 1485 1483 1486 TRACE(" (%p) Relay\n" , This);1484 TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, ppTexture); 1487 1485 1488 1486 if(ppTexture == NULL){ … … 1517 1515 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1518 1516 HRESULT hr; 1519 TRACE("(%p) Relay %d %p\n" , This, Stage, pTexture); 1517 1518 TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, pTexture); 1520 1519 1521 1520 wined3d_mutex_lock(); … … 1569 1568 const struct tss_lookup *l = &tss_lookup[Type]; 1570 1569 HRESULT hr; 1571 TRACE("(%p) Relay\n" , This); 1570 1571 TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, Stage, Type, pValue); 1572 1572 1573 1573 wined3d_mutex_lock(); … … 1583 1583 const struct tss_lookup *l = &tss_lookup[Type]; 1584 1584 HRESULT hr; 1585 TRACE("(%p) Relay\n" , This); 1585 1586 TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, Stage, Type, Value); 1586 1587 1587 1588 wined3d_mutex_lock(); … … 1596 1597 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1597 1598 HRESULT hr; 1598 TRACE("(%p) Relay\n" , This); 1599 1600 TRACE("iface %p, pass_count %p.\n", iface, pNumPasses); 1599 1601 1600 1602 wined3d_mutex_lock(); … … 1605 1607 } 1606 1608 1607 static HRESULT WINAPI IDirect3DDevice8Impl_GetInfo(LPDIRECT3DDEVICE8 iface, DWORD DevInfoID, void* pDevInfoStruct, DWORD DevInfoStructSize) { 1608 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1609 FIXME("(%p) : stub\n", This); 1609 static HRESULT WINAPI IDirect3DDevice8Impl_GetInfo(IDirect3DDevice8 *iface, 1610 DWORD info_id, void *info, DWORD info_size) 1611 { 1612 FIXME("iface %p, info_id %#x, info %p, info_size %u stub!\n", iface, info_id, info, info_size); 1613 1610 1614 return D3D_OK; 1611 1615 } … … 1614 1618 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1615 1619 HRESULT hr; 1616 TRACE("(%p) Relay\n" , This); 1620 1621 TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries); 1617 1622 1618 1623 wined3d_mutex_lock(); … … 1626 1631 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1627 1632 HRESULT hr; 1628 TRACE("(%p) Relay\n" , This); 1633 1634 TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries); 1629 1635 1630 1636 wined3d_mutex_lock(); … … 1638 1644 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1639 1645 HRESULT hr; 1640 TRACE("(%p) Relay\n" , This); 1646 1647 TRACE("iface %p, palette_idx %u.\n", iface, PaletteNumber); 1641 1648 1642 1649 wined3d_mutex_lock(); … … 1650 1657 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1651 1658 HRESULT hr; 1652 TRACE("(%p) Relay\n" , This); 1659 1660 TRACE("iface %p, palette_idx %p.\n", iface, PaletteNumber); 1653 1661 1654 1662 wined3d_mutex_lock(); … … 1664 1672 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1665 1673 HRESULT hr; 1666 TRACE("(%p) Relay\n" , This); 1674 1675 TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n", 1676 iface, PrimitiveType, StartVertex, PrimitiveCount); 1667 1677 1668 1678 wined3d_mutex_lock(); … … 1679 1689 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1680 1690 HRESULT hr; 1681 TRACE("(%p) Relay\n" , This); 1691 1692 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n", 1693 iface, PrimitiveType, MinVertexIndex, NumVertices, startIndex, primCount); 1682 1694 1683 1695 wined3d_mutex_lock(); … … 1693 1705 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1694 1706 HRESULT hr; 1695 TRACE("(%p) Relay\n" , This); 1707 1708 TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", 1709 iface, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride); 1696 1710 1697 1711 wined3d_mutex_lock(); … … 1711 1725 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1712 1726 HRESULT hr; 1713 TRACE("(%p) Relay\n" , This); 1727 1728 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" 1729 "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", 1730 iface, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount, 1731 pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); 1714 1732 1715 1733 wined3d_mutex_lock(); … … 1727 1745 HRESULT hr; 1728 1746 IDirect3DVertexBuffer8Impl *dest = (IDirect3DVertexBuffer8Impl *) pDestBuffer; 1729 TRACE("(%p) Relay\n" , This); 1747 1748 TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n", 1749 iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags); 1730 1750 1731 1751 wined3d_mutex_lock(); … … 1854 1874 HRESULT hr; 1855 1875 1856 TRACE(" (%p) : Relay\n", This);1876 TRACE("iface %p, shader %#x.\n", iface, pShader); 1857 1877 1858 1878 if (VS_HIGHESTFIXEDFXF >= pShader) { … … 1896 1916 HRESULT hrc; 1897 1917 1898 TRACE(" (%p) : Relay device@%p\n", This, This->WineD3DDevice);1918 TRACE("iface %p, shader %p.\n", iface, ppShader); 1899 1919 1900 1920 wined3d_mutex_lock(); … … 1934 1954 IWineD3DVertexShader *cur = NULL; 1935 1955 1936 TRACE(" (%p) : pShader %#x\n", This, pShader);1956 TRACE("iface %p, shader %#x.\n", iface, pShader); 1937 1957 1938 1958 wined3d_mutex_lock(); … … 1967 1987 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1968 1988 HRESULT hr; 1969 TRACE("(%p) : Relay\n", This); 1989 1990 TRACE("iface %p, register %u, data %p, count %u.\n", 1991 iface, Register, pConstantData, ConstantCount); 1970 1992 1971 1993 if(Register + ConstantCount > D3D8_MAX_VERTEX_SHADER_CONSTANTF) { … … 1985 2007 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 1986 2008 HRESULT hr; 1987 TRACE("(%p) : Relay\n", This); 2009 2010 TRACE("iface %p, register %u, data %p, count %u.\n", 2011 iface, Register, pConstantData, ConstantCount); 1988 2012 1989 2013 if(Register + ConstantCount > D3D8_MAX_VERTEX_SHADER_CONSTANTF) { … … 2005 2029 IDirect3DVertexShader8Impl *shader; 2006 2030 2007 TRACE("(%p) : pVertexShader 0x%08x, pData %p, *pSizeOfData %u\n", This, pVertexShader, pData, *pSizeOfData); 2031 TRACE("iface %p, shader %#x, data %p, data_size %p.\n", 2032 iface, pVertexShader, pData, pSizeOfData); 2008 2033 2009 2034 wined3d_mutex_lock(); … … 2041 2066 HRESULT hr; 2042 2067 2043 TRACE("(%p) : pVertexShader %#x, pData %p, pSizeOfData %p\n", This, pVertexShader, pData, pSizeOfData); 2068 TRACE("iface %p, shader %#x, data %p, data_size %p.\n", 2069 iface, pVertexShader, pData, pSizeOfData); 2044 2070 2045 2071 wined3d_mutex_lock(); … … 2070 2096 HRESULT hr; 2071 2097 IDirect3DIndexBuffer8Impl *ib = (IDirect3DIndexBuffer8Impl *)pIndexData; 2072 TRACE("(%p) Relay\n", This); 2098 2099 TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, pIndexData, baseVertexIndex); 2073 2100 2074 2101 /* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that … … 2093 2120 HRESULT rc = D3D_OK; 2094 2121 2095 TRACE(" (%p) Relay\n", This);2122 TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, ppIndexData, pBaseVertexIndex); 2096 2123 2097 2124 if(ppIndexData == NULL){ … … 2174 2201 HRESULT hr; 2175 2202 2176 TRACE(" (%p) : pShader %#x\n", This, pShader);2203 TRACE("iface %p, shader %#x.\n", iface, pShader); 2177 2204 2178 2205 wined3d_mutex_lock(); … … 2203 2230 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2204 2231 IWineD3DPixelShader *object; 2205 2206 2232 HRESULT hrc = D3D_OK; 2207 TRACE("(%p) Relay\n", This); 2233 2234 TRACE("iface %p, shader %p.\n", iface, ppShader); 2235 2208 2236 if (NULL == ppShader) { 2209 2237 TRACE("(%p) Invalid call\n", This); … … 2234 2262 IWineD3DPixelShader *cur = NULL; 2235 2263 2236 TRACE(" (%p) : pShader %#x\n", This, pShader);2264 TRACE("iface %p, shader %#x.\n", iface, pShader); 2237 2265 2238 2266 wined3d_mutex_lock(); … … 2243 2271 WARN("Invalid handle (%#x) passed.\n", pShader); 2244 2272 wined3d_mutex_unlock(); 2245 return D3D _OK;2273 return D3DERR_INVALIDCALL; 2246 2274 } 2247 2275 … … 2267 2295 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2268 2296 HRESULT hr; 2269 TRACE("(%p) Relay\n", This); 2297 2298 TRACE("iface %p, register %u, data %p, count %u.\n", 2299 iface, Register, pConstantData, ConstantCount); 2270 2300 2271 2301 wined3d_mutex_lock(); … … 2279 2309 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2280 2310 HRESULT hr; 2281 TRACE("(%p) Relay\n", This); 2311 2312 TRACE("iface %p, register %u, data %p, count %u.\n", 2313 iface, Register, pConstantData, ConstantCount); 2282 2314 2283 2315 wined3d_mutex_lock(); … … 2293 2325 HRESULT hr; 2294 2326 2295 TRACE("(%p) : pPixelShader %#x, pData %p, pSizeOfData %p\n", This, pPixelShader, pData, pSizeOfData); 2327 TRACE("iface %p, shader %#x, data %p, data_size %p.\n", 2328 iface, pPixelShader, pData, pSizeOfData); 2296 2329 2297 2330 wined3d_mutex_lock(); … … 2314 2347 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2315 2348 HRESULT hr; 2316 TRACE("(%p) Relay\n", This); 2349 2350 TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", 2351 iface, Handle, pNumSegs, pRectPatchInfo); 2317 2352 2318 2353 wined3d_mutex_lock(); … … 2326 2361 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2327 2362 HRESULT hr; 2328 TRACE("(%p) Relay\n", This); 2363 2364 TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", 2365 iface, Handle, pNumSegs, pTriPatchInfo); 2329 2366 2330 2367 wined3d_mutex_lock(); … … 2338 2375 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2339 2376 HRESULT hr; 2340 TRACE("(%p) Relay\n", This); 2377 2378 TRACE("iface %p, handle %#x.\n", iface, Handle); 2341 2379 2342 2380 wined3d_mutex_lock(); … … 2350 2388 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; 2351 2389 HRESULT hr; 2352 TRACE("(%p) Relay\n" , This); 2390 2391 TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n", 2392 iface, StreamNumber, pStreamData, Stride); 2353 2393 2354 2394 wined3d_mutex_lock(); … … 2366 2406 HRESULT rc = D3D_OK; 2367 2407 2368 TRACE("(%p) Relay\n" , This); 2408 TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n", 2409 iface, StreamNumber, pStream, pStride); 2369 2410 2370 2411 if(pStream == NULL){ … … 2388 2429 } 2389 2430 2390 2391 const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl = 2431 static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl = 2392 2432 { 2393 2433 IDirect3DDevice8Impl_QueryInterface, … … 2717 2757 } 2718 2758 2719 const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl =2759 static const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl = 2720 2760 { 2721 2761 /* IUnknown methods */ … … 2731 2771 device_parent_CreateSwapChain, 2732 2772 }; 2773 2774 HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapter, 2775 D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) 2776 { 2777 WINED3DPRESENT_PARAMETERS wined3d_parameters; 2778 HRESULT hr; 2779 2780 device->lpVtbl = &Direct3DDevice8_Vtbl; 2781 device->device_parent_vtbl = &d3d8_wined3d_device_parent_vtbl; 2782 device->ref = 1; 2783 device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 2784 D3D8_INITIAL_HANDLE_TABLE_SIZE * sizeof(*device->handle_table.entries)); 2785 if (!device->handle_table.entries) 2786 { 2787 ERR("Failed to allocate handle table memory.\n"); 2788 return E_OUTOFMEMORY; 2789 } 2790 device->handle_table.table_size = D3D8_INITIAL_HANDLE_TABLE_SIZE; 2791 2792 wined3d_mutex_lock(); 2793 hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, (IUnknown *)device, 2794 (IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice); 2795 if (FAILED(hr)) 2796 { 2797 WARN("Failed to create wined3d device, hr %#x.\n", hr); 2798 wined3d_mutex_unlock(); 2799 HeapFree(GetProcessHeap(), 0, device->handle_table.entries); 2800 return hr; 2801 } 2802 2803 if (flags & D3DCREATE_MULTITHREADED) IWineD3DDevice_SetMultithreaded(device->WineD3DDevice); 2804 2805 wined3d_parameters.BackBufferWidth = parameters->BackBufferWidth; 2806 wined3d_parameters.BackBufferHeight = parameters->BackBufferHeight; 2807 wined3d_parameters.BackBufferFormat = wined3dformat_from_d3dformat(parameters->BackBufferFormat); 2808 wined3d_parameters.BackBufferCount = parameters->BackBufferCount; 2809 wined3d_parameters.MultiSampleType = parameters->MultiSampleType; 2810 wined3d_parameters.MultiSampleQuality = 0; /* d3d9 only */ 2811 wined3d_parameters.SwapEffect = parameters->SwapEffect; 2812 wined3d_parameters.hDeviceWindow = parameters->hDeviceWindow; 2813 wined3d_parameters.Windowed = parameters->Windowed; 2814 wined3d_parameters.EnableAutoDepthStencil = parameters->EnableAutoDepthStencil; 2815 wined3d_parameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(parameters->AutoDepthStencilFormat); 2816 wined3d_parameters.Flags = parameters->Flags; 2817 wined3d_parameters.FullScreen_RefreshRateInHz = parameters->FullScreen_RefreshRateInHz; 2818 wined3d_parameters.PresentationInterval = parameters->FullScreen_PresentationInterval; 2819 wined3d_parameters.AutoRestoreDisplayMode = TRUE; 2820 2821 hr = IWineD3DDevice_Init3D(device->WineD3DDevice, &wined3d_parameters); 2822 if (FAILED(hr)) 2823 { 2824 WARN("Failed to initialize 3D, hr %#x.\n", hr); 2825 IWineD3DDevice_Release(device->WineD3DDevice); 2826 wined3d_mutex_unlock(); 2827 HeapFree(GetProcessHeap(), 0, device->handle_table.entries); 2828 return hr; 2829 } 2830 2831 hr = IWineD3DDevice_SetRenderState(device->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0); 2832 wined3d_mutex_unlock(); 2833 if (FAILED(hr)) 2834 { 2835 ERR("Failed to set minimum pointsize, hr %#x.\n", hr); 2836 goto err; 2837 } 2838 2839 parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; 2840 parameters->BackBufferHeight = wined3d_parameters.BackBufferHeight; 2841 parameters->BackBufferFormat = d3dformat_from_wined3dformat(wined3d_parameters.BackBufferFormat); 2842 parameters->BackBufferCount = wined3d_parameters.BackBufferCount; 2843 parameters->MultiSampleType = wined3d_parameters.MultiSampleType; 2844 parameters->SwapEffect = wined3d_parameters.SwapEffect; 2845 parameters->hDeviceWindow = wined3d_parameters.hDeviceWindow; 2846 parameters->Windowed = wined3d_parameters.Windowed; 2847 parameters->EnableAutoDepthStencil = wined3d_parameters.EnableAutoDepthStencil; 2848 parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(wined3d_parameters.AutoDepthStencilFormat); 2849 parameters->Flags = wined3d_parameters.Flags; 2850 parameters->FullScreen_RefreshRateInHz = wined3d_parameters.FullScreen_RefreshRateInHz; 2851 parameters->FullScreen_PresentationInterval = wined3d_parameters.PresentationInterval; 2852 2853 device->declArraySize = 16; 2854 device->decls = HeapAlloc(GetProcessHeap(), 0, device->declArraySize * sizeof(*device->decls)); 2855 if (!device->decls) 2856 { 2857 ERR("Failed to allocate FVF vertex delcaration map memory.\n"); 2858 hr = E_OUTOFMEMORY; 2859 goto err; 2860 } 2861 2862 return D3D_OK; 2863 2864 err: 2865 wined3d_mutex_lock(); 2866 IWineD3DDevice_Uninit3D(device->WineD3DDevice, D3D8CB_DestroySwapChain); 2867 IWineD3DDevice_Release(device->WineD3DDevice); 2868 wined3d_mutex_unlock(); 2869 HeapFree(GetProcessHeap(), 0, device->handle_table.entries); 2870 return hr; 2871 }
Note:
See TracChangeset
for help on using the changeset viewer.