/*
* IDirect3D9 implementation
*
* Copyright 2002 Jason Edmeades
* Copyright 2005 Oliver Stieber
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include "d3d9_private.h"
/* IDirect3D9 IUnknown parts follow: */
static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9EX iface, REFIID riid, LPVOID* ppobj)
{
return S_OK;
return S_OK;
} else {
WARN("Application asks for IDirect3D9Ex, but this instance wasn't created with Direct3DCreate9Ex\n");
WARN("Returning E_NOINTERFACE\n");
ERR_D3D();
return E_NOINTERFACE;
}
}
ERR_D3D();
return E_NOINTERFACE;
}
return ref;
}
if (ref == 0) {
}
return ref;
}
/* IDirect3D9 Interface follow: */
static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9EX iface, void* pInitializeFunction) {
return hr;
}
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n",
memcpy(&pIdentifier->DeviceIdentifier, &adapter_id.device_identifier, sizeof(pIdentifier->DeviceIdentifier));
return hr;
}
static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format) {
/* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out */
ERR_D3D();
return 0;
}
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
TRACE("iface %p, adapter %u, format %#x, mode_idx %u, mode %p.\n",
/* We can't pass this to WineD3D, otherwise it'll think it came from D3D8 or DDraw.
It's supposed to fail anyway, so no harm returning failure. */
{
ERR_D3D();
return D3DERR_INVALIDCALL;
}
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
return hr;
}
{
TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n",
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType,
{
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
/* This format is nothing special and it is supported perfectly.
* However, ati and nvidia driver on windows do not mark this format as
* supported (tested with the dxCapsViewer) and pretending to
* support this format uncovers a bug in Battlefield 1942 (fonts are missing)
* So do the same as Windows drivers and pretend not to support it on dx8 and 9
*/
if(CheckFormat == D3DFMT_R8G8B8)
{
WARN("D3DFMT_R8G8B8 is not available on windows, returning D3DERR_NOTAVAILABLE\n");
ERR_D3D();
return D3DERR_NOTAVAILABLE;
}
switch(RType) {
case D3DRTYPE_VERTEXBUFFER:
case D3DRTYPE_INDEXBUFFER:
break;
default:
break;
}
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat),
return hr;
}
{
TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n",
return hr;
}
D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat)
{
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n",
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
TRACE("iface %p, adapter %u, device_type %#x, src_format %#x, dst_format %#x.\n",
return hr;
}
{
pCaps->RasterCaps &=
pCaps->TextureCaps &=
}
#ifndef VBOX_WINE_WITHOUT_LIBWINE
#endif
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
return D3DERR_INVALIDCALL;
}
return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
}
/* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */
/* fixup caps */
#ifdef VBOX_WITH_WDDM
/* needed for Windows Media Player to work properly */
/*| D3DDEVCAPS_HWVERTEXBUFFER | D3DDEVCAPS_HWINDEXBUFFER | D3DDEVCAPS_SUBVOLUMELOCK */;
pCaps->RasterCaps |= D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_STIPPLE | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_COLORPERSPECTIVE /* keep */;
#endif
/* workaround for wine not returning InstructionSlots correctly for shaders v3.0 */
{
}
#if defined(DEBUG)
{
}
{
}
else
{
ERR_D3D();
}
#endif
return hrc;
}
return ret;
}
static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9Impl_CreateDevice(IDirect3D9Ex *iface, UINT adapter,
{
TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, device %p.\n",
if (!object)
{
ERR("Failed to allocate device memory.\n");
ERR_D3D();
return E_OUTOFMEMORY;
}
#ifdef VBOX_WITH_WDDM
#endif
{
ERR_D3D();
return hr;
}
return D3D_OK;
}
{
ERR_D3D();
return D3DERR_DRIVERINTERNALERROR;
}
{
FIXME("iface %p, adapter %u, filter %p, mode_idx %u, mode %p stub!\n",
ERR_D3D();
return D3DERR_DRIVERINTERNALERROR;
}
{
hr = IWineD3D_GetAdapterDisplayModeEx(This->WineD3D, Adapter, (WINED3DDISPLAYMODEEX *) pMode, (WINED3DDISPLAYROTATION *) pRotation);
{
}
/*
if (mode)
{
D3DDISPLAYMODE* d3dmode;
if (mode->Size != sizeof(D3DDISPLAYMODEEX))
{
WARN("Invalid mode->Size %u expected %u", mode->Size, sizeof(D3DDISPLAYMODEEX));
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) &d3dmode);
wined3d_mutex_unlock();
if (SUCCEEDED(hr))
{
mode->Width = d3dmode.Width;
mode->Height = d3dmode.Height;
mode->RefreshRate = d3dmode.RefreshRate;
mode->Format = d3dformat_from_wined3dformat(d3dmode.Format);
mode->ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE; //D3DSCANLINEORDERING_INTERLACED
}
}
else
{
hr = WINED3D_OK;
}
if (rotation)
{
*rotation = D3DDISPLAYROTATION_IDENTITY;
}
*/
return hr;
}
{
FIXME("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x,\n"
"parameters %p, mode %p, device %p stub!\n",
ERR_D3D();
return D3DERR_DRIVERINTERNALERROR;
}
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUID *luid)
{
adapter_id.driver_size = 0;
return hr;
}
{
/* IUnknown */
/* IDirect3D9 */
/* IDirect3D9Ex */
};