[1/2] opengl32/tests: Add tests for special case of SetPixelFormat

Matijn Woudt tijnema at gmail.com
Tue Nov 23 16:57:41 CST 2010


On Sun, Nov 21, 2010 at 8:23 PM, Roderick Colenbrander
<thunderbird2k at gmail.com> wrote:
> On Sat, Nov 20, 2010 at 3:17 AM, Stefan Dösinger <stefan at codeweavers.com> wrote:
>> Am Donnerstag 18 November 2010, 16:41:53 schrieb Matijn Woudt:
>>> There's only 1 difference, the first one really shows a window with
>>> all the triangle's, like it should. Second one doesn't show anything.
>>> So all the functions don't fail, they just don't seem to do anything.
>> I think we should set up the swapchain to use a dummy window, GL bitmap or WGL
>> pbuffer and turn on render to fbo.
>>
>
> That's what I would suggest as well, but remove GL bitmap from the set
> of options. It means software GDI on windows and on Wine it means
> indirect rendering which can be bad. The pbuffer would be quite
> reliable but it is not around everywhere, if a dummy window works fine
> lets try that first.
>
> Roderick
>

I have created a patch that uses a dummy window. Please let me know if
this is what you had in mind. It works for the game I created the
original patch for.

Matijn
-------------- next part --------------
From 9fa163c4f47355fc3f4940e1c966aa93ba0c64e3 Mon Sep 17 00:00:00 2001
From: Matijn Woudt <tijnema at gmail.com>
Date: Tue, 23 Nov 2010 23:51:06 +0100
Subject: d3d9: Create dummy window if focus window is the desktop window

---
 dlls/d3d9/Makefile.in    |    2 +-
 dlls/d3d9/d3d9_private.h |    2 ++
 dlls/d3d9/device.c       |   12 ++++++++++++
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/dlls/d3d9/Makefile.in b/dlls/d3d9/Makefile.in
index 9d5a4d8..ed949d3 100644
--- a/dlls/d3d9/Makefile.in
+++ b/dlls/d3d9/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = d3d9.dll
 IMPORTLIB = d3d9
-IMPORTS   = dxguid uuid wined3d
+IMPORTS   = dxguid uuid wined3d user32
 
 C_SRCS = \
 	buffer.c \
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 02f9c20..7d8d45e 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -178,6 +178,8 @@ typedef struct IDirect3DDevice9Impl
     unsigned int                 numConvertedDecls, declArraySize;
 
     BOOL                          notreset;
+
+    HWND                          dummy_window;
 } IDirect3DDevice9Impl;
 
 HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type,
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 349bde4..ddf431d 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -275,6 +275,7 @@ static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEV
       IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice);
       IWineD3DDevice_Release(This->WineD3DDevice);
       wined3d_mutex_unlock();
+      if(This->dummy_window) DestroyWindow(This->dummy_window);
 
       HeapFree(GetProcessHeap(), 0, This);
     }
@@ -3255,6 +3256,17 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte
     device->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl;
     device->ref = 1;
 
+    if(focus_window == GetDesktopWindow()) {
+        WNDCLASSA wc = {0};
+        wc.lpfnWndProc = DefWindowProcA;
+        wc.lpszClassName = "wine_d3d9_dummy_window";
+        RegisterClassA(&wc);
+
+        focus_window = CreateWindowA("wine_d3d9_dummy_window", "wine_d3d9_dummy_window", WS_POPUP, 0, 0, 640, 480, 0, 0, 0, 0);
+        parameters->hDeviceWindow = focus_window;
+        device->dummy_window = focus_window;
+    }
+
     if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
 
     wined3d_mutex_lock();
-- 
1.7.0.4


More information about the wine-devel mailing list