VBoxD3DIf.cpp revision 20bc7269cdb015fe47a9a4a0511470f3b26660f8
/* $Id$ */
/** @file
* VBoxVideo Display D3D User mode dll
*/
/*
* Copyright (C) 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;
* 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 "VBoxDispD3DCmn.h"
/* DDI2D3D */
{
/* @todo: check they are all equal */
}
{
/* @todo: check they are all equal */
return (D3DMULTISAMPLE_TYPE)enmType;
}
{
/* @todo: check they are all equal */
switch (enmPool)
{
case D3DDDIPOOL_SYSTEMMEM:
return D3DPOOL_SYSTEMMEM;
case D3DDDIPOOL_VIDEOMEMORY:
case D3DDDIPOOL_LOCALVIDMEM:
/* @todo: what would be proper here? */
return D3DPOOL_DEFAULT;
default:
Assert(0);
}
return D3DPOOL_DEFAULT;
}
{
/* @todo: @fixme: not entirely correct, need to check */
return (D3DRENDERSTATETYPE)enmType;
}
{
static const VBOXWDDMDISP_TSS_LOOKUP lookup[] =
{
};
}
{
if (fFlags.AutogenMipmap)
fUsage |= D3DUSAGE_DMAP;
if (fFlags.RenderTarget)
//below are wddm 1.1-specific
// if (fFlags.RestrictedContent)
// fUsage |= D3DUSAGE_RESTRICTED_CONTENT;
// if (fFlags.RestrictSharedAccess)
// fUsage |= D3DUSAGE_RESTRICT_SHARED_RESOURCE;
return fUsage;
}
{
if (fLockFlags.Discard)
if (fLockFlags.NoOverwrite)
if (fLockFlags.ReadOnly)
if (fLockFlags.DoNotWait)
return fFlags;
}
{
{
/* no flags other than [Begin|Continue|End]PresentToDwm are set */
return D3DTEXF_POINT;
}
{
/* no flags other than [Begin|Continue|End]PresentToDwm are set */
return D3DTEXF_LINEAR;
}
/* no flags other than [Begin|Continue|End]PresentToDwm are set */
return D3DTEXF_NONE;
}
{
return (D3DQUERYTYPE)enmType;
}
{
fFlags |= D3DISSUE_BEGIN;
fFlags |= D3DISSUE_END;
return fFlags;
}
/**/
/* D3DIf API */
{
{
return S_OK;
}
{
{
return hr;
}
}
return S_OK;
}
void VBoxD3DIfLockUnlockMemSynch(PVBOXWDDMDISP_ALLOCATION pAlloc, D3DLOCKED_RECT *pLockInfo, RECT *pRect, bool bToLockInfo)
{
if (!pRect)
{
{
if (bToLockInfo)
else
}
else
{
if (bToLockInfo)
{
}
else
{
}
{
}
}
}
else
{
uint32_t offAllocMemStart = vboxWddmCalcOffXYrd(pRect->left, pRect->top, pAlloc->SurfDesc.pitch, pAlloc->SurfDesc.format);
if (bToLockInfo)
{
}
else
{
}
{
uint32_t cbSize = vboxWddmCalcSize(pAlloc->SurfDesc.pitch, pRect->bottom - pRect->top, pAlloc->SurfDesc.format);
}
else
{
{
}
}
}
}
{
{
{
break;
}
{
break;
}
{
break;
}
{
break;
}
{
break;
}
default:
break;
}
return hr;
}
{
{
{
break;
}
{
break;
}
{
break;
}
{
break;
}
{
break;
}
default:
break;
}
return hr;
}
{
{
{
TRUE /* @todo: BOOL Discard */,
NULL /*HANDLE* pSharedHandle*/);
{
}
else
{
for (UINT j = 0; j < i; ++j)
{
}
break;
}
}
{
{
}
}
}
{
{
NULL /*HANDLE* pSharedHandle*/);
{
}
else
{
for (UINT j = 0; j < i; ++j)
{
}
break;
}
}
{
{
}
}
}
{
{
NULL /*HANDLE* pSharedHandle*/
);
{
}
else
{
for (UINT j = 0; j < i; ++j)
{
}
break;
}
}
{
{
}
}
}
{
void **pavClientMem = NULL;
{
if (pavClientMem)
{
{
}
}
else
}
#ifdef DEBUG
{
{
tstW /= 2;
tstH /= 2;
}
}
#endif
{
{
{
WARN(("unexpected cubemap texture config: (%d ; %d), allocs: %d",
hr = E_INVALIDARG;
}
else
{
hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
}
}
{
hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateVolumeTexture((IDirect3DDevice9Ex *)pDevice9If,
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
}
else
{
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
}
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
{
if (i > 0)
}
}
}
if (pavClientMem)
}
{
{
switch (pAllocation->enmType)
{
{
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
#else
#endif
);
break;
}
{
{
break;
}
PVBOXWDDMDISP_SWAPCHAIN pSwapchain = vboxWddmSwapchainFindCreate(pDevice, pAllocation, &bNeedPresent);
if (!pSwapchain)
{
WARN(("vboxWddmSwapchainFindCreate failed"));
hr = E_OUTOFMEMORY;
break;
}
{
break;
}
break;
}
default:
{
break;
}
}
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
continue;
/* fail branch */
}
for (UINT j = 0; j < i; ++j)
{
}
break;
}
{
{
Assert(0);
}
}
}
else
{
}
return hr;
}
VOID VBoxD3DIfFillPresentParams(D3DPRESENT_PARAMETERS *pParams, PVBOXWDDMDISP_RESOURCE pRc, UINT cRTs)
{
#if 0 //def VBOXDISP_WITH_WINE_BB_WORKAROUND /* this does not work so far any way :( */
if (cRTs == 1)
else
#endif
}
{
HRESULT hr = pAdapter->D3D.pD3D9If->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, fFlags, &Params.Base, &pDevice9If);
{
return hr;
}
return S_OK;
}