diff --git a/src/gallium/frontends/wgl/stw_context.c b/src/gallium/frontends/wgl/stw_context.c index 14fab3d9cec..f0f543c243b 100644 --- a/src/gallium/frontends/wgl/stw_context.c +++ b/src/gallium/frontends/wgl/stw_context.c @@ -546,8 +546,9 @@ get_unlocked_refd_framebuffer_from_dc(HDC hDC) * those here. */ int iPixelFormat = stw_pixelformat_guess(hDC); + HWND hWnd = WindowFromDC(hDC); if (iPixelFormat) - fb = stw_framebuffer_create(hDC, WindowFromDC(hDC), stw_pixelformat_get_info(iPixelFormat), STW_FRAMEBUFFER_WGL_WINDOW, stw_dev->fscreen); + fb = stw_framebuffer_create(hWnd ? NULL : hDC, hWnd, stw_pixelformat_get_info(iPixelFormat), STW_FRAMEBUFFER_WGL_WINDOW, stw_dev->fscreen); if (!fb) return NULL; } diff --git a/src/gallium/frontends/wgl/stw_framebuffer.c b/src/gallium/frontends/wgl/stw_framebuffer.c index 797fe7d2988..79f4705f344 100644 --- a/src/gallium/frontends/wgl/stw_framebuffer.c +++ b/src/gallium/frontends/wgl/stw_framebuffer.c @@ -475,7 +475,7 @@ stw_framebuffer_from_hdc_locked(HDC hdc) hwnd = WindowFromDC(hdc); - return stw_framebuffer_from_hwnd_hdc_locked(hwnd, hdc); + return stw_framebuffer_from_hwnd_hdc_locked(hwnd, hwnd ? NULL : hdc); }