- Timestamp:
- Oct 1, 2018 11:56:56 AM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r73736 r74549 94 94 #define D3D_TO_OGL_Y_COORD(ptrSurface, y_coordinate) (ptrSurface->pMipmapLevels[0].mipmapSize.height - (y_coordinate)) 95 95 #define D3D_TO_OGL_Y_COORD_MIPLEVEL(ptrMipLevel, y_coordinate) (ptrMipLevel->size.height - (y_coordinate)) 96 97 /* Enable to render the result of DrawPrimitive in a seperate window. */98 //#define DEBUG_GFX_WINDOW99 100 96 101 97 /** … … 1075 1071 } 1076 1072 1077 #ifdef DEBUG_DEBUG_GFX_WINDOW_TEST_CONTEXT1078 pState->idTestContext = SVGA_ID_INVALID;1079 #endif1080 1073 return VINF_SUCCESS; 1081 1074 } … … 2858 2851 2859 2852 Log(("vmsvga3dContextDefine id %x\n", cid)); 2860 #ifdef DEBUG_DEBUG_GFX_WINDOW_TEST_CONTEXT2861 if (pState->idTestContext == SVGA_ID_INVALID)2862 {2863 pState->idTestContext = 207;2864 rc = vmsvga3dContextDefine(pThis, pState->idTestContext);2865 AssertRCReturn(rc, rc);2866 }2867 #endif2868 2853 2869 2854 if (cid == VMSVGA3D_SHARED_CTX_ID) … … 2935 2920 * system memory in the guest VRAM. 2936 2921 */ 2937 CREATESTRUCT cs; 2938 cs.lpCreateParams = NULL; 2939 cs.dwExStyle = WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY; 2940 # ifdef DEBUG_GFX_WINDOW 2941 cs.lpszName = (char *)RTMemAllocZ(256); 2942 RTStrPrintf((char *)cs.lpszName, 256, "Context %d OpenGL Window", cid); 2943 # else 2944 cs.lpszName = NULL; 2945 # endif 2946 cs.lpszClass = 0; 2947 # ifdef DEBUG_GFX_WINDOW 2948 cs.style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_CAPTION; 2949 # else 2950 cs.style = WS_DISABLED | WS_CHILD; 2951 # endif 2952 cs.x = 0; 2953 cs.y = 0; 2954 cs.cx = 4; 2955 cs.cy = 4; 2956 cs.hwndParent = (HWND)pThis->svga.u64HostWindowId; 2957 cs.hMenu = NULL; 2958 cs.hInstance = pState->hInstance; 2959 2960 rc = vmsvga3dSendThreadMessage(pState->pWindowThread, pState->WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)&pContext->hwnd, (LPARAM)&cs); 2922 rc = vmsvga3dContextWindowCreate(pState->hInstance, pState->pWindowThread, pState->WndRequestSem, &pContext->hwnd); 2961 2923 AssertRCReturn(rc, rc); 2962 2924 … … 3241 3203 { 3242 3204 #ifdef RT_OS_WINDOWS 3243 /* Resize the window. */ 3244 CREATESTRUCT cs; 3245 RT_ZERO(cs); 3246 cs.cx = pThis->svga.uWidth; 3247 cs.cy = pThis->svga.uHeight; 3248 int rc = vmsvga3dSendThreadMessage(pState->pWindowThread, pState->WndRequestSem, WM_VMSVGA3D_RESIZEWINDOW, (WPARAM)pContext->hwnd, (LPARAM)&cs); 3249 AssertRC(rc); 3205 RT_NOREF3(pThis, pState, pContext); 3206 /* Do nothing. The window is not used for presenting. */ 3250 3207 3251 3208 #elif defined(RT_OS_DARWIN) … … 6209 6166 #endif 6210 6167 6211 #ifdef DEBUG_GFX_WINDOW6212 if (pContext->state.aRenderTargets[SVGA3D_RT_COLOR0])6213 {6214 SVGA3dCopyRect rect;6215 6216 rect.srcx = rect.srcy = rect.x = rect.y = 0;6217 rect.w = pContext->state.RectViewPort.w;6218 rect.h = pContext->state.RectViewPort.h;6219 vmsvga3dCommandPresent(pThis, pContext->state.aRenderTargets[SVGA3D_RT_COLOR0], 0, NULL);6220 }6221 #endif6222 6223 6168 #if 0 6224 6169 /* Dump render target to a bitmap. */ -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
r73194 r74549 111 111 { 112 112 MSG msg; 113 114 113 if (GetMessage(&msg, 0, 0, 0)) 115 114 { … … 125 124 continue; 126 125 } 126 127 127 if (msg.message == WM_VMSVGA3D_CREATEWINDOW) 128 128 { … … 130 130 LPCREATESTRUCT pCS = (LPCREATESTRUCT) msg.lParam; 131 131 132 #ifdef DEBUG_GFX_WINDOW133 RECT rectClient;134 135 rectClient.left = 0;136 rectClient.top = 0;137 rectClient.right = pCS->cx;138 rectClient.bottom = pCS->cy;139 AdjustWindowRectEx(&rectClient, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_CAPTION, FALSE, WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY | WS_EX_TRANSPARENT);140 pCS->cx = rectClient.right - rectClient.left;141 pCS->cy = rectClient.bottom - rectClient.top;142 #endif143 132 *pHwnd = CreateWindowEx(pCS->dwExStyle, 144 133 VMSVGA3D_WNDCLASSNAME, 145 134 pCS->lpszName, 146 135 pCS->style, 147 #ifdef DEBUG_GFX_WINDOW148 0,149 0,150 #else151 136 pCS->x, 152 137 pCS->y, 153 #endif154 138 pCS->cx, 155 139 pCS->cy, 156 #ifdef DEBUG_GFX_WINDOW157 0,158 #else159 140 pCS->hwndParent, 160 #endif161 141 pCS->hMenu, 162 142 pCS->hInstance, … … 169 149 continue; 170 150 } 151 171 152 if (msg.message == WM_VMSVGA3D_DESTROYWINDOW) 172 153 { 173 154 BOOL fRc = DestroyWindow((HWND)msg.wParam); 174 Assert(fRc); NOREF(fRc);175 /* Signal to the caller that we're done. */176 RTSemEventSignal(WndRequestSem);177 continue;178 }179 if (msg.message == WM_VMSVGA3D_RESIZEWINDOW)180 {181 HWND hwnd = (HWND)msg.wParam;182 LPCREATESTRUCT pCS = (LPCREATESTRUCT) msg.lParam;183 184 #ifdef DEBUG_GFX_WINDOW185 RECT rectClient;186 187 rectClient.left = 0;188 rectClient.top = 0;189 rectClient.right = pCS->cx;190 rectClient.bottom = pCS->cy;191 AdjustWindowRectEx(&rectClient, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_CAPTION, FALSE, WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY | WS_EX_TRANSPARENT);192 pCS->cx = rectClient.right - rectClient.left;193 pCS->cy = rectClient.bottom - rectClient.top;194 #endif195 BOOL fRc = SetWindowPos(hwnd, 0, pCS->x, pCS->y, pCS->cx, pCS->cy, SWP_NOZORDER | SWP_NOMOVE);196 155 Assert(fRc); NOREF(fRc); 197 156 … … 269 228 } 270 229 return DefWindowProc(hwnd, uMsg, wParam, lParam); 230 } 231 232 int vmsvga3dContextWindowCreate(HINSTANCE hInstance, RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, HWND *pHwnd) 233 { 234 /* Create a context window with minimal 4x4 size. We will never use the swapchain 235 * to present the rendered image. Rendered images from the guest will be copied to 236 * the VMSVGA SCREEN object, which can be either an offscreen render target or 237 * system memory in the guest VRAM. 238 */ 239 CREATESTRUCT cs; 240 cs.lpCreateParams = NULL; 241 cs.hInstance = hInstance; 242 cs.hMenu = NULL; 243 cs.hwndParent = HWND_DESKTOP; 244 cs.cx = 4; 245 cs.cy = 4; 246 cs.x = 0; 247 cs.y = 0; 248 cs.style = WS_DISABLED; 249 cs.lpszName = NULL; 250 cs.lpszClass = 0; 251 cs.dwExStyle = WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY; 252 253 int rc = vmsvga3dSendThreadMessage(pWindowThread, WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)pHwnd, (LPARAM)&cs); 254 return rc; 271 255 } 272 256 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r73736 r74549 55 55 * Defined Constants And Macros * 56 56 *********************************************************************************************************************************/ 57 /* Enable to render the result of DrawPrimitive in a seperate window. */58 //#define DEBUG_GFX_WINDOW59 57 60 58 #define FOURCC_INTZ (D3DFORMAT)MAKEFOURCC('I', 'N', 'T', 'Z') … … 2516 2514 * system memory in the guest VRAM. 2517 2515 */ 2518 CREATESTRUCT cs; 2519 2520 AssertReturn(pThis->svga.u64HostWindowId, VERR_INTERNAL_ERROR); 2521 2522 cs.lpCreateParams = NULL; 2523 cs.dwExStyle = WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY; 2524 #ifdef DEBUG_GFX_WINDOW 2525 cs.lpszName = (char *)RTMemAllocZ(256); 2526 RTStrPrintf((char *)cs.lpszName, 256, "Context %d OpenGL Window", cid); 2527 #else 2528 cs.lpszName = NULL; 2529 #endif 2530 cs.lpszClass = NULL; 2531 #ifdef DEBUG_GFX_WINDOW 2532 cs.style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_CAPTION; 2533 #else 2534 cs.style = WS_DISABLED | WS_CHILD; 2535 #endif 2536 cs.x = 0; 2537 cs.y = 0; 2538 cs.cx = 4; 2539 cs.cy = 4; 2540 cs.hwndParent = (HWND)pThis->svga.u64HostWindowId; 2541 cs.hMenu = NULL; 2542 cs.hInstance = pState->hInstance; 2543 2544 rc = vmsvga3dSendThreadMessage(pState->pWindowThread, pState->WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)&pContext->hwnd, (LPARAM)&cs); 2516 rc = vmsvga3dContextWindowCreate(pState->hInstance, pState->pWindowThread, pState->WndRequestSem, &pContext->hwnd); 2545 2517 AssertRCReturn(rc, rc); 2546 2518 … … 2555 2527 PresParam.SwapEffect = D3DSWAPEFFECT_DISCARD; 2556 2528 PresParam.hDeviceWindow = pContext->hwnd; 2557 PresParam.Windowed = TRUE; /** @todo */2529 PresParam.Windowed = TRUE; 2558 2530 PresParam.EnableAutoDepthStencil = FALSE; 2559 2531 PresParam.AutoDepthStencilFormat = D3DFMT_UNKNOWN; /* not relevant */ … … 2764 2736 if (cid != SVGA3D_INVALID_ID) 2765 2737 { 2766 CREATESTRUCT cs;2767 2738 D3DPRESENT_PARAMETERS PresParam; 2768 2739 D3DVIEWPORT9 viewportOrg; … … 2887 2858 D3D_RELEASE(pContext->d3dState.pVertexDecl); 2888 2859 2889 memset(&cs, 0, sizeof(cs));2890 cs.cx = pThis->svga.uWidth;2891 cs.cy = pThis->svga.uHeight;2892 2893 Log(("vmsvga3dChangeMode: Resize window %x of context %d to (%d,%d)\n", pContext->hwnd, pContext->id, cs.cx, cs.cy));2894 2895 2860 AssertReturn(pContext->pDevice, VERR_INTERNAL_ERROR); 2896 2861 hr = pContext->pDevice->GetViewport(&viewportOrg); … … 2898 2863 2899 2864 Log(("vmsvga3dChangeMode: old viewport settings (%d,%d)(%d,%d) z=%d/%d\n", viewportOrg.X, viewportOrg.Y, viewportOrg.Width, viewportOrg.Height, (uint32_t)(viewportOrg.MinZ * 100.0), (uint32_t)(viewportOrg.MaxZ * 100.0))); 2900 2901 /* Resize the window. */2902 int rc = vmsvga3dSendThreadMessage(pState->pWindowThread, pState->WndRequestSem, WM_VMSVGA3D_RESIZEWINDOW, (WPARAM)pContext->hwnd, (LPARAM)&cs);2903 AssertRC(rc);2904 2865 2905 2866 /* Changed when the function returns. */ … … 2911 2872 PresParam.MultiSampleType = D3DMULTISAMPLE_NONE; 2912 2873 PresParam.MultiSampleQuality = 0; 2913 PresParam.SwapEffect = D3DSWAPEFFECT_ FLIP;2874 PresParam.SwapEffect = D3DSWAPEFFECT_DISCARD; 2914 2875 PresParam.hDeviceWindow = pContext->hwnd; 2915 PresParam.Windowed = TRUE; /** @todo */2876 PresParam.Windowed = TRUE; 2916 2877 PresParam.EnableAutoDepthStencil = FALSE; 2917 2878 PresParam.AutoDepthStencilFormat = D3DFMT_UNKNOWN; /* not relevant */ … … 2956 2917 target.face = 0; 2957 2918 target.mipmap = 0; 2958 rc = vmsvga3dSetRenderTarget(pThis, cid, (SVGA3dRenderTargetType)j, target);2919 int rc = vmsvga3dSetRenderTarget(pThis, cid, (SVGA3dRenderTargetType)j, target); 2959 2920 AssertRCReturn(rc, rc); 2960 2921 } … … 5244 5205 vmsvga3dContextTrackUsage(pThis, pContext); 5245 5206 5246 #ifdef DEBUG_GFX_WINDOW5247 if (pContext->aSidActiveTexture[0] == 0x62)5248 //// if (pContext->sidActiveTexture == 0x3d)5249 {5250 SVGA3dCopyRect rect;5251 5252 rect.srcx = rect.srcy = rect.x = rect.y = 0;5253 rect.w = 800;5254 rect.h = 600;5255 vmsvga3dCommandPresent(pThis, pContext->state.aRenderTargets[SVGA3D_RT_COLOR0] /*pContext->aSidActiveTexture[0] */, 0, &rect);5256 }5257 #endif5258 5207 return rc; 5259 5208 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r73194 r74549 113 113 # define WM_VMSVGA3D_CREATEWINDOW (WM_APP+2) 114 114 # define WM_VMSVGA3D_DESTROYWINDOW (WM_APP+3) 115 # define WM_VMSVGA3D_RESIZEWINDOW (WM_APP+4)116 115 # define WM_VMSVGA3D_EXIT (WM_APP+5) 117 116 118 117 DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD ThreadSelf, void *pvUser); 119 118 int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam); 119 int vmsvga3dContextWindowCreate(HINSTANCE hInstance, RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, HWND *pHwnd); 120 120 121 121 #endif
Note:
See TracChangeset
for help on using the changeset viewer.