d3d10: Implement D3D10CreateDeviceAndSwapChain().

This commit is contained in:
Henri Verbeet 2008-10-23 16:37:09 +02:00 committed by Alexandre Julliard
parent c7e1c0907c
commit 5d6b7e4c45
4 changed files with 55 additions and 2 deletions

View File

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

View File

@ -2,7 +2,7 @@
@ stub D3D10CompileShader
@ stub D3D10CreateBlob
@ stdcall D3D10CreateDevice(ptr long ptr long long ptr)
@ stub D3D10CreateDeviceAndSwapChain
@ stdcall D3D10CreateDeviceAndSwapChain(ptr long ptr long long ptr ptr ptr)
@ stub D3D10CreateEffectFromMemory
@ stub D3D10CreateEffectPoolFromMemory
@ stub D3D10CreateStateBlock

View File

@ -64,3 +64,52 @@ HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver
return S_OK;
}
HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type,
HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc,
IDXGISwapChain **swapchain, ID3D10Device **device)
{
IDXGIFactory *factory;
HRESULT hr;
TRACE("adapter %p, driver_type %s, swrast %p, flags %#x, sdk_version %d,\n"
"\tswapchain_desc %p, swapchain %p, device %p\n",
adapter, debug_d3d10_driver_type(driver_type), swrast, flags, sdk_version,
swapchain_desc, swapchain, device);
hr = D3D10CreateDevice(adapter, driver_type, swrast, flags, sdk_version, device);
if (FAILED(hr))
{
WARN("Failed to create a device, returning %#x\n", hr);
return hr;
}
TRACE("Created ID3D10Device %p\n", *device);
hr = CreateDXGIFactory(&IID_IDXGIFactory, (void **)&factory);
if (FAILED(hr))
{
ID3D10Device_Release(*device);
*device = NULL;
WARN("Failed to create a DXGI factory, returning %#x\n", hr);
return hr;
}
TRACE("Created IDXGIFactory %p\n", factory);
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)*device, swapchain_desc, swapchain);
IDXGIFactory_Release(factory);
if (FAILED(hr))
{
ID3D10Device_Release(*device);
*device = NULL;
WARN("Failed to create a swapchain, returning %#x\n", hr);
return hr;
}
TRACE("Created IDXGISwapChain %p\n", *swapchain);
return S_OK;
}

View File

@ -35,6 +35,10 @@ typedef enum D3D10_DRIVER_TYPE {
HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type,
HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device);
HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type,
HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc,
IDXGISwapChain **swapchain, ID3D10Device **device);
#ifdef __cplusplus
}
#endif