d3d11: Move d3d10core to d3d11.

This commit is contained in:
Józef Kucia 2015-08-21 00:07:53 +02:00 committed by Alexandre Julliard
parent 2d13e0f10c
commit a9cb14dd71
18 changed files with 168 additions and 123 deletions

2
configure vendored
View File

@ -17235,7 +17235,7 @@ wine_fn_config_test dlls/d3d10/tests d3d10_test
wine_fn_config_dll d3d10_1 enable_d3d10_1 implib
wine_fn_config_dll d3d10core enable_d3d10core implib
wine_fn_config_test dlls/d3d10core/tests d3d10core_test
wine_fn_config_dll d3d11 enable_d3d11
wine_fn_config_dll d3d11 enable_d3d11 implib
wine_fn_config_dll d3d8 enable_d3d8 implib
wine_fn_config_test dlls/d3d8/tests d3d8_test
wine_fn_config_dll d3d9 enable_d3d9 implib

View File

@ -2836,7 +2836,7 @@ WINE_CONFIG_TEST(dlls/d3d10/tests)
WINE_CONFIG_DLL(d3d10_1,,[implib])
WINE_CONFIG_DLL(d3d10core,,[implib])
WINE_CONFIG_TEST(dlls/d3d10core/tests)
WINE_CONFIG_DLL(d3d11)
WINE_CONFIG_DLL(d3d11,,[implib])
WINE_CONFIG_DLL(d3d8,,[implib])
WINE_CONFIG_TEST(dlls/d3d8/tests)
WINE_CONFIG_DLL(d3d9,,[implib])

View File

@ -1,17 +1,8 @@
MODULE = d3d10core.dll
IMPORTLIB = d3d10core
IMPORTS = dxguid uuid dxgi wined3d
IMPORTS = d3d11
C_SRCS = \
async.c \
buffer.c \
d3d10core_main.c \
device.c \
inputlayout.c \
shader.c \
state.c \
texture.c \
utils.c \
view.c
d3d10core_main.c
RC_SRCS = version.rc

View File

@ -17,102 +17,46 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#define D3D10CORE_INIT_GUID
#include "d3d10core_private.h"
#include "initguid.h"
#define COBJMACROS
#include "d3d10_1.h"
#include "d3d11.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
static HRESULT WINAPI layer_init(enum dxgi_device_layer_id id, DWORD *count, DWORD *values)
{
TRACE("id %#x, count %p, values %p\n", id, count, values);
if (id != DXGI_DEVICE_LAYER_D3D10_DEVICE)
{
WARN("Unknown layer id %#x\n", id);
return E_NOTIMPL;
}
return S_OK;
}
static UINT WINAPI layer_get_size(enum dxgi_device_layer_id id, struct layer_get_size_args *args, DWORD unknown0)
{
TRACE("id %#x, args %p, unknown0 %#x\n", id, args, unknown0);
if (id != DXGI_DEVICE_LAYER_D3D10_DEVICE)
{
WARN("Unknown layer id %#x\n", id);
return 0;
}
return sizeof(struct d3d10_device);
}
static HRESULT WINAPI layer_create(enum dxgi_device_layer_id id, void **layer_base, DWORD unknown0,
void *device_object, REFIID riid, void **device_layer)
{
struct d3d10_device *object;
HRESULT hr;
TRACE("id %#x, layer_base %p, unknown0 %#x, device_object %p, riid %s, device_layer %p\n",
id, layer_base, unknown0, device_object, debugstr_guid(riid), device_layer);
if (id != DXGI_DEVICE_LAYER_D3D10_DEVICE)
{
WARN("Unknown layer id %#x\n", id);
*device_layer = NULL;
return E_NOTIMPL;
}
object = *layer_base;
if (FAILED(hr = d3d10_device_init(object, device_object)))
{
WARN("Failed to initialize device, hr %#x.\n", hr);
*device_layer = NULL;
return hr;
}
*device_layer = &object->IUnknown_inner;
TRACE("Created d3d10 device at %p\n", object);
return S_OK;
}
HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter, UINT flags,
const D3D_FEATURE_LEVEL *feature_levels, UINT levels, ID3D11Device **device);
HRESULT WINAPI D3D10CoreRegisterLayers(void)
{
const struct dxgi_device_layer layers[] =
{
{DXGI_DEVICE_LAYER_D3D10_DEVICE, layer_init, layer_get_size, layer_create},
};
TRACE("\n");
DXGID3D10RegisterLayers(layers, sizeof(layers)/sizeof(*layers));
return S_OK;
return E_NOTIMPL;
}
HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter,
UINT flags, void *unknown0, ID3D10Device **device)
{
IUnknown *dxgi_device;
HMODULE d3d10core;
D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
ID3D11Device *device11;
HRESULT hr;
TRACE("factory %p, adapter %p, flags %#x, unknown0 %p, device %p.\n",
factory, adapter, flags, unknown0, device);
d3d10core = GetModuleHandleA("d3d10core.dll");
hr = DXGID3D10CreateDevice(d3d10core, factory, adapter, flags, unknown0, (void **)&dxgi_device);
if (FAILED(hr = D3D11CoreCreateDevice(factory, adapter, flags, &feature_level, 1, &device11)))
return hr;
hr = ID3D11Device_QueryInterface(device11, &IID_ID3D10Device, (void **)device);
ID3D11Device_Release(device11);
if (FAILED(hr))
{
WARN("Failed to create device, returning %#x\n", hr);
return hr;
ERR("Device should implement ID3D10Device, returning E_FAIL.\n");
return E_FAIL;
}
hr = IUnknown_QueryInterface(dxgi_device, &IID_ID3D10Device, (void **)device);
IUnknown_Release(dxgi_device);
return hr;
return S_OK;
}

