4 * Copyright 2007 Andras Kovacs
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/port.h"
25 #include "d3d10_private.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3d10
);
29 /* At process attach */
30 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
32 TRACE("fdwReason=%d\n", fdwReason
);
35 case DLL_PROCESS_ATTACH
:
36 DisableThreadLibraryCalls( hInstDLL
);
42 HRESULT WINAPI
D3D10CreateDevice(IDXGIAdapter
*adapter
, D3D10_DRIVER_TYPE driver_type
,
43 HMODULE swrast
, UINT flags
, UINT sdk_version
, ID3D10Device
**device
)
45 struct d3d10_device
*object
;
47 FIXME("adapter %p, driver_type %s, swrast %p, flags %#x, sdk_version %d, device %p partial stub!\n",
48 adapter
, debug_d3d10_driver_type(driver_type
), swrast
, flags
, sdk_version
, device
);
50 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
53 ERR("Failed to allocate D3D device object memory\n");
57 object
->vtbl
= &d3d10_device_vtbl
;
59 *device
= (ID3D10Device
*)object
;
61 TRACE("Created ID3D10Device %p\n", object
);
66 HRESULT WINAPI
D3D10CreateDeviceAndSwapChain(IDXGIAdapter
*adapter
, D3D10_DRIVER_TYPE driver_type
,
67 HMODULE swrast
, UINT flags
, UINT sdk_version
, DXGI_SWAP_CHAIN_DESC
*swapchain_desc
,
68 IDXGISwapChain
**swapchain
, ID3D10Device
**device
)
70 IDXGIFactory
*factory
;
73 TRACE("adapter %p, driver_type %s, swrast %p, flags %#x, sdk_version %d,\n"
74 "\tswapchain_desc %p, swapchain %p, device %p\n",
75 adapter
, debug_d3d10_driver_type(driver_type
), swrast
, flags
, sdk_version
,
76 swapchain_desc
, swapchain
, device
);
78 hr
= D3D10CreateDevice(adapter
, driver_type
, swrast
, flags
, sdk_version
, device
);
81 WARN("Failed to create a device, returning %#x\n", hr
);
85 TRACE("Created ID3D10Device %p\n", *device
);
87 hr
= CreateDXGIFactory(&IID_IDXGIFactory
, (void **)&factory
);
90 ID3D10Device_Release(*device
);
93 WARN("Failed to create a DXGI factory, returning %#x\n", hr
);
97 TRACE("Created IDXGIFactory %p\n", factory
);
99 hr
= IDXGIFactory_CreateSwapChain(factory
, (IUnknown
*)*device
, swapchain_desc
, swapchain
);
100 IDXGIFactory_Release(factory
);
103 ID3D10Device_Release(*device
);
106 WARN("Failed to create a swapchain, returning %#x\n", hr
);
110 TRACE("Created IDXGISwapChain %p\n", *swapchain
);