diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
|---|---|---|
| committer | <> | 2014-05-08 15:03:54 +0000 |
| commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
| tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/WINNT/Graphics/Wine | |
| parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
| download | VirtualBox-master.tar.gz | |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/WINNT/Graphics/Wine')
24 files changed, 408 insertions, 58 deletions
diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk b/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk index 5adf8d1e..80a5c9c9 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk +++ b/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk @@ -224,6 +224,9 @@ ifdef VBOX_WITH_WDDM VBOX_WINE_WITH_SINGLE_CONTEXT \ IN_VBOXLIBWINE \ VBOX_WINE_WITH_SHADER_CACHE +ifdef VBOX_WINE_WITH_PROFILE + wined3dwddm_DEFS += VBOX_WINE_WITH_PROFILE +endif wined3dwddm_INCS = $(wined3d_INCS) \ $(PATH_ROOT)/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm wined3dwddm_SOURCES = $(subst wined3d.def,wined3dwddm.def,$(wined3d_SOURCES)) \ diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def b/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def index d4292ebe..dc72dbfb 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def +++ b/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def @@ -12,6 +12,8 @@ EXPORTS Direct3DCreate9 Direct3DCreate9Ex VBoxWineExD3DDev9Flush + VBoxWineExD3DDev9FlushToHost + VBoxWineExD3DDev9Finish VBoxWineExD3DDev9CreateTexture VBoxWineExD3DDev9CreateCubeTexture VBoxWineExD3DDev9CreateVolumeTexture diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c b/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c index 32e55aad..a1ebc4ec 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c @@ -790,6 +790,34 @@ VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Flush(IDirect3DDevice9Ex *iface) return hr; } +VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9FlushToHost(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + HRESULT hr; + + TRACE("iface %p, FlushToHost\n", iface); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_FlushToHost(This->WineD3DDevice); + wined3d_mutex_unlock(); + + return hr; +} + +VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Finish(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + HRESULT hr; + + TRACE("iface %p, Finish\n", iface); + + wined3d_mutex_lock(); + hr = IWineD3DDevice_Finish(This->WineD3DDevice); + wined3d_mutex_unlock(); + + return hr; +} + //#pragma comment(linker, "/export:VBoxWineExD3DDev9CreateTexture=_VBoxWineExD3DDev9CreateTexture@40") VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9CreateTexture(IDirect3DDevice9Ex *iface, diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d8_main.c b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d8_main.c index cff6129d..3b0ae8bf 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d8_main.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d8_main.c @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d9_main.c b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d9_main.c index f3df1756..5f188859 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d9_main.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/d3d9_main.c @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/sw_common.c b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/sw_common.c index b078dce7..5b4da767 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/sw_common.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/sw_common.c @@ -1,11 +1,10 @@ /* $Id: sw_common.c $ */ - /** @file * VBox D3D8/9 dll switcher */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -22,6 +21,24 @@ static char* gsBlackListExe[] = {"Dwm.exe", "java.exe", "javaw.exe", "javaws.exe"/*, "taskeng.exe"*/, NULL}; static char* gsBlackListDll[] = {"awt.dll", "wpfgfx_v0400.dll", "wpfgfx_v0300.dll", NULL}; +/** + * Loads a system DLL. + * + * @returns Module handle or NULL + * @param pszName The DLL name. + */ +static HMODULE loadSystemDll(const char *pszName) +{ + char szPath[MAX_PATH]; + UINT cchPath = GetSystemDirectoryA(szPath, sizeof(szPath)); + size_t cbName = strlen(pszName) + 1; + if (cchPath + 1 + cbName > sizeof(szPath)) + return NULL; + szPath[cchPath] = '\\'; + memcpy(&szPath[cchPath + 1], pszName, cbName); + return LoadLibraryA(szPath); +} + /* Checks if 3D is enabled for VM and it works on host machine */ BOOL isVBox3DEnabled(void) { @@ -30,9 +47,9 @@ BOOL isVBox3DEnabled(void) BOOL result = FALSE; #ifdef VBOX_WDDM_WOW64 - hDLL = LoadLibrary("VBoxOGL-x86.dll"); + hDLL = loadSystemDll("VBoxOGL-x86.dll"); #else - hDLL = LoadLibrary("VBoxOGL.dll"); + hDLL = loadSystemDll("VBoxOGL.dll"); #endif /* note: this isn't really needed as our library will refuse to load if it can't connect to host. @@ -65,8 +82,8 @@ BOOL checkOptionsExe(void) char *filename = name, *pName; int i; - if (!GetModuleFileName(NULL, name, 1000)) - return TRUE; + if (!GetModuleFileName(NULL, name, 1000)) + return TRUE; /*Extract filename*/ for (pName=name; *pName; ++pName) @@ -107,13 +124,11 @@ void InitD3DExports(const char *vboxName, const char *msName) HANDLE hDLL; if (isVBox3DEnabled() && checkOptions()) - { dllName = vboxName; - } else - { + else dllName = msName; - } - hDLL = LoadLibrary(dllName); + hDLL = loadSystemDll(dllName); FillD3DExports(hDLL); } + diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/switcher.h b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/switcher.h index 45e18efc..bdb01dc8 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/switcher/switcher.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/switcher/switcher.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.c b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.c index 467b2ec1..9fb564c0 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.c @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2011 Oracle Corporation + * Copyright (C) 2011-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.h b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.h index 2e98cbd3..247e94e9 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxDbgGl.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2011 Oracle Corporation + * Copyright (C) 2011-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h index 011caa8b..c2283b5e 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h @@ -2,7 +2,7 @@ * * VBox extension to Wine D3D * - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -68,6 +68,12 @@ typedef FNVBOXWINEEXD3DDEV9_VOLTEXBLT *PFNVBOXWINEEXD3DDEV9_VOLTEXBLT; typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_FLUSH(IDirect3DDevice9Ex *iface); typedef FNVBOXWINEEXD3DDEV9_FLUSH *PFNVBOXWINEEXD3DDEV9_FLUSH; +typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_FLUSHTOHOST(IDirect3DDevice9Ex *iface); +typedef FNVBOXWINEEXD3DDEV9_FLUSHTOHOST *PFNVBOXWINEEXD3DDEV9_FLUSHTOHOST; + +typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_FINISH(IDirect3DDevice9Ex *iface); +typedef FNVBOXWINEEXD3DDEV9_FINISH *PFNVBOXWINEEXD3DDEV9_FINISH; + typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_UPDATE(IDirect3DDevice9Ex *iface, D3DPRESENT_PARAMETERS * pParams, IDirect3DDevice9Ex **outIface); typedef FNVBOXWINEEXD3DDEV9_UPDATE *PFNVBOXWINEEXD3DDEV9_UPDATE; @@ -113,6 +119,10 @@ VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9VolTexBlt(IDirect3DDevice9Ex *iface, VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Flush(IDirect3DDevice9Ex *iface); /* perform glFlush */ +VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Finish(IDirect3DDevice9Ex *iface); /* perform glFinish */ + +VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9FlushToHost(IDirect3DDevice9Ex *iface); /* flash data to host */ + VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Update(IDirect3DDevice9Ex *iface, D3DPRESENT_PARAMETERS * pParams, IDirect3DDevice9Ex **outIface); /* update device parameters */ diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/debug.h b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/debug.h index b52e82ce..e9d7c7ba 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/debug.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/debug.h @@ -358,16 +358,18 @@ static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( #endif -#ifdef DEBUG_misha -//# define VBOXWINEDBG_SHADERS +#if 0//def DEBUG_misha +# define VBOXWINEDBG_SHADERS #endif -#ifdef VBOXWINEDBG_SHADERS +#if defined(VBOXWINEDBG_SHADERS) || defined(VBOX_WINE_WITH_PROFILE) #include <stdio.h> #include <stdarg.h> void vboxWDbgPrintF(char * szString, ...); +#endif +#ifdef VBOXWINEDBG_SHADERS # define WDLOG(_m) do {\ vboxWDbgPrintF _m ; \ } while (0) diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h index 41ee98bb..5dbf7a46 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h @@ -8251,6 +8251,12 @@ typedef struct IWineD3DDeviceVtbl { const WINED3DBOX *pSrcBoxArg, const struct VBOXPOINT3D *pDstPoin3D ); + + HRESULT (STDMETHODCALLTYPE *FlushToHost)( + IWineD3DDevice *iface); + + HRESULT (STDMETHODCALLTYPE *Finish)( + IWineD3DDevice* This); #endif END_INTERFACE @@ -8426,6 +8432,8 @@ interface IWineD3DDevice { #define IWineD3DDevice_Flush(This) (This)->lpVtbl->Flush(This) #define IWineD3DDevice_VolBlt(This, pSourceVolume, pDestinationVolume, pSrcBoxArg, pDstPoin3D) (This)->lpVtbl->VolBlt(This, pSourceVolume, pDestinationVolume, pSrcBoxArg, pDstPoin3D) #define IWineD3DDevice_VolTexBlt(This, pSourceTexture, pDestinationTexture, pSrcBoxArg, pDstPoin3D) (This)->lpVtbl->VolTexBlt(This, pSourceTexture, pDestinationTexture, pSrcBoxArg, pDstPoin3D) +#define IWineD3DDevice_FlushToHost(This) (This)->lpVtbl->FlushToHost(This) +#define IWineD3DDevice_Finish(This) (This)->lpVtbl->Finish(This) #endif #endif diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/buffer.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/buffer.c index 3f2eb51b..9094774d 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/buffer.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/buffer.c @@ -1503,6 +1503,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, { TRACE("Not creating a vbo because GL_ARB_vertex_buffer is not supported\n"); } +#ifndef VBOX_WITH_WDDM else if(buffer->resource.pool == WINED3DPOOL_SYSTEMMEM) { TRACE("Not creating a vbo because the vertex buffer is in system memory\n"); @@ -1511,6 +1512,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, { TRACE("Not creating a vbo because the buffer has dynamic usage and no GL support\n"); } +#endif else { buffer->flags |= WINED3D_BUFFER_CREATEBO; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c index 0334ee50..d12af8bd 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c @@ -1603,7 +1603,7 @@ static void WINAPI IWineD3DDeviceImpl_ReleaseFocusWindow(IWineD3DDevice *iface) #ifndef VBOX_WITH_WDDM IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - if (device->focus_window) wined3d_unregister_window(device->focus_window); + if (device->focus_window) wined3d_unregister_window(device->focus_window, device); device->focus_window = NULL; #else ERR("should not be here"); @@ -1870,6 +1870,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, if(!This->d3d_initialized) return WINED3DERR_INVALIDCALL; +#ifdef VBOX_WINE_WITH_PROFILE + VBOXWINEPROFILE_DRAWPRIM_TERM(&This->DrawPrimProfile); +#endif + /* I don't think that the interface guarantees that the device is destroyed from the same thread * it was created. Thus make sure a context is active for the glDelete* calls */ @@ -5527,7 +5531,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, * needed, use BltFast instead to copy in sysmem and use regular surface * loading. */ d3dfmt_get_conv(dst_impl, FALSE, TRUE, &dummy_desc, &convert); - if (convert != NO_CONVERSION) + if (convert != NO_CONVERSION || dummy_desc.convert) return IWineD3DSurface_BltFast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0); context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD); @@ -7269,6 +7273,52 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Flush(IWineD3DDevice *iface) return WINED3D_OK; } +static HRESULT WINAPI IWineD3DDeviceImpl_Finish(IWineD3DDevice *iface) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; + struct wined3d_context *context; + int i; + + /* first call swapchain flush to ensure all swapchain-pending data gets flushed */ + for (i = 0; i < This->NumberOfSwapChains; ++i) + { + IWineD3DSwapChain *pSwapchain = This->swapchains[i]; + IWineD3DSwapChain_Flush(pSwapchain); + } + + for (i = 0; i < This->numContexts; ++i) + { + context = This->contexts[i]; + if (context_acquire_context(context, NULL, CTXUSAGE_RESOURCELOAD, TRUE)) + { + Assert(context->valid); + wglFinish(); + context_release(context); + } + else + { + WARN("Invalid context, skipping flush.\n"); + } + } + return WINED3D_OK; +} + +static HRESULT WINAPI IWineD3DDeviceImpl_FlushToHost(IWineD3DDevice *iface) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; + struct wined3d_context *context; + int i; + + /* no context acquisition is needed */ + for (i = 0; i < This->numContexts; ++i) + { + context = This->contexts[i]; + pVBoxFlushToHost(context->glCtx); + } + return WINED3D_OK; +} + + /* context activation is done by the caller */ void device_cleanup_durtify_texture_target(IWineD3DDeviceImpl *This, GLuint texture_target) { @@ -7473,6 +7523,8 @@ static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_Flush, IWineD3DDeviceImpl_VolBlt, IWineD3DDeviceImpl_VolTexBlt, + IWineD3DDeviceImpl_FlushToHost, + IWineD3DDeviceImpl_Finish, #endif }; @@ -7519,6 +7571,10 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, device->createParms.hFocusWindow = focus_window; device->createParms.BehaviorFlags = flags; +#ifdef VBOX_WINE_WITH_PROFILE + VBOXWINEPROFILE_DRAWPRIM_INIT(&device->DrawPrimProfile); +#endif + device->devType = device_type; for (i = 0; i < PATCHMAP_SIZE; ++i) list_init(&device->patches[i]); @@ -7610,7 +7666,7 @@ LRESULT device_process_message(IWineD3DDeviceImpl *device, HWND window, if (message == WM_DESTROY) { TRACE("unregister window %p.\n", window); - wined3d_unregister_window(window); + wined3d_unregister_window(window, NULL); if (device->focus_window == window) device->focus_window = NULL; else ERR("Window %p is not the focus window for device %p.\n", window, device); diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c index ebd596c0..4f73c2fe 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c @@ -5307,6 +5307,24 @@ static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info) } } +/** + * Loads a system DLL. + * + * @returns Module handle or NULL + * @param pszName The DLL name. + */ +static HMODULE loadSystemDll(const char *pszName) +{ + char szPath[MAX_PATH]; + UINT cchPath = GetSystemDirectoryA(szPath, sizeof(szPath)); + size_t cbName = strlen(pszName) + 1; + if (cchPath + 1 + cbName > sizeof(szPath)) + return NULL; + szPath[cchPath] = '\\'; + memcpy(&szPath[cchPath + 1], pszName, cbName); + return LoadLibraryA(szPath); +} + static BOOL InitAdapters(IWineD3DImpl *This) { static HMODULE mod_gl; @@ -5322,22 +5340,22 @@ static BOOL InitAdapters(IWineD3DImpl *This) if(!mod_gl) { #ifdef USE_WIN32_OPENGL -#define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn); -#if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) +# define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn); +# if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) BOOL (APIENTRY *pDrvValidateVersion)(DWORD) DECLSPEC_HIDDEN; -#ifdef VBOX_WDDM_WOW64 - mod_gl = LoadLibraryA("VBoxOGL-x86.dll"); -#else - mod_gl = LoadLibraryA("VBoxOGL.dll"); -#endif -#else - mod_gl = LoadLibraryA("opengl32.dll"); -#endif +# ifdef VBOX_WDDM_WOW64 + mod_gl = loadSystemDll("VBoxOGL-x86.dll"); +# else + mod_gl = loadSystemDll("VBoxOGL.dll"); +# endif +# else + mod_gl = loadSystemDll("opengl32.dll"); +# endif if(!mod_gl) { ERR("Can't load opengl32.dll!\n"); goto nogl_adapter; } -#if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) +# if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) /* init properly */ pDrvValidateVersion = (void*)GetProcAddress(mod_gl, "DrvValidateVersion"); if(!pDrvValidateVersion) { @@ -5348,9 +5366,9 @@ static BOOL InitAdapters(IWineD3DImpl *This) ERR("DrvValidateVersion FAILED\n"); goto nogl_adapter; } -#endif +# endif #else -#define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn); +# define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn); /* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 (glXGetProcAddress wrapper) instead of opengl32's */ mod_gl = GetModuleHandleA("gdi32.dll"); #endif diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c index d9cbdd7a..923017c0 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c @@ -3971,6 +3971,9 @@ static void generate_texcoord_assignment(struct wined3d_shader_buffer *buffer, I unsigned int i; char reg_mask[6]; + if (!ps) + return; + for (i = 0, map = ps->baseShader.reg_maps.texcoord; map && i < min(8, MAX_REG_TEXCRD); map >>= 1, ++i) { if (!map & 1) @@ -5334,7 +5337,7 @@ const shader_backend_t glsl_shader_backend = { shader_glsl_color_fixup_supported, }; -#ifdef VBOXWINEDBG_SHADERS +#if defined(VBOXWINEDBG_SHADERS) || defined(VBOX_WINE_WITH_PROFILE) void vboxWDbgPrintF(char * szString, ...) { char szBuffer[4096*2] = {0}; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c index e231b1f5..f18797fc 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c @@ -2864,7 +2864,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO } #endif - if (!(This->Flags & SFLAG_DONOTFREE)) { + if (!(This->Flags & SFLAG_DONOTFREE) && !This->resource.format_desc->convert) { HeapFree(GetProcessHeap(), 0, This->resource.heapMemory); This->resource.allocatedMemory = NULL; This->resource.heapMemory = NULL; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c index 2b3b546b..96e67507 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c @@ -519,16 +519,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO #endif #ifdef VBOX_WITH_WDDM - /* We're directly using wglMakeCurrent calls skipping GDI layer, which causes GDI SwapBuffers to fail trying to - * call glFinish, which doesn't have any context set. So we use wglSwapLayerBuffers directly as well. - */ - pwglSwapLayerBuffers(context->currentSwapchain->hDC, WGL_SWAP_MAIN_PLANE); + SwapBuffers(context->currentSwapchain->hDC); #else -# ifdef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT - pwglSwapLayerBuffers(context->hdc, WGL_SWAP_MAIN_PLANE); -# else SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ -# endif #endif TRACE("SwapBuffers called, Starting new frame\n"); diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c index cb76f8b3..68348e11 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c @@ -3,7 +3,7 @@ * * VBox extension to Wine D3D * - * Copyright (C) 2011 Oracle Corporation + * Copyright (C) 2011-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h index 390f960e..0b3d1635 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h @@ -3,7 +3,7 @@ * * VBox extension to Wine D3D * - * Copyright (C) 2011 Oracle Corporation + * Copyright (C) 2011-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h index 6ea458b7..d028851c 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxsharedrc.h @@ -3,7 +3,7 @@ * * VBox extension to Wine D3D - shared resource * - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h index c9a9b36c..5ed7e0fb 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h @@ -1380,8 +1380,35 @@ PROC (WINAPI *pwglGetProcAddress)(LPCSTR) DECLSPEC_HIDDEN; BOOL (WINAPI *pwglMakeCurrent)(HDC, HGLRC) DECLSPEC_HIDDEN; BOOL (WINAPI *pwglSwapLayerBuffers)(HDC, UINT) DECLSPEC_HIDDEN; BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN; +BOOL (WINAPI *pwglChoosePixelFormat)(HDC, const PIXELFORMATDESCRIPTOR *) DECLSPEC_HIDDEN; +int (WINAPI *pwglDescribePixelFormat)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR) DECLSPEC_HIDDEN; +int (WINAPI *pwglGetPixelFormat)(HDC) DECLSPEC_HIDDEN; +BOOL (WINAPI *pwglSetPixelFormat)(HDC, int, const PIXELFORMATDESCRIPTOR *) DECLSPEC_HIDDEN; HGLRC (WINAPI *pVBoxCreateContext)(HDC, struct VBOXUHGSMI*) DECLSPEC_HIDDEN; +void (WINAPI *pVBoxFlushToHost)(HGLRC) DECLSPEC_HIDDEN; + +#if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) +# define VBOX_WINE_WITH_DIRECT_VBOXOGL +#endif + +#ifdef VBOX_WINE_WITH_DIRECT_VBOXOGL +/* make sure we used stuff from VBoxOGL + * we do it this way to avoid extra modifications to Wine code */ + +/* We're directly using wglMakeCurrent calls skipping GDI layer, which causes GDI SwapBuffers to fail trying to + * call glFinish, which doesn't have any context set. So we use wglSwapLayerBuffers directly as well. + */ +# define SwapBuffers(_hdc) pwglSwapLayerBuffers((_hdc), WGL_SWAP_MAIN_PLANE) + +/* we avoid using GDI32!*PixelFormat API and use VBoxOGL stuff directly + * because SetPixelFormat may eventually lead to opengl32 setting its own window proc via SetWindowLongPtr + * thus wined3d_[un]register_window stuff will become screwed up leading to infinite recursion or other misbehave */ +# define ChoosePixelFormat pwglChoosePixelFormat +# define DescribePixelFormat pwglDescribePixelFormat +# define GetPixelFormat pwglGetPixelFormat +# define SetPixelFormat pwglSetPixelFormat +#endif #define GL_FUNCS_GEN \ USE_GL_FUNC(glAccum) \ @@ -1727,10 +1754,15 @@ HGLRC (WINAPI *pVBoxCreateContext)(HDC, struct VBOXUHGSMI*) DECLSPEC_HIDDEN; USE_WGL_FUNC(wglGetProcAddress) \ USE_WGL_FUNC(wglMakeCurrent) \ USE_WGL_FUNC(wglShareLists) \ - USE_WGL_FUNC(wglSwapLayerBuffers) + USE_WGL_FUNC(wglSwapLayerBuffers) \ + USE_WGL_FUNC(wglChoosePixelFormat) \ + USE_WGL_FUNC(wglDescribePixelFormat) \ + USE_WGL_FUNC(wglGetPixelFormat) \ + USE_WGL_FUNC(wglSetPixelFormat) #define VBOX_FUNCS_GEN \ - USE_WGL_FUNC(VBoxCreateContext) + USE_WGL_FUNC(VBoxCreateContext) \ + USE_WGL_FUNC(VBoxFlushToHost) /* OpenGL extensions. */ typedef enum wined3d_gl_extension @@ -3785,7 +3817,7 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma /*report that the shared resource is no longer used by this context, the parameter value is a texture name*/ #define GL_RCUSAGE_TEXTURE_CLEAR_CR 0x8B2A /*configures host to create windows initially hidden*/ -#define GL_HOST_WND_CREATED_HIDDEN 0x8B2B +#define GL_HOST_WND_CREATED_HIDDEN_CR 0x8B2B typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value); diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_main.c b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_main.c index 8934dbe7..c2f36c11 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_main.c +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_main.c @@ -464,6 +464,15 @@ BOOL wined3d_register_window(HWND window, IWineD3DDeviceImpl *device) wined3d_mutex_lock(); + entry = wined3d_find_wndproc(window); + if (entry) + { + ERR("window is registered already!"); + entry->device = device; + wined3d_mutex_unlock(); + return TRUE; + } + if (wndproc_table.size == wndproc_table.count) { unsigned int new_size = max(1, wndproc_table.size * 2); @@ -487,13 +496,14 @@ BOOL wined3d_register_window(HWND window, IWineD3DDeviceImpl *device) entry->window = window; entry->proc = (WNDPROC)SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)wined3d_wndproc); entry->device = device; + Assert(entry->proc != wined3d_wndproc); wined3d_mutex_unlock(); return TRUE; } -void wined3d_unregister_window(HWND window) +void wined3d_unregister_window(HWND window, struct IWineD3DDeviceImpl *device) { unsigned int i; @@ -503,11 +513,19 @@ void wined3d_unregister_window(HWND window) if (wndproc_table.entries[i].window == window) { struct wined3d_wndproc *entry = &wndproc_table.entries[i]; - struct wined3d_wndproc *last = &wndproc_table.entries[--wndproc_table.count]; - if (GetWindowLongPtrW(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc) - SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc); - if (entry != last) *entry = *last; + if (!device || device == entry->device) + { + struct wined3d_wndproc *last = &wndproc_table.entries[--wndproc_table.count]; + + if (GetWindowLongPtrW(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc) + SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc); + if (entry != last) *entry = *last; + } + else + { + ERR("request to unregister a window of a not-owning device"); + } wined3d_mutex_unlock(); return; diff --git a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h index 7c5a7c64..724f8acd 100644 --- a/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h +++ b/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h @@ -1664,7 +1664,7 @@ typedef struct IWineD3DImpl HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, IUnknown *parent) DECLSPEC_HIDDEN; #ifndef VBOX_WITH_WDDM BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; -void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; +void wined3d_unregister_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; #endif /***************************************************************************** @@ -1675,6 +1675,162 @@ void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; /* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */ #define WINED3DCREATE_MULTITHREADED 0x00000004 +#ifdef VBOX_WINE_WITH_PROFILE + +#include <iprt/time.h> + +#define VBOXWINEPROFILE_GET_TIME_NANO() RTTimeNanoTS() +#define VBOXWINEPROFILE_GET_TIME_MILLI() RTTimeMilliTS() + +# define PRLOG(_m) do {\ + vboxWDbgPrintF _m ; \ + } while (0) + +typedef struct VBOXWINEPROFILE_ELEMENT +{ + uint64_t u64Time; + uint32_t cu32Calls; +} VBOXWINEPROFILE_ELEMENT, *PVBOXWINEPROFILE_ELEMENT; + +typedef struct VBOXWINEPROFILE_HASHMAP_ELEMENT +{ + VBOXEXT_HASHMAP_ENTRY MapEntry; + VBOXWINEPROFILE_ELEMENT Data; +} VBOXWINEPROFILE_HASHMAP_ELEMENT, *PVBOXWINEPROFILE_HASHMAP_ELEMENT; + +#define VBOXWINEPROFILE_HASHMAP_ELEMENT_FROMENTRY(_p) ((PVBOXWINEPROFILE_HASHMAP_ELEMENT)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXWINEPROFILE_HASHMAP_ELEMENT, MapEntry))) + +#define VBOXWINEPROFILE_ELEMENT_DUMP(_p, _pn) do { \ + PRLOG(("%s: t(%u);c(%u)\n", \ + (_pn), \ + (uint32_t)((_p)->u64Time / 1000000), \ + (_p)->cu32Calls \ + )); \ + } while (0) + +#define VBOXWINEPROFILE_ELEMENT_RESET(_p) do { \ + memset(_p, 0, sizeof (*(_p))); \ + } while (0) + +#define VBOXWINEPROFILE_ELEMENT_STEP(_p, _t) do { \ + (_p)->u64Time += (_t); \ + ++(_p)->cu32Calls; \ + } while (0) + +#define VBOXWINEPROFILE_HASHMAP_ELEMENT_CREATE() ( (PVBOXWINEPROFILE_HASHMAP_ELEMENT)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (VBOXWINEPROFILE_HASHMAP_ELEMENT)) ) + +#define VBOXWINEPROFILE_HASHMAP_ELEMENT_TERM(_pe) do { \ + HeapFree(GetProcessHeap(), 0, (_pe)); \ + } while (0) + +DECLINLINE(PVBOXWINEPROFILE_HASHMAP_ELEMENT) vboxWineProfileHashMapElementGet(PVBOXEXT_HASHMAP pMap, void *pvKey) +{ + PVBOXEXT_HASHMAP_ENTRY pEntry = VBoxExtHashGet(pMap, pvKey); + if (pEntry) + { + return VBOXWINEPROFILE_HASHMAP_ELEMENT_FROMENTRY(pEntry); + } + else + { + PVBOXWINEPROFILE_HASHMAP_ELEMENT pElement = VBOXWINEPROFILE_HASHMAP_ELEMENT_CREATE(); + Assert(pElement); + if (pElement) + VBoxExtHashPut(pMap, pvKey, &pElement->MapEntry); + return pElement; + } +} + +#define VBOXWINEPROFILE_HASHMAP_ELEMENT_STEP(_pm, _pk, _t) do { \ + PVBOXWINEPROFILE_HASHMAP_ELEMENT pElement = vboxWineProfileHashMapElementGet(_pm, _pk); \ + VBOXWINEPROFILE_ELEMENT_STEP(&pElement->Data, _t); \ + } while (0) + +static DECLCALLBACK(bool) vboxWineProfileElementResetCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor) +{ + PVBOXWINEPROFILE_HASHMAP_ELEMENT pElement = VBOXWINEPROFILE_HASHMAP_ELEMENT_FROMENTRY(pValue); + VBOXWINEPROFILE_ELEMENT_RESET(&pElement->Data); + return true; +} + +static DECLCALLBACK(bool) vboxWineProfileElementDumpCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor) +{ + PVBOXWINEPROFILE_HASHMAP_ELEMENT pElement = VBOXWINEPROFILE_HASHMAP_ELEMENT_FROMENTRY(pValue); + char *pName = (char*)pvVisitor; + PRLOG(("%s[%d]:", pName, (uint32_t)pvKey)); + VBOXWINEPROFILE_ELEMENT_DUMP(&pElement->Data, ""); + return true; +} + +#define VBOXWINEPROFILE_HASHMAP_RESET(_pm) do { \ + VBoxExtHashVisit((_pm), vboxWineProfileElementResetCb, NULL); \ + } while (0) + +#define VBOXWINEPROFILE_HASHMAP_DUMP(_pm, _pn) do { \ + VBoxExtHashVisit((_pm), vboxWineProfileElementDumpCb, (_pn)); \ + } while (0) + +static DECLCALLBACK(bool) vboxWineProfileElementCleanupCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor) +{ + PVBOXWINEPROFILE_HASHMAP_ELEMENT pElement = VBOXWINEPROFILE_HASHMAP_ELEMENT_FROMENTRY(pValue); + VBOXWINEPROFILE_HASHMAP_ELEMENT_TERM(pElement); + return true; +} + +#define VBOXWINEPROFILE_HASHMAP_TERM(_pm) do { \ + VBoxExtHashCleanup((_pm), vboxWineProfileElementCleanupCb, NULL); \ + VBoxExtHashVisit((_pm), vboxWineProfileElementResetCb, NULL); \ + } while (0) + +typedef struct VBOXWINEPROFILE_DRAWPRIM +{ + uint64_t u64LoadLocationTime; + uint64_t u64CtxAcquireTime; + uint64_t u64PostProcess; + VBOXEXT_HASHMAP MapDrawPrimSlowVs; + VBOXEXT_HASHMAP MapDrawPrimSlow; + VBOXEXT_HASHMAP MapDrawPrimStrided; + VBOXEXT_HASHMAP MapDrawPrimFast; + uint32_t cu32Calls; +} VBOXWINEPROFILE_DRAWPRIM, *PVBOXWINEPROFILE_DRAWPRIM; + +#define VBOXWINEPROFILE_DRAWPRIM_RESET_NEXT(_p) do { \ + (_p)->u64LoadLocationTime = 0; \ + (_p)->u64CtxAcquireTime = 0; \ + (_p)->u64PostProcess = 0; \ + VBOXWINEPROFILE_HASHMAP_RESET(&(_p)->MapDrawPrimSlowVs); \ + VBOXWINEPROFILE_HASHMAP_RESET(&(_p)->MapDrawPrimSlow); \ + VBOXWINEPROFILE_HASHMAP_RESET(&(_p)->MapDrawPrimStrided); \ + VBOXWINEPROFILE_HASHMAP_RESET(&(_p)->MapDrawPrimFast); \ + } while (0) + +static DECLCALLBACK(uint32_t) vboxWineProfileDrawPrimHashMapHash(void *pvKey) +{ + return (uint32_t)pvKey; +} + +static DECLCALLBACK(bool) vboxWineProfileDrawPrimHashMapEqual(void *pvKey1, void *pvKey2) +{ + return ((uint32_t)pvKey1) == ((uint32_t)pvKey2); +} + +#define VBOXWINEPROFILE_DRAWPRIM_INIT(_p) do { \ + memset((_p), 0, sizeof (*(_p))); \ + VBoxExtHashInit(&(_p)->MapDrawPrimSlowVs, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \ + VBoxExtHashInit(&(_p)->MapDrawPrimSlow, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \ + VBoxExtHashInit(&(_p)->MapDrawPrimStrided, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \ + VBoxExtHashInit(&(_p)->MapDrawPrimFast, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \ + } while (0) + +#define VBOXWINEPROFILE_DRAWPRIM_TERM(_p) do { \ + memset((_p), 0, sizeof (*(_p))); \ + VBOXWINEPROFILE_HASHMAP_TERM(&(_p)->MapDrawPrimSlowVs); \ + VBOXWINEPROFILE_HASHMAP_TERM(&(_p)->MapDrawPrimSlow); \ + VBOXWINEPROFILE_HASHMAP_TERM(&(_p)->MapDrawPrimStrided); \ + VBOXWINEPROFILE_HASHMAP_TERM(&(_p)->MapDrawPrimFast); \ + } while (0) +#else +# define PRLOG(_m) do {} while (0) +#endif struct IWineD3DDeviceImpl { /* IUnknown fields */ @@ -1813,6 +1969,10 @@ struct IWineD3DDeviceImpl VBOXEXT_HASHCACHE pshaderCache; #endif +#ifdef VBOX_WINE_WITH_PROFILE + VBOXWINEPROFILE_DRAWPRIM DrawPrimProfile; +#endif + /* High level patch management */ #define PATCHMAP_SIZE 43 #define PATCHMAP_HASHFUNC(x) ((x) % PATCHMAP_SIZE) /* Primitive and simple function */ |
