d3d10: Implement D3D10CreateDevice() on top of D3D10CoreCreateDevice().

This commit is contained in:
Henri Verbeet 2008-11-14 13:57:06 +01:00 committed by Alexandre Julliard
parent 3505b5cf17
commit 81e92fc81c
5 changed files with 102 additions and 3 deletions

View File

@ -199,6 +199,7 @@ IMPORT_LIBS = \
cryptui/libcryptui.$(IMPLIBEXT) \
ctl3d32/libctl3d32.$(IMPLIBEXT) \
d3d10/libd3d10.$(IMPLIBEXT) \
d3d10core/libd3d10core.$(IMPLIBEXT) \
d3d8/libd3d8.$(IMPLIBEXT) \
d3d9/libd3d9.$(IMPLIBEXT) \
d3dim/libd3dim.$(IMPLIBEXT) \
@ -341,6 +342,7 @@ CROSS_IMPLIBS = \
cryptui/libcryptui.a \
ctl3d32/libctl3d32.a \
d3d10/libd3d10.a \
d3d10core/libd3d10core.a \
d3d8/libd3d8.a \
d3d9/libd3d9.a \
d3dim/libd3dim.a \
@ -527,6 +529,9 @@ ctl3d32/libctl3d32.def ctl3d32/libctl3d32.a: ctl3d32/ctl3d32.spec $(WINEBUILD)
d3d10/libd3d10.def d3d10/libd3d10.a: d3d10/d3d10.spec $(WINEBUILD)
@cd d3d10 && $(MAKE) `basename $@`
d3d10core/libd3d10core.def d3d10core/libd3d10core.a: d3d10core/d3d10core.spec $(WINEBUILD)
@cd d3d10core && $(MAKE) `basename $@`
d3d8/libd3d8.def d3d8/libd3d8.a: d3d8/d3d8.spec $(WINEBUILD)
@cd d3d8 && $(MAKE) `basename $@`

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = d3d10.dll
IMPORTLIB = d3d10
IMPORTS = dxguid uuid dxgi kernel32
IMPORTS = dxguid uuid d3d10core dxgi kernel32
C_SRCS = \
d3d10_main.c \

View File

@ -42,10 +42,99 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type,
HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device)
{
FIXME("adapter %p, driver_type %s, swrast %p, flags %#x, sdk_version %d, device %p stub!\n",
IDXGIFactory *factory;
HRESULT hr;
TRACE("adapter %p, driver_type %s, swrast %p, flags %#x, sdk_version %d, device %p\n",
adapter, debug_d3d10_driver_type(driver_type), swrast, flags, sdk_version, device);
return E_NOTIMPL;
if (adapter)
{
IDXGIAdapter_AddRef(adapter);
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
if (FAILED(hr))
{
WARN("Failed to get dxgi factory, returning %#x\n", hr);
return hr;
}
}
else
{
hr = CreateDXGIFactory(&IID_IDXGIFactory, (void **)&factory);
if (FAILED(hr))
{
WARN("Failed to create dxgi factory, returning %#x\n", hr);
return hr;
}
switch(driver_type)
{
case D3D10_DRIVER_TYPE_HARDWARE:
{
hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter);
if (FAILED(hr))
{
WARN("No adapters found, returning %#x\n", hr);
IDXGIFactory_Release(factory);
return hr;
}
break;
}
case D3D10_DRIVER_TYPE_NULL:
FIXME("NULL device not implemented, falling back to refrast\n");
case D3D10_DRIVER_TYPE_REFERENCE:
{
HMODULE refrast = LoadLibraryA("d3d10ref.dll");
if (!refrast)
{
WARN("Failed to load refrast, returning E_FAIL\n");
IDXGIFactory_Release(factory);
return E_FAIL;
}
hr = IDXGIFactory_CreateSoftwareAdapter(factory, refrast, &adapter);
FreeLibrary(refrast);
if (FAILED(hr))
{
WARN("Failed to create a software adapter, returning %#x\n", hr);
IDXGIFactory_Release(factory);
return hr;
}
break;
}
case D3D10_DRIVER_TYPE_SOFTWARE:
{
if (!swrast)
{
WARN("Software device requested, but NULL swrast passed, returning E_FAIL\n");
IDXGIFactory_Release(factory);
return E_FAIL;
}
hr = IDXGIFactory_CreateSoftwareAdapter(factory, swrast, &adapter);
if (FAILED(hr))
{
WARN("Failed to create a software adapter, returning %#x\n", hr);
IDXGIFactory_Release(factory);
return hr;
}
break;
}
}
}
hr = D3D10CoreCreateDevice(factory, adapter, flags, 0, device);
IDXGIAdapter_Release(adapter);
IDXGIFactory_Release(factory);
if (FAILED(hr))
{
WARN("Failed to create a device, returning %#x\n", hr);
return hr;
}
TRACE("Created ID3D10Device %p\n", *device);
return hr;
}
HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type,

View File

@ -31,4 +31,8 @@
/* TRACE helper functions */
const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type);
/* D3D10Core */
HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter,
UINT flags, DWORD unknown0, ID3D10Device **device);
#endif /* __WINE_D3D10_PRIVATE_H */

View File

@ -3,6 +3,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = d3d10core.dll
IMPORTLIB = d3d10core
IMPORTS = dxguid uuid dxgi kernel32
C_SRCS = \