Changeset 84849 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 16, 2020 2:23:39 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
r82968 r84849 45 45 46 46 #ifdef RT_OS_WINDOWS 47 # define VMSVGA3D_WNDCLASSNAME "VMSVGA3DWNDCLS"47 # define VMSVGA3D_WNDCLASSNAME L"VMSVGA3DWNDCLS" 48 48 49 49 static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); … … 85 85 RT_NOREF(hThreadSelf); 86 86 RTSEMEVENT WndRequestSem = (RTSEMEVENT)pvUser; 87 WNDCLASSEX 87 WNDCLASSEXW wc; 88 88 89 89 /* Register our own window class. */ 90 90 wc.cbSize = sizeof(wc); 91 91 wc.style = CS_OWNDC; 92 wc.lpfnWndProc = (WNDPROC) 92 wc.lpfnWndProc = (WNDPROC)vmsvga3dWndProc; 93 93 wc.cbClsExtra = 0; 94 94 wc.cbWndExtra = 0; … … 101 101 wc.hIconSm = NULL; 102 102 103 if (!RegisterClassEx (&wc))103 if (!RegisterClassExW(&wc)) 104 104 { 105 105 Log(("RegisterClass failed with %x\n", GetLastError())); … … 127 127 if (msg.message == WM_VMSVGA3D_CREATEWINDOW) 128 128 { 129 HWND *pHwnd = (HWND *)msg.wParam; 130 LPCREATESTRUCT pCS = (LPCREATESTRUCT) msg.lParam; 131 132 *pHwnd = CreateWindowEx(pCS->dwExStyle, 133 VMSVGA3D_WNDCLASSNAME, 134 pCS->lpszName, 135 pCS->style, 136 pCS->x, 137 pCS->y, 138 pCS->cx, 139 pCS->cy, 140 pCS->hwndParent, 141 pCS->hMenu, 142 pCS->hInstance, 143 NULL); 144 AssertMsg(*pHwnd, ("CreateWindowEx %x %s %s %x (%d,%d)(%d,%d), %x %x %x error=%x\n", pCS->dwExStyle, pCS->lpszName, VMSVGA3D_WNDCLASSNAME, pCS->style, pCS->x, 145 pCS->y, pCS->cx, pCS->cy,pCS->hwndParent, pCS->hMenu, pCS->hInstance, GetLastError())); 129 HWND hWnd; 130 HWND *phWnd = (HWND *)msg.wParam; 131 LPCREATESTRUCTW pCS = (LPCREATESTRUCTW)msg.lParam; 132 133 *phWnd = hWnd = CreateWindowExW(pCS->dwExStyle, 134 VMSVGA3D_WNDCLASSNAME, 135 pCS->lpszName, 136 pCS->style, 137 pCS->x, 138 pCS->y, 139 pCS->cx, 140 pCS->cy, 141 pCS->hwndParent, 142 pCS->hMenu, 143 pCS->hInstance, 144 NULL); 145 AssertMsg(hWnd, ("CreateWindowEx %x %ls %ls %x (%d,%d)(%d,%d), %x %x %x error=%x\n", pCS->dwExStyle, 146 pCS->lpszName, VMSVGA3D_WNDCLASSNAME, pCS->style, pCS->x, pCS->y, pCS->cx, pCS->cy, 147 pCS->hwndParent, pCS->hMenu, pCS->hInstance, GetLastError())); 148 149 #ifdef VBOX_STRICT 150 /* Must have a non-zero client rectangle! */ 151 RECT ClientRect; 152 GetClientRect(hWnd, &ClientRect); 153 Assert(ClientRect.right > ClientRect.left); 154 Assert(ClientRect.bottom > ClientRect.top); 155 #endif 146 156 147 157 /* Signal to the caller that we're done. */ … … 159 169 continue; 160 170 } 171 172 #if 0 /* in case CreateDeviceEx fails again and we want to eliminat wrong-thread. */ 173 if (msg.message == WM_VMSVGA3D_CREATE_DEVICE) 174 { 175 VMSVGA3DCREATEDEVICEPARAMS *pParams = (VMSVGA3DCREATEDEVICEPARAMS *)msg.lParam; 176 pParams->hrc = pParams->pState->pD3D9->CreateDeviceEx(D3DADAPTER_DEFAULT, 177 D3DDEVTYPE_HAL, 178 pParams->pContext->hwnd, 179 D3DCREATE_MULTITHREADED | D3DCREATE_MIXED_VERTEXPROCESSING, //D3DCREATE_HARDWARE_VERTEXPROCESSING, 180 pParams->pPresParams, 181 NULL, 182 &pParams->pContext->pDevice); 183 AssertMsg(pParams->hrc == D3D_OK, ("WM_VMSVGA3D_CREATE_DEVICE: CreateDevice failed with %x\n", pParams->hrc)); 184 185 RTSemEventSignal(WndRequestSem); 186 continue; 187 } 188 #endif 161 189 162 190 TranslateMessage(&msg); … … 179 207 switch (uMsg) 180 208 { 209 case WM_CREATE: 210 { 211 /* Ditch the title bar (caption) to avoid having a zero height 212 client area as that makes IDirect3D9Ex::CreateDeviceEx fail. 213 For the style adjustment to take place, we must apply the 214 SWP_FRAMECHANGED thru SetWindowPos. */ 215 LONG flStyle = GetWindowLongW(hwnd, GWL_STYLE); 216 flStyle &= ~WS_CAPTION /* both titlebar and border. Some paranoia: */ | WS_THICKFRAME | WS_SYSMENU; 217 SetWindowLong(hwnd, GWL_STYLE, flStyle); 218 SetWindowPos(hwnd, NULL, 0, 0, 0, 0, 219 SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER); 220 break; 221 } 222 181 223 case WM_CLOSE: 182 224 Log7(("vmsvga3dWndProc(%p): WM_CLOSE\n", hwnd)); … … 237 279 * system memory in the guest VRAM. 238 280 */ 239 CREATESTRUCT cs;281 CREATESTRUCTW cs; 240 282 cs.lpCreateParams = NULL; 241 283 cs.hInstance = hInstance; … … 251 293 cs.dwExStyle = WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY; 252 294 253 int rc = vmsvga3dSendThreadMessage(pWindowThread, WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)pHwnd, (LPARAM)&cs); 254 return rc; 295 return vmsvga3dSendThreadMessage(pWindowThread, WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)pHwnd, (LPARAM)&cs); 255 296 } 256 297 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r84841 r84849 2564 2564 PVMSVGA3DCONTEXT pContext; 2565 2565 HRESULT hr; 2566 D3DPRESENT_PARAMETERS PresParam;2567 2566 PVMSVGA3DSTATE pState = pThisCC->svga.p3dState; 2568 2567 … … 2611 2610 2612 2611 /* Changed when the function returns. */ 2612 D3DPRESENT_PARAMETERS PresParam; 2613 2613 PresParam.BackBufferWidth = 0; 2614 2614 PresParam.BackBufferHeight = 0; … … 2628 2628 PresParam.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; 2629 2629 2630 #ifdef VBOX_VMSVGA3D_WITH_WINE_OPENGL 2630 #if 0 2631 VMSVGA3DCREATEDEVICEPARAMS Params = { pState, pContext, &PresParam, 0 }; 2632 rc = vmsvga3dSendThreadMessage(pState->pWindowThread, pState->WndRequestSem, WM_VMSVGA3D_CREATE_DEVICE, 0, (LPARAM)&Params); 2633 AssertRCReturn(rc, rc); 2634 hr = Params.hrc; 2635 2636 #elif defined(VBOX_VMSVGA3D_WITH_WINE_OPENGL) 2631 2637 hr = pState->pD3D9->CreateDevice(D3DADAPTER_DEFAULT, 2632 2638 D3DDEVTYPE_HAL, … … 2636 2642 &pContext->pDevice); 2637 2643 #else 2644 /** @todo Docs indicates that we should be using 2645 * D3DCREATE_HARDWARE_VERTEXPROCESSING with W10 1607 and higher. 2646 * https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dcreate */ 2638 2647 hr = pState->pD3D9->CreateDeviceEx(D3DADAPTER_DEFAULT, 2639 2648 D3DDEVTYPE_HAL, -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r84742 r84849 118 118 # define WM_VMSVGA3D_DESTROYWINDOW (WM_APP+3) 119 119 # define WM_VMSVGA3D_EXIT (WM_APP+5) 120 # if 0 121 # define WM_VMSVGA3D_CREATE_DEVICE (WM_APP+6) 122 typedef struct VMSVGA3DCREATEDEVICEPARAMS 123 { 124 struct VMSVGA3DSTATE *pState; 125 struct VMSVGA3DCONTEXT *pContext; 126 struct _D3DPRESENT_PARAMETERS_ *pPresParams; 127 HRESULT hrc; 128 } VMSVGA3DCREATEDEVICEPARAMS; 129 # endif 120 130 121 131 DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD ThreadSelf, void *pvUser);
Note:
See TracChangeset
for help on using the changeset viewer.