directx.c revision a3133ef29cdf3656735d569fd64e54c9286effc0
/*
* 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
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun 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;
} else {
WARN("Application asks for IDirect3D9Ex, but this instance wasn't created with Direct3DCreate9Ex\n");
WARN("Returning E_NOINTERFACE\n");
return E_NOINTERFACE;
}
}
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) {
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 */
return 0;
}
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
/* 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. */
return D3DERR_INVALIDCALL;
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
return hr;
}
{
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType,
{
/* 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");
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;
}
{
return hr;
}
D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat)
{
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
return hr;
}
{
pCaps->RasterCaps &=
pCaps->TextureCaps &=
}
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 */
return hrc;
}
return ret;
}
/* Swap chain had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
}
static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType,
/* Check the validity range of the adapter parameter */
return D3DERR_INVALIDCALL;
}
/* Allocate the storage for the device object */
FIXME("Allocation of memory failed\n");
return D3DERR_OUTOFVIDEOMEMORY;
}
/* Allocate an associated WineD3DDevice object */
return hr;
}
{
}
}
for (i = 0; i < count; ++i)
{
localParameters[i].BackBufferFormat = wined3dformat_from_d3dformat(pPresentationParameters[i].BackBufferFormat);
localParameters[i].AutoDepthStencilFormat = wined3dformat_from_d3dformat(pPresentationParameters[i].AutoDepthStencilFormat);
localParameters[i].FullScreen_RefreshRateInHz = pPresentationParameters[i].FullScreen_RefreshRateInHz;
}
}
for (i = 0; i < count; ++i)
{
pPresentationParameters[i].BackBufferFormat = d3dformat_from_wined3dformat(localParameters[i].BackBufferFormat);
pPresentationParameters[i].AutoDepthStencilFormat = d3dformat_from_wined3dformat(localParameters[i].AutoDepthStencilFormat);
pPresentationParameters[i].FullScreen_RefreshRateInHz = localParameters[i].FullScreen_RefreshRateInHz;
}
/* Initialize the converted declaration array. This creates a valid pointer and when adding decls HeapReAlloc
* can be used without further checking
*/
return hr;
}
static UINT WINAPI IDirect3D9ExImpl_GetAdapterModeCountEx(IDirect3D9Ex *iface, UINT Adapter, CONST D3DDISPLAYMODEFILTER *pFilter) {
return D3DERR_DRIVERINTERNALERROR;
}
static HRESULT WINAPI IDirect3D9ExImpl_EnumAdapterModesEx(IDirect3D9Ex *iface, UINT Adapter, CONST D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX* pMode) {
return D3DERR_DRIVERINTERNALERROR;
}
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterDisplayModeEx(IDirect3D9Ex *iface, UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) {
return D3DERR_DRIVERINTERNALERROR;
}
static HRESULT WINAPI IDirect3D9ExImpl_CreateDeviceEx(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, struct IDirect3DDevice9Ex **ppReturnedDeviceInterface) {
FIXME("(%p)->(%d, %d, %p, 0x%08x, %p, %p, %p): Stub!\n", This, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface);
return D3DERR_DRIVERINTERNALERROR;
}
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT Adapter, LUID *pLUID) {
return D3DERR_DRIVERINTERNALERROR;
}
const IDirect3D9ExVtbl Direct3D9_Vtbl =
{
/* IUnknown */
/* IDirect3D9 */
/* IDirect3D9Ex */
};