/* $Id$ */
/** @file
*
* VBox extension to Wine D3D
*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "config.h"
#include "wined3d_private.h"
#include "vboxext.h"
#ifdef VBOX_WITH_WDDM
#include <VBox/VBoxCrHgsmi.h>
#endif
/*******************************/
#ifdef VBOX_WITH_WDDM
# if defined(VBOX_WDDM_WOW64)
# else
# endif
#else
/* both 32bit and 64bit versions of xpdm wine libs are named identically */
#endif
typedef struct VBOXEXT_WORKER
{
/* wine does not seem to guarantie the dll is not unloaded in case FreeLibrary is used
* while d3d object is not terminated, keep an extra reference to ensure we're not unloaded
* while we are active */
/*******************************/
typedef struct VBOXEXT_GLOBAL
{
typedef struct VBOXEXT_CALLPROC
{
void *pvCb;
{
NULL /* HWND hWnd */,
WM_USER /* UINT wMsgFilterMin */,
WM_USER /* UINT wMsgFilterMax */,
do
{
0 /*HWND hWnd*/,
0 /*UINT wMsgFilterMin*/,
0 /*UINT wMsgFilterMax*/
);
if(!bResult) /* WM_QUIT was posted */
break;
break;
{
case WM_VBOXEXT_CALLPROC:
{
break;
}
case WM_VBOXEXT_INIT_QUIT:
case WM_CLOSE:
{
PostQuitMessage(0);
break;
}
default:
}
} while (1);
return 0;
}
{
{
return E_FAIL;
}
FALSE, /* BOOL bManualReset */
FALSE, /* BOOL bInitialState */
NULL /* LPCTSTR lpName */
);
{
NULL /* LPSECURITY_ATTRIBUTES lpThreadAttributes */,
0 /* SIZE_T dwStackSize */,
0 /* DWORD dwCreationFlags */,
{
if (WAIT_OBJECT_0 == dwResult)
return S_OK;
}
else
{
}
}
else
{
}
return E_FAIL;
}
{
if (!bResult)
{
return E_FAIL;
}
if (dwErr != WAIT_OBJECT_0)
{
return E_FAIL;
}
return S_OK;
}
{
/* need to serialize since vboxExtWorkerThread is using one pWorker->hEvent
* to signal job completion */
if (bResult)
{
if (fSync)
{
if (dwErr == WAIT_OBJECT_0)
{
}
else
{
}
}
else
}
else
{
return E_FAIL;
}
return hr;
}
{
}
{
}
{
PVBOXEXT_CALLPROC pCallInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (VBOXEXT_CALLPROC) * 2);
if (!pCallInfo)
{
ERR("HeapAlloc failed\n");
return E_OUTOFMEMORY;
}
{
return hr;
}
return S_OK;
}
{
#ifdef VBOX_WITH_WDDM
if (!RT_SUCCESS(rc))
{
return E_FAIL;
}
#endif
return S_OK;
/* failure branch */
#ifdef VBOX_WITH_WDDM
#endif
return hr;
}
static HRESULT vboxExtWndCleanup();
{
{
return hr;
}
{
return hr;
}
#ifdef VBOX_WITH_WDDM
#endif
return S_OK;
}
/* wine serializes all calls to us, so no need for any synchronization here */
{
return ++g_cVBoxExtInits;
}
{
return cVBoxExtInits;
}
{
return g_cVBoxExtInits;
}
{
if (!vboxExtGetRef())
{
hr = vboxExtInit();
{
return hr;
}
}
return S_OK;
}
{
if (vboxExtGetRef() == 1)
{
hr = vboxExtTerm();
{
return hr;
}
}
return S_OK;
}
{
}
{
}
#if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
# ifndef VBOX_WITH_WDDM
typedef struct VBOXEXT_GETDC_CB
{
{
}
typedef struct VBOXEXT_RELEASEDC_CB
{
int ret;
{
}
{
{
return NULL;
}
}
{
{
return -1;
}
}
# endif /* #ifndef VBOX_WITH_WDDM */
{
}
{
{
return;
}
}
#endif /* #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) */
/* window creation API */
)
{
switch(uMsg)
{
case WM_CLOSE:
return 0;
case WM_DESTROY:
return 0;
case WM_NCHITTEST:
return HTNOWHERE;
}
}
{
{
{
}
}
return hr;
}
{
/* Register the Window Class. */
{
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (!RegisterClass(&wc))
{
}
}
{
0, 0,
w, h,
NULL, //GetDesktopWindow() /* hWndParent */,
NULL /* hMenu */,
NULL /* lpParam */);
if (hWnd)
{
/* make sure we keep inited until the window is active */
}
else
{
}
}
return hr;
}
{
if (bResult)
{
/* release the reference we previously acquired on window creation */
return S_OK;
}
winErr = GetLastError();
return E_FAIL;
}
typedef struct VBOXEXTWND_CREATE_INFO
{
int hr;
typedef struct VBOXEXTWND_DESTROY_INFO
{
int hr;
typedef struct VBOXEXTWND_CLEANUP_INFO
{
int hr;
{
}
{
}
{
}
{
{
return hr;
}
{
}
return S_OK;
}
{
{
return hr;
}
{
}
return S_OK;
}
{
{
return hr;
}
{
}
return S_OK;
}
/* hash map impl */
{
uint32_t i;
{
}
}
void VBoxExtHashInit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_HASH pfnHash, PFNVBOXEXT_HASHMAP_EQUAL pfnEqual)
{
}
{
return u32Hash % VBOXEXT_HASHMAP_NUM_BUCKETS;
}
{ \
_op \
} \
} while (0)
{
continue;
continue;
return pEntry;
);
return NULL;
}
{
}
static void vboxExtHashPutEntry(PVBOXEXT_HASHMAP pMap, PVBOXEXT_HASHMAP_BUCKET pBucket, PVBOXEXT_HASHMAP_ENTRY pEntry)
{
}
{
if (!pEntry)
return NULL;
return pEntry;
}
PVBOXEXT_HASHMAP_ENTRY VBoxExtHashPut(PVBOXEXT_HASHMAP pMap, void *pvKey, PVBOXEXT_HASHMAP_ENTRY pEntry)
{
return pOldEntry;
}
{
}
void VBoxExtHashVisit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor)
{
if (!cEntries)
return;
for (; ; ++iBucket)
{
return;
return;
);
}
/* should not be here! */
AssertFailed();
}
void VBoxExtHashCleanup(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor)
{
}
static DECLCALLBACK(bool) vboxExtCacheCleanupCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor)
{
return TRUE;
}
{
}
#if defined(VBOXWINEDBG_SHADERS) || defined(VBOX_WINE_WITH_PROFILE)
{
}
#endif