Changeset 38331 in vbox
- Timestamp:
- Aug 5, 2011 3:29:06 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoLog.h
r38112 r38331 58 58 } while (0) 59 59 60 /* we can not print paged strings to RT logger, do it this way */ 61 #define _LOGMSG_STR(_logger, _a, _f) do {\ 62 int _i = 0; \ 63 for (;(_a)[_i];++_i) { \ 64 _logger(("%"_f, (_a)[_i])); \ 65 }\ 66 _logger(("\n")); \ 67 } while (0) 68 60 69 #define WARN_NOBP(_a) \ 61 70 do \ … … 78 87 #define LOGF_ENTER() LOGF(("ENTER")) 79 88 #define LOGF_LEAVE() LOGF(("LEAVE")) 80 #define LOGREL_EXACT(_a) _LOGMSG_EXACT(Log, _a) 89 #define LOG_EXACT(_a) _LOGMSG_EXACT(Log, _a) 90 #define LOGREL_EXACT(_a) _LOGMSG_EXACT(LogRel, _a) 91 /* we can not print paged strings to RT logger, do it this way */ 92 #define LOG_STRA(_a) do {\ 93 _LOGMSG_STR(Log, _a, "c"); \ 94 } while (0) 95 #define LOG_STRW(_a) do {\ 96 _LOGMSG_STR(Log, _a, "c"); \ 97 } while (0) 98 #define LOGREL_STRA(_a) do {\ 99 _LOGMSG_STR(LogRel, _a, "c"); \ 100 } while (0) 101 #define LOGREL_STRW(_a) do {\ 102 _LOGMSG_STR(LogRel, _a, "c"); \ 103 } while (0) 104 81 105 82 106 #endif /*VBOXVIDEOLOG_H*/ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispDbg.cpp
r38238 r38331 556 556 switch (pExceptionRecord->ExceptionCode) 557 557 { 558 case 0x40010006: /* <- OutputDebugString exception, ignore */ 559 case 0xe06d7363: /* <- ms compiler - generated exception related to C++ exception */ 560 case 0x000006d9: /* <- RPC exception, ignore */ 561 case 0x406d1388: /* <- VS/WinDbg thread naming exception, ignore */ 562 case 0xe0434f4d: /* <- CLR exception */ 558 case 0xc0000005: /* only access violation and debug exceptions actually matter */ 559 case 0xc0000003: 560 AssertRelease(0); 563 561 break; 564 562 default: 565 AssertRelease(0);566 563 break; 567 564 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/arb_program_shader.c
r37550 r38331 6967 6967 POINT offset = {0,0}; 6968 6968 UINT h; 6969 #ifdef VBOX_WITH_WDDM 6970 HWND hWnd = context->currentSwapchain->win_handle; 6971 ClientToScreen(hWnd, &offset); 6972 GetClientRect(hWnd, &windowsize); 6973 #else 6969 6974 ClientToScreen(context->win_handle, &offset); 6970 6975 GetClientRect(context->win_handle, &windowsize); 6976 #endif 6971 6977 h = windowsize.bottom - windowsize.top; 6972 6978 dst_rect.left -= offset.x; dst_rect.right -=offset.x; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r38236 r38331 768 768 { 769 769 #ifdef VBOX_WITH_WDDM 770 TRACE("Updating context %p window from %p to %p.\n", 771 context, context->win_handle, swapchain->win_handle); 770 TRACE("Updating context %p swapchain from %p to %p.\n", 771 context, context->currentSwapchain, swapchain); 772 773 context->valid = 1; 774 775 if (!swapchain_validate(swapchain)) 776 { 777 ERR("invalid swapchain %p\n", swapchain); 778 goto err; 779 } 780 context->currentSwapchain = swapchain; 781 782 if (!context_set_pixel_format(context->gl_info, swapchain->hDC, context->pixel_format)) 783 { 784 ERR("Failed to set pixel format %d on device context %p.\n", 785 context->pixel_format, swapchain->hDC); 786 goto err; 787 } 788 789 if (!pwglMakeCurrent(swapchain->hDC, context->glCtx)) 790 { 791 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 792 context->glCtx, swapchain->hDC, GetLastError()); 793 goto err; 794 } 772 795 #else 773 796 TRACE("Updating context %p window from %p to %p.\n", 774 797 context, context->win_handle, context->swapchain->win_handle); 775 #endif776 798 777 799 if (context->valid) 778 800 { 779 #ifndef VBOX_WITH_WDDM780 801 if (!ReleaseDC(context->win_handle, context->hdc)) 781 802 { … … 783 804 context->hdc, GetLastError()); 784 805 } 785 #endif786 806 } 787 807 else context->valid = 1; 788 808 789 #ifdef VBOX_WITH_WDDM790 if (!swapchain_validate(swapchain))791 {792 ERR("invalid swapchain %p\n", swapchain);793 goto err;794 }795 context->win_handle = swapchain->win_handle;796 context->currentSwapchain = swapchain;797 context->hdc = swapchain->hDC;798 #else799 809 context->win_handle = context->swapchain->win_handle; 800 810 if (!(context->hdc = GetDC(context->win_handle))) … … 803 813 goto err; 804 814 } 805 #endif806 815 807 816 if (!context_set_pixel_format(context->gl_info, context->hdc, context->pixel_format)) … … 818 827 goto err; 819 828 } 829 #endif 820 830 821 831 return; 822 823 832 err: 824 833 context->valid = 0; … … 831 840 ) 832 841 { 842 #ifdef VBOX_WITH_WDDM 843 if (!swapchain || context->currentSwapchain == swapchain) 844 { 845 context->valid = swapchain_validate(context->currentSwapchain); 846 } 847 else 848 #else 833 849 HWND wnd = WindowFromDC(context->hdc); 834 850 … … 838 854 WARN("DC %p belongs to window %p instead of %p., winEr(%d)\n", 839 855 context->hdc, wnd, context->win_handle, winEr); 840 #ifdef VBOX_WITH_WDDM841 if (!swapchain || context->win_handle == swapchain->win_handle)842 {843 ERR("!!!unexpected equal HWND!!!: DC %p belongs to window %p instead of %p., winEr(%d)\n",844 context->hdc, wnd, context->win_handle, winEr);845 }846 #endif847 856 context->valid = 0; 848 857 } 849 858 850 if ( 851 #ifdef VBOX_WITH_WDDM 852 swapchain && context->win_handle != swapchain->win_handle 853 #else 854 context->win_handle != context->swapchain->win_handle 855 #endif 856 ) 859 if (context->win_handle != context->swapchain->win_handle) 860 #endif 857 861 { 858 862 context_update_window(context … … 904 908 #ifdef VBOX_WITH_WDDM 905 909 context_validate_adjust_wnd(context); 910 if (context->valid && restore_ctx != context->glCtx) pwglMakeCurrent(context->currentSwapchain->hDC, context->glCtx); 911 else restore_ctx = NULL; 906 912 #else 907 913 context_validate(context); 908 #endif909 914 if (context->valid && restore_ctx != context->glCtx) pwglMakeCurrent(context->hdc, context->glCtx); 910 915 else restore_ctx = NULL; 916 #endif 911 917 912 918 ENTER_GL(); … … 1100 1106 if (ctx) 1101 1107 { 1108 #ifdef VBOX_WITH_WDDM 1109 TRACE("Switching to D3D context %p, GL context %p, device context %p.\n", ctx, ctx->glCtx, ctx->currentSwapchain->hDC); 1110 if (!pwglMakeCurrent(ctx->currentSwapchain->hDC, ctx->glCtx)) 1111 { 1112 DWORD err = GetLastError(); 1113 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 1114 ctx->glCtx, ctx->currentSwapchain->hDC, err); 1115 TlsSetValue(wined3d_context_tls_idx, NULL); 1116 return FALSE; 1117 } 1118 #else 1102 1119 TRACE("Switching to D3D context %p, GL context %p, device context %p.\n", ctx, ctx->glCtx, ctx->hdc); 1103 1120 if (!pwglMakeCurrent(ctx->hdc, ctx->glCtx)) … … 1109 1126 return FALSE; 1110 1127 } 1128 #endif 1111 1129 ctx->current = 1; 1112 1130 } … … 1173 1191 { 1174 1192 IWineD3DDeviceImpl *device = context->device; 1175 inti = 0;1193 UINT i = 0; 1176 1194 for (; i < device->numContexts; ++i) 1177 1195 { 1178 conststruct wined3d_context *ctx = device->contexts[i];1196 struct wined3d_context *ctx = device->contexts[i]; 1179 1197 if (ctx->glCtx == context->restore_ctx) 1180 1198 { … … 1588 1606 1589 1607 ret->glCtx = ctx; 1608 #ifndef VBOX_WITH_WDDM 1590 1609 ret->win_handle = swapchain->win_handle; 1591 #ifdef VBOX_WITH_WDDM1592 Assert(WindowFromDC(hdc) == ret->win_handle);1593 #endif1594 1610 ret->hdc = hdc; 1611 #endif 1595 1612 ret->pixel_format = pixel_format; 1596 1613 … … 1796 1813 else if (context->restore_ctx) 1797 1814 { 1798 if (!pwglMakeCurrent(context-> hdc, context->glCtx))1815 if (!pwglMakeCurrent(context->currentSwapchain->hDC, context->glCtx)) 1799 1816 { 1800 1817 DWORD err = GetLastError(); 1801 1818 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 1802 context-> hdc, context->glCtx, err);1819 context->currentSwapchain->hDC, context->glCtx, err); 1803 1820 } 1804 1821 } … … 2348 2365 if (!swapchain) 2349 2366 swapchain = (IWineD3DSwapChainImpl *)This->swapchains[This->NumberOfSwapChains-1]; /* just fallback to anything to avoid NPE */ 2350 context = findThreadContextForSwapChain( swapchain);2367 context = findThreadContextForSwapChain((IWineD3DSwapChain*)swapchain); 2351 2368 context_validate(context, swapchain); 2352 2369 } … … 2698 2715 else if (context->restore_ctx) 2699 2716 { 2717 #ifdef VBOX_WITH_WDDM 2718 if (!pwglMakeCurrent(context->currentSwapchain->hDC, context->glCtx)) 2719 { 2720 DWORD err = GetLastError(); 2721 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 2722 context->currentSwapchain->hDC, context->glCtx, err); 2723 } 2724 #else 2700 2725 if (!pwglMakeCurrent(context->hdc, context->glCtx)) 2701 2726 { … … 2704 2729 context->hdc, context->glCtx, err); 2705 2730 } 2731 #endif 2706 2732 } 2707 2733 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r38283 r38331 3892 3892 POINT offset = {0,0}; 3893 3893 UINT h; 3894 #ifdef VBOX_WITH_WDDM 3895 HWND hWnd = context->currentSwapchain->win_handle; 3896 ClientToScreen(hWnd, &offset); 3897 GetClientRect(hWnd, &windowsize); 3898 #else 3894 3899 ClientToScreen(context->win_handle, &offset); 3895 3900 GetClientRect(context->win_handle, &windowsize); 3901 #endif 3896 3902 h = windowsize.bottom - windowsize.top; 3897 3903 dst_rect.left -= offset.x; dst_rect.right -=offset.x; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r38112 r38331 299 299 } 300 300 301 #ifdef VBOX_WITH_WDDM 302 TRACE("Presenting HDC %p.\n", context->currentSwapchain->hDC); 303 #else 301 304 TRACE("Presenting HDC %p.\n", context->hdc); 305 #endif 302 306 303 307 render_to_fbo = This->render_to_fbo; … … 373 377 #if defined(VBOX_WITH_WDDM) && defined(DEBUG) 374 378 { 375 HWND wnd = WindowFromDC(context->hdc); 376 Assert(context->currentSwapchain && context->win_handle==context->currentSwapchain->win_handle); 377 Assert(wnd==context->win_handle); 378 Assert(IsWindow(context->win_handle)); 379 Assert(wnd == context->win_handle); 379 HWND wnd = WindowFromDC(context->currentSwapchain->hDC); 380 Assert(wnd == context->currentSwapchain->win_handle); 380 381 } 381 382 #endif … … 385 386 * call glFinish, which doesn't have any context set. So we use wglSwapLayerBuffers directly as well. 386 387 */ 387 pwglSwapLayerBuffers(context-> hdc, WGL_SWAP_MAIN_PLANE);388 pwglSwapLayerBuffers(context->currentSwapchain->hDC, WGL_SWAP_MAIN_PLANE); 388 389 #else 389 390 SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c
r38114 r38331 174 174 HRESULT hr = E_FAIL; 175 175 BOOL bResult; 176 /* need to serialize since vbox DispWorkerThread is using one pWorker->hEvent176 /* need to serialize since vboxExtWorkerThread is using one pWorker->hEvent 177 177 * to signal job completion */ 178 178 EnterCriticalSection(&pWorker->CritSect); … … 328 328 } 329 329 330 /* window creation API */ 331 static LRESULT CALLBACK vboxExtWndProc(HWND hwnd, 332 UINT uMsg, 333 WPARAM wParam, 334 LPARAM lParam 335 ) 336 { 337 switch(uMsg) 338 { 339 case WM_CLOSE: 340 TRACE("got WM_CLOSE for hwnd(0x%x)", hwnd); 341 return 0; 342 case WM_DESTROY: 343 TRACE("got WM_DESTROY for hwnd(0x%x)", hwnd); 344 return 0; 345 case WM_NCHITTEST: 346 TRACE("got WM_NCHITTEST for hwnd(0x%x)\n", hwnd); 347 return HTNOWHERE; 348 } 349 350 return DefWindowProc(hwnd, uMsg, wParam, lParam); 351 } 352 353 #define VBOXEXTWND_NAME "VboxDispD3DWineWnd" 354 355 HRESULT vboxExtWndDoCreate(DWORD w, DWORD h, HWND *phWnd) 356 { 357 HRESULT hr = S_OK; 358 HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL); 359 /* Register the Window Class. */ 360 WNDCLASS wc; 361 if (!GetClassInfo(hInstance, VBOXEXTWND_NAME, &wc)) 362 { 363 wc.style = 0;//CS_OWNDC; 364 wc.lpfnWndProc = vboxExtWndProc; 365 wc.cbClsExtra = 0; 366 wc.cbWndExtra = 0; 367 wc.hInstance = hInstance; 368 wc.hIcon = NULL; 369 wc.hCursor = NULL; 370 wc.hbrBackground = NULL; 371 wc.lpszMenuName = NULL; 372 wc.lpszClassName = VBOXEXTWND_NAME; 373 if (!RegisterClass(&wc)) 374 { 375 DWORD winErr = GetLastError(); 376 ERR("RegisterClass failed, winErr(%d)\n", winErr); 377 hr = E_FAIL; 378 } 379 } 380 381 if (hr == S_OK) 382 { 383 HWND hWnd = CreateWindowEx (WS_EX_TOOLWINDOW, 384 VBOXEXTWND_NAME, VBOXEXTWND_NAME, 385 WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DISABLED, 386 0, 0, 387 w, h, 388 NULL, //GetDesktopWindow() /* hWndParent */, 389 NULL /* hMenu */, 390 hInstance, 391 NULL /* lpParam */); 392 Assert(hWnd); 393 if (hWnd) 394 { 395 *phWnd = hWnd; 396 } 397 else 398 { 399 DWORD winErr = GetLastError(); 400 ERR("CreateWindowEx failed, winErr(%d)\n", winErr); 401 hr = E_FAIL; 402 } 403 } 404 405 return hr; 406 } 407 408 static HRESULT vboxExtWndDoDestroy(HWND hWnd) 409 { 410 BOOL bResult = DestroyWindow(hWnd); 411 DWORD winErr; 412 Assert(bResult); 413 if (bResult) 414 return S_OK; 415 416 winErr = GetLastError(); 417 ERR("DestroyWindow failed, winErr(%d) for hWnd(0x%x)\n", winErr, hWnd); 418 419 return E_FAIL; 420 } 421 422 typedef struct VBOXEXTWND_CREATE_INFO 423 { 424 int hr; 425 HWND hWnd; 426 DWORD width; 427 DWORD height; 428 } VBOXEXTWND_CREATE_INFO; 429 430 typedef struct VBOXEXTWND_DESTROY_INFO 431 { 432 int hr; 433 HWND hWnd; 434 } VBOXEXTWND_DESTROY_INFO; 435 436 DECLCALLBACK(void) vboxExtWndDestroyWorker(void *pvUser) 437 { 438 VBOXEXTWND_DESTROY_INFO *pInfo = (VBOXEXTWND_DESTROY_INFO*)pvUser; 439 pInfo->hr = vboxExtWndDoDestroy(pInfo->hWnd); 440 Assert(pInfo->hr == S_OK); 441 } 442 443 DECLCALLBACK(void) vboxExtWndCreateWorker(void *pvUser) 444 { 445 VBOXEXTWND_CREATE_INFO *pInfo = (VBOXEXTWND_CREATE_INFO*)pvUser; 446 pInfo->hr = vboxExtWndDoCreate(pInfo->width, pInfo->height, &pInfo->hWnd); 447 Assert(pInfo->hr == S_OK); 448 } 449 450 HRESULT VBoxExtWndDestroy(HWND hWnd) 451 { 452 HRESULT hr; 453 VBOXEXTWND_DESTROY_INFO Info; 454 Info.hr = E_FAIL; 455 Info.hWnd = hWnd; 456 hr = VBoxExtDwSubmitProc(vboxExtWndDestroyWorker, &Info); 457 Assert(hr == S_OK); 458 if (hr == S_OK) 459 { 460 Assert(Info.hr == S_OK); 461 return Info.hr; 462 } 463 return hr; 464 } 465 466 HRESULT VBoxExtWndCreate(DWORD width, DWORD height, HWND *phWnd) 467 { 468 HRESULT hr; 469 VBOXEXTWND_CREATE_INFO Info; 470 Info.hr = E_FAIL; 471 Info.width = width; 472 Info.height = height; 473 hr = VBoxExtDwSubmitProc(vboxExtWndCreateWorker, &Info); 474 Assert(hr == S_OK); 475 if (hr == S_OK) 476 { 477 Assert(Info.hr == S_OK); 478 if (Info.hr == S_OK) 479 *phWnd = Info.hWnd; 480 return Info.hr; 481 } 482 return hr; 483 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h
r38114 r38331 30 30 int VBoxExtReleaseDC(HWND hWnd, HDC hDC); 31 31 32 /* API for creating & destroying windows */ 33 HRESULT VBoxExtWndDestroy(HWND hWnd); 34 HRESULT VBoxExtWndCreate(DWORD width, DWORD height, HWND *phWnd); 35 32 36 #endif /* #ifndef ___VBOXEXT_H__*/ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r38112 r38331 1138 1138 HDC restore_dc; 1139 1139 HGLRC glCtx; 1140 #ifndef VBOX_WITH_WDDM 1140 1141 HWND win_handle; 1141 1142 HDC hdc; 1143 #endif 1142 1144 int pixel_format; 1143 1145 GLint aux_buffers;
Note:
See TracChangeset
for help on using the changeset viewer.