View File

@ -1,6 +1,17 @@
MODULE = d3d11.dll
IMPORTLIB = d3d11
IMPORTS = dxguid uuid dxgi wined3d
C_SRCS = \
d3d11_main.c
async.c \
buffer.c \
d3d11_main.c \
device.c \
inputlayout.c \
shader.c \
state.c \
texture.c \
utils.c \
view.c
RC_SRCS = version.rc

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static inline struct d3d10_query *impl_from_ID3D10Query(ID3D10Query *iface)
{

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static inline struct d3d10_buffer *impl_from_ID3D10Buffer(ID3D10Buffer *iface)
{

View File

@ -1,7 +1,7 @@
@ stub D3D11CoreCreateDevice
@ stdcall D3D11CoreCreateDevice(ptr ptr long ptr long ptr)
@ stub D3D11CoreCreateLayeredDevice
@ stub D3D11CoreGetLayeredDeviceSize
@ stub D3D11CoreRegisterLayers
@ stdcall D3D11CoreRegisterLayers()
@ stdcall D3D11CreateDevice(ptr long ptr long ptr long long ptr ptr ptr)
@ stdcall D3D11CreateDeviceAndSwapChain(ptr long ptr long ptr long long ptr ptr ptr ptr ptr)
@ stub D3DKMTCloseAdapter

View File

@ -1,6 +1,7 @@
/*
* Direct3D 11
*
* Copyright 2008 Henri Verbeet for CodeWeavers
* Copyright 2013 Austin English
*
* This library is free software; you can redistribute it and/or
@ -19,12 +20,11 @@
*
*/
#include <stdarg.h>
#include "config.h"
#include "wine/port.h"
#include "windef.h"
#include "winbase.h"
#include "d3d11.h"
#include "wine/debug.h"
#define D3D11_INIT_GUID
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
@ -45,6 +45,105 @@ static const char *debug_d3d_driver_type(D3D_DRIVER_TYPE driver_type)
}
}
static HRESULT WINAPI layer_init(enum dxgi_device_layer_id id, DWORD *count, DWORD *values)
{
TRACE("id %#x, count %p, values %p\n", id, count, values);
if (id != DXGI_DEVICE_LAYER_D3D10_DEVICE)
{
WARN("Unknown layer id %#x\n", id);
return E_NOTIMPL;
}
return S_OK;
}
static UINT WINAPI layer_get_size(enum dxgi_device_layer_id id, struct layer_get_size_args *args, DWORD unknown0)
{
TRACE("id %#x, args %p, unknown0 %#x\n", id, args, unknown0);
if (id != DXGI_DEVICE_LAYER_D3D10_DEVICE)
{
WARN("Unknown layer id %#x\n", id);
return 0;
}
return sizeof(struct d3d10_device);
}
static HRESULT WINAPI layer_create(enum dxgi_device_layer_id id, void **layer_base, DWORD unknown0,
void *device_object, REFIID riid, void **device_layer)
{
struct d3d10_device *object;
HRESULT hr;
TRACE("id %#x, layer_base %p, unknown0 %#x, device_object %p, riid %s, device_layer %p\n",
id, layer_base, unknown0, device_object, debugstr_guid(riid), device_layer);
if (id != DXGI_DEVICE_LAYER_D3D10_DEVICE)
{
WARN("Unknown layer id %#x\n", id);
*device_layer = NULL;
return E_NOTIMPL;
}
object = *layer_base;
if (FAILED(hr = d3d10_device_init(object, device_object)))
{
WARN("Failed to initialize device, hr %#x.\n", hr);
*device_layer = NULL;
return hr;
}
*device_layer = &object->IUnknown_inner;
TRACE("Created d3d10 device at %p\n", object);
return S_OK;
}
HRESULT WINAPI D3D11CoreRegisterLayers(void)
{
const struct dxgi_device_layer layers[] =
{
{DXGI_DEVICE_LAYER_D3D10_DEVICE, layer_init, layer_get_size, layer_create},
};
DXGID3D10RegisterLayers(layers, sizeof(layers)/sizeof(*layers));
return S_OK;
}
HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter, UINT flags,
const D3D_FEATURE_LEVEL *feature_levels, UINT levels, ID3D11Device **device)
{
IUnknown *dxgi_device;
HMODULE d3d11;
HRESULT hr;
TRACE("factory %p, adapter %p, flags %#x, feature_levels %p, levels %u, device %p.\n",
factory, adapter, flags, feature_levels, levels, device);
FIXME("Ignoring feature levels.\n");
d3d11 = GetModuleHandleA("d3d11.dll");
hr = DXGID3D10CreateDevice(d3d11, factory, adapter, flags, 0, (void **)&dxgi_device);
if (FAILED(hr))
{
WARN("Failed to create device, returning %#x.\n", hr);
return hr;
}
hr = IUnknown_QueryInterface(dxgi_device, &IID_ID3D11Device, (void **)device);
IUnknown_Release(dxgi_device);
if (FAILED(hr))
{
ERR("Failed to query ID3D11Device interface, returning E_FAIL.\n");
return E_FAIL;
}
return S_OK;
}
HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags,
const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device,
D3D_FEATURE_LEVEL *feature_level, ID3D11DeviceContext **context)

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_D3D10CORE_PRIVATE_H
#define __WINE_D3D10CORE_PRIVATE_H
#ifndef __WINE_D3D11_PRIVATE_H
#define __WINE_D3D11_PRIVATE_H
#include "wine/debug.h"
@ -31,7 +31,7 @@
#include "d3d10_1.h"
#include "d3d11_1.h"
#ifdef D3D10CORE_INIT_GUID
#ifdef D3D11_INIT_GUID
#include "initguid.h"
#endif
#include "wine/wined3d.h"
@ -397,4 +397,4 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
UINT flags, void *unknown0, void **device);
HRESULT WINAPI DXGID3D10RegisterLayers(const struct dxgi_device_layer *layers, UINT layer_count);
#endif /* __WINE_D3D10CORE_PRIVATE_H */
#endif /* __WINE_D3D11_PRIVATE_H */

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static void STDMETHODCALLTYPE d3d10_null_wined3d_object_destroyed(void *parent) {}

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static HRESULT isgn_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
{

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
{

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
#define D3D10_FILTER_MIP_MASK 0x01
#define D3D10_FILTER_MAG_MASK 0x04

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static inline struct d3d10_texture2d *impl_from_ID3D10Texture2D(ID3D10Texture2D *iface)
{

View File

@ -20,9 +20,9 @@
#include "config.h"
#include "wine/port.h"
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
#define WINE_D3D10_TO_STR(x) case x: return #x

View File

@ -21,9 +21,9 @@
#include "wine/port.h"
#define NONAMELESSUNION
#include "d3d10core_private.h"
#include "d3d11_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
static HRESULT set_dsdesc_from_resource(D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10Resource *resource)
{

View File

@ -107,7 +107,7 @@ static HRESULT register_d3d10core_layers(HMODULE d3d10core)
if (!dxgi_main.d3d10core)
{
HRESULT hr;
HRESULT (WINAPI *d3d10core_register_layers)(void);
HRESULT (WINAPI *d3d11core_register_layers)(void);
HMODULE mod;
BOOL ret;
@ -117,11 +117,11 @@ static HRESULT register_d3d10core_layers(HMODULE d3d10core)
return E_FAIL;
}
d3d10core_register_layers = (void *)GetProcAddress(mod, "D3D10CoreRegisterLayers");
hr = d3d10core_register_layers();
d3d11core_register_layers = (void *)GetProcAddress(mod, "D3D11CoreRegisterLayers");
hr = d3d11core_register_layers();
if (FAILED(hr))
{
ERR("Failed to register d3d10core layers, returning %#x\n", hr);
ERR("Failed to register d3d11 layers, returning %#x\n", hr);
LeaveCriticalSection(&dxgi_cs);
return hr;
}