mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[DXGI]
* Sync with Wine 1.7.27. CORE-8540 svn path=/trunk/; revision=64302
This commit is contained in:
parent
13b90aabc8
commit
b8bad25e37
10 changed files with 210 additions and 291 deletions
|
@ -23,7 +23,7 @@ add_library(dxgi SHARED
|
|||
|
||||
set_module_type(dxgi win32dll)
|
||||
target_link_libraries(dxgi uuid dxgi_uuids wine)
|
||||
add_importlibs(dxgi wined3d msvcrt kernel32 ntdll)
|
||||
add_importlibs(dxgi wined3d user32 msvcrt kernel32 ntdll)
|
||||
add_dependencies(dxgi wineheaders)
|
||||
add_pch(dxgi dxgi_private.h SOURCE)
|
||||
add_cd_file(TARGET dxgi DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -19,63 +19,60 @@
|
|||
|
||||
#include "dxgi_private.h"
|
||||
|
||||
static inline struct dxgi_adapter *impl_from_IWineDXGIAdapter(IWineDXGIAdapter *iface)
|
||||
#include <assert.h>
|
||||
|
||||
static inline struct dxgi_adapter *impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct dxgi_adapter, IWineDXGIAdapter_iface);
|
||||
return CONTAINING_RECORD(iface, struct dxgi_adapter, IDXGIAdapter1_iface);
|
||||
}
|
||||
|
||||
/* IUnknown methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *iface, REFIID riid, void **object)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IDXGIAdapter1 *iface, REFIID iid, void **out)
|
||||
{
|
||||
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
|
||||
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIObject)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIAdapter)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIAdapter1)
|
||||
|| IsEqualGUID(riid, &IID_IWineDXGIAdapter))
|
||||
if (IsEqualGUID(iid, &IID_IDXGIAdapter1)
|
||||
|| IsEqualGUID(iid, &IID_IDXGIAdapter)
|
||||
|| IsEqualGUID(iid, &IID_IDXGIObject)
|
||||
|| IsEqualGUID(iid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*object = iface;
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
||||
|
||||
*object = NULL;
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IWineDXGIAdapter *iface)
|
||||
static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IDXGIAdapter1 *iface)
|
||||
{
|
||||
struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
|
||||
ULONG refcount = InterlockedIncrement(&This->refcount);
|
||||
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
|
||||
ULONG refcount = InterlockedIncrement(&adapter->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
||||
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IWineDXGIAdapter *iface)
|
||||
static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IDXGIAdapter1 *iface)
|
||||
{
|
||||
struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
|
||||
ULONG refcount = InterlockedDecrement(&This->refcount);
|
||||
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
|
||||
ULONG refcount = InterlockedDecrement(&adapter->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
IDXGIOutput_Release(This->output);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
IDXGIOutput_Release(adapter->output);
|
||||
HeapFree(GetProcessHeap(), 0, adapter);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
/* IDXGIObject methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IWineDXGIAdapter *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IDXGIAdapter1 *iface,
|
||||
REFGUID guid, UINT data_size, const void *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
|
||||
|
@ -83,7 +80,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IWineDXGIAdapter *i
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IWineDXGIAdapter *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IDXGIAdapter1 *iface,
|
||||
REFGUID guid, const IUnknown *object)
|
||||
{
|
||||
FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
|
||||
|
@ -91,7 +88,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IWineDXGIA
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IWineDXGIAdapter *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IDXGIAdapter1 *iface,
|
||||
REFGUID guid, UINT *data_size, void *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
|
||||
|
@ -99,21 +96,19 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IWineDXGIAdapter *i
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IWineDXGIAdapter *iface, REFIID riid, void **parent)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IDXGIAdapter1 *iface, REFIID iid, void **parent)
|
||||
{
|
||||
struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
|
||||
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
|
||||
|
||||
TRACE("iface %p, riid %s, parent %p\n", iface, debugstr_guid(riid), parent);
|
||||
TRACE("iface %p, iid %s, parent %p\n", iface, debugstr_guid(iid), parent);
|
||||
|
||||
return IWineDXGIFactory_QueryInterface(This->parent, riid, parent);
|
||||
return IDXGIFactory1_QueryInterface(&adapter->parent->IDXGIFactory1_iface, iid, parent);
|
||||
}
|
||||
|
||||
/* IDXGIAdapter methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IDXGIAdapter1 *iface,
|
||||
UINT output_idx, IDXGIOutput **output)
|
||||
{
|
||||
struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
|
||||
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
|
||||
|
||||
TRACE("iface %p, output_idx %u, output %p.\n", iface, output_idx, output);
|
||||
|
||||
|
@ -123,7 +118,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac
|
|||
return DXGI_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
*output = This->output;
|
||||
*output = adapter->output;
|
||||
IDXGIOutput_AddRef(*output);
|
||||
|
||||
TRACE("Returning output %p.\n", output);
|
||||
|
@ -131,12 +126,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IDXGIAdapter1 *iface, DXGI_ADAPTER_DESC1 *desc)
|
||||
{
|
||||
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
||||
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
|
||||
struct wined3d_adapter_identifier adapter_id;
|
||||
char description[128];
|
||||
struct wined3d *wined3d;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
@ -144,15 +138,13 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface,
|
|||
if (!desc)
|
||||
return E_INVALIDARG;
|
||||
|
||||
wined3d = IWineDXGIFactory_get_wined3d(adapter->parent);
|
||||
adapter_id.driver_size = 0;
|
||||
adapter_id.description = description;
|
||||
adapter_id.description_size = sizeof(description);
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id);
|
||||
wined3d_decref(wined3d);
|
||||
hr = wined3d_get_adapter_identifier(adapter->parent->wined3d, adapter->ordinal, 0, &adapter_id);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
|
||||
if (FAILED(hr))
|
||||
|
@ -178,7 +170,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IDXGIAdapter1 *iface, DXGI_ADAPTER_DESC *desc)
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 desc1;
|
||||
HRESULT hr;
|
||||
|
@ -195,7 +187,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAdapter *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IDXGIAdapter1 *iface,
|
||||
REFGUID guid, LARGE_INTEGER *umd_version)
|
||||
{
|
||||
FIXME("iface %p, guid %s, umd_version %p stub!\n", iface, debugstr_guid(guid), umd_version);
|
||||
|
@ -203,43 +195,34 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAda
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* IWineDXGIAdapter methods */
|
||||
|
||||
static UINT STDMETHODCALLTYPE dxgi_adapter_get_ordinal(IWineDXGIAdapter *iface)
|
||||
static const struct IDXGIAdapter1Vtbl dxgi_adapter_vtbl =
|
||||
{
|
||||
struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
|
||||
|
||||
TRACE("iface %p, returning %u\n", iface, This->ordinal);
|
||||
|
||||
return This->ordinal;
|
||||
}
|
||||
|
||||
static const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
dxgi_adapter_QueryInterface,
|
||||
dxgi_adapter_AddRef,
|
||||
dxgi_adapter_Release,
|
||||
/* IDXGIObject methods */
|
||||
dxgi_adapter_SetPrivateData,
|
||||
dxgi_adapter_SetPrivateDataInterface,
|
||||
dxgi_adapter_GetPrivateData,
|
||||
dxgi_adapter_GetParent,
|
||||
/* IDXGIAdapter methods */
|
||||
dxgi_adapter_EnumOutputs,
|
||||
dxgi_adapter_GetDesc,
|
||||
dxgi_adapter_CheckInterfaceSupport,
|
||||
/* IDXGIAdapter1 methods */
|
||||
dxgi_adapter_GetDesc1,
|
||||
/* IWineDXGIAdapter methods */
|
||||
dxgi_adapter_get_ordinal,
|
||||
};
|
||||
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, IWineDXGIFactory *parent, UINT ordinal)
|
||||
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
assert(iface->lpVtbl == &dxgi_adapter_vtbl);
|
||||
return CONTAINING_RECORD(iface, struct dxgi_adapter, IDXGIAdapter1_iface);
|
||||
}
|
||||
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory *parent, UINT ordinal)
|
||||
{
|
||||
struct dxgi_output *output;
|
||||
|
||||
adapter->IWineDXGIAdapter_iface.lpVtbl = &dxgi_adapter_vtbl;
|
||||
adapter->IDXGIAdapter1_iface.lpVtbl = &dxgi_adapter_vtbl;
|
||||
adapter->parent = parent;
|
||||
adapter->refcount = 1;
|
||||
adapter->ordinal = ordinal;
|
||||
|
|
|
@ -75,9 +75,10 @@ static ULONG STDMETHODCALLTYPE dxgi_device_Release(IWineDXGIDevice *iface)
|
|||
{
|
||||
if (This->child_layer) IUnknown_Release(This->child_layer);
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_device_uninit_3d(This->wined3d_device);
|
||||
wined3d_device_decref(This->wined3d_device);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
IWineDXGIFactory_Release(This->factory);
|
||||
IDXGIFactory1_Release(This->factory);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
|
@ -143,7 +144,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_GetAdapter(IWineDXGIDevice *iface,
|
|||
wined3d_device_get_creation_parameters(This->wined3d_device, &create_parameters);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
|
||||
return IWineDXGIFactory_EnumAdapters(This->factory, create_parameters.adapter_idx, adapter);
|
||||
return IDXGIFactory1_EnumAdapters(This->factory, create_parameters.adapter_idx, adapter);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *iface,
|
||||
|
@ -243,18 +244,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_GetGPUThreadPriority(IWineDXGIDevic
|
|||
|
||||
/* IWineDXGIDevice methods */
|
||||
|
||||
static struct wined3d_device * STDMETHODCALLTYPE dxgi_device_get_wined3d_device(IWineDXGIDevice *iface)
|
||||
{
|
||||
struct dxgi_device *This = impl_from_IWineDXGIDevice(iface);
|
||||
|
||||
TRACE("iface %p\n", iface);
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_device_incref(This->wined3d_device);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
return This->wined3d_device;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *iface, const DXGI_SURFACE_DESC *desc,
|
||||
DXGI_USAGE usage, const DXGI_SHARED_RESOURCE *shared_resource, IUnknown *outer, void **surface)
|
||||
{
|
||||
|
@ -271,8 +260,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer, desc)))
|
||||
{
|
||||
WARN("Failed to initialize surface, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
|
@ -334,7 +322,6 @@ static const struct IWineDXGIDeviceVtbl dxgi_device_vtbl =
|
|||
dxgi_device_SetGPUThreadPriority,
|
||||
dxgi_device_GetGPUThreadPriority,
|
||||
/* IWineDXGIAdapter methods */
|
||||
dxgi_device_get_wined3d_device,
|
||||
dxgi_device_create_surface,
|
||||
dxgi_device_create_swapchain,
|
||||
};
|
||||
|
@ -343,90 +330,85 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
IDXGIFactory *factory, IDXGIAdapter *adapter)
|
||||
{
|
||||
struct wined3d_device_parent *wined3d_device_parent;
|
||||
struct wined3d_swapchain_desc swapchain_desc;
|
||||
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||
IWineDXGIAdapter *wine_adapter;
|
||||
UINT adapter_ordinal;
|
||||
struct wined3d *wined3d;
|
||||
struct dxgi_adapter *dxgi_adapter;
|
||||
struct dxgi_factory *dxgi_factory;
|
||||
void *layer_base;
|
||||
HRESULT hr;
|
||||
WINED3DCAPS caps;
|
||||
|
||||
if (!(dxgi_factory = unsafe_impl_from_IDXGIFactory1((IDXGIFactory1 *)factory)))
|
||||
{
|
||||
WARN("This is not the factory we're looking for.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (!(dxgi_adapter = unsafe_impl_from_IDXGIAdapter1((IDXGIAdapter1 *)adapter)))
|
||||
{
|
||||
WARN("This is not the adapter we're looking for.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
device->IWineDXGIDevice_iface.lpVtbl = &dxgi_device_vtbl;
|
||||
device->refcount = 1;
|
||||
|
||||
layer_base = device + 1;
|
||||
|
||||
hr = layer->create(layer->id, &layer_base, 0,
|
||||
device, &IID_IUnknown, (void **)&device->child_layer);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = layer->create(layer->id, &layer_base, 0,
|
||||
device, &IID_IUnknown, (void **)&device->child_layer)))
|
||||
{
|
||||
WARN("Failed to create device, returning %#x.\n", hr);
|
||||
goto fail;
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = IDXGIFactory_QueryInterface(factory, &IID_IWineDXGIFactory, (void **)&device->factory);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("This is not the factory we're looking for, returning %#x.\n", hr);
|
||||
goto fail;
|
||||
}
|
||||
wined3d = IWineDXGIFactory_get_wined3d(device->factory);
|
||||
|
||||
hr = IDXGIAdapter_QueryInterface(adapter, &IID_IWineDXGIAdapter, (void **)&wine_adapter);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("This is not the adapter we're looking for, returning %#x.\n", hr);
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
goto fail;
|
||||
}
|
||||
adapter_ordinal = IWineDXGIAdapter_get_ordinal(wine_adapter);
|
||||
IWineDXGIAdapter_Release(wine_adapter);
|
||||
|
||||
hr = IWineDXGIDevice_QueryInterface(&device->IWineDXGIDevice_iface, &IID_IWineDXGIDeviceParent,
|
||||
(void **)&dxgi_device_parent);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = IWineDXGIDevice_QueryInterface(&device->IWineDXGIDevice_iface,
|
||||
&IID_IWineDXGIDeviceParent, (void **)&dxgi_device_parent)))
|
||||
{
|
||||
ERR("DXGI device should implement IWineD3DDeviceParent.\n");
|
||||
goto fail;
|
||||
IUnknown_Release(device->child_layer);
|
||||
return hr;
|
||||
}
|
||||
|
||||
wined3d_device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
|
||||
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||
|
||||
FIXME("Ignoring adapter type.\n");
|
||||
|
||||
hr = wined3d_get_device_caps(wined3d, adapter_ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
|
||||
hr = wined3d_get_device_caps(dxgi_factory->wined3d, dxgi_adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
|
||||
if (FAILED(hr) || caps.VertexShaderVersion < 4 || caps.PixelShaderVersion < 4)
|
||||
{
|
||||
WARN("Direct3D 10 is not supported on this GPU with the current shader backend.\n");
|
||||
if (SUCCEEDED(hr))
|
||||
hr = E_FAIL;
|
||||
goto fail;
|
||||
IUnknown_Release(device->child_layer);
|
||||
return hr;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
hr = wined3d_device_create(wined3d, adapter_ordinal, WINED3D_DEVICE_TYPE_HAL, NULL, 0, 4,
|
||||
wined3d_device_parent, &device->wined3d_device);
|
||||
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||
wined3d_decref(wined3d);
|
||||
hr = wined3d_device_create(dxgi_factory->wined3d, dxgi_adapter->ordinal, WINED3D_DEVICE_TYPE_HAL,
|
||||
NULL, 0, 4, wined3d_device_parent, &device->wined3d_device);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create a wined3d device, returning %#x.\n", hr);
|
||||
goto fail;
|
||||
IUnknown_Release(device->child_layer);
|
||||
return hr;
|
||||
}
|
||||
|
||||
memset(&swapchain_desc, 0, sizeof(swapchain_desc));
|
||||
swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
|
||||
swapchain_desc.device_window = dxgi_factory_get_device_window(dxgi_factory);
|
||||
swapchain_desc.windowed = TRUE;
|
||||
if (FAILED(hr = wined3d_device_init_3d(device->wined3d_device, &swapchain_desc)))
|
||||
{
|
||||
ERR("Failed to initialize 3D, hr %#x.\n", hr);
|
||||
wined3d_device_decref(device->wined3d_device);
|
||||
IUnknown_Release(device->child_layer);
|
||||
return hr;
|
||||
}
|
||||
|
||||
device->factory = &dxgi_factory->IDXGIFactory1_iface;
|
||||
IDXGIFactory1_AddRef(device->factory);
|
||||
|
||||
return S_OK;
|
||||
|
||||
fail:
|
||||
if (device->wined3d_device)
|
||||
{
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_device_decref(device->wined3d_device);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
}
|
||||
if (device->factory) IWineDXGIFactory_Release(device->factory);
|
||||
if (device->child_layer) IUnknown_Release(device->child_layer);
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -86,15 +86,18 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSP
|
|||
/* IDXGIFactory */
|
||||
struct dxgi_factory
|
||||
{
|
||||
IWineDXGIFactory IWineDXGIFactory_iface;
|
||||
IDXGIFactory1 IDXGIFactory1_iface;
|
||||
LONG refcount;
|
||||
struct wined3d *wined3d;
|
||||
UINT adapter_count;
|
||||
IWineDXGIAdapter **adapters;
|
||||
IDXGIAdapter1 **adapters;
|
||||
BOOL extended;
|
||||
HWND device_window;
|
||||
};
|
||||
|
||||
HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended) DECLSPEC_HIDDEN;
|
||||
HWND dxgi_factory_get_device_window(struct dxgi_factory *factory) DECLSPEC_HIDDEN;
|
||||
struct dxgi_factory *unsafe_impl_from_IDXGIFactory1(IDXGIFactory1 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* IDXGIDevice */
|
||||
struct dxgi_device
|
||||
|
@ -103,7 +106,7 @@ struct dxgi_device
|
|||
IUnknown *child_layer;
|
||||
LONG refcount;
|
||||
struct wined3d_device *wined3d_device;
|
||||
IWineDXGIFactory *factory;
|
||||
IDXGIFactory1 *factory;
|
||||
};
|
||||
|
||||
HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *layer,
|
||||
|
@ -122,14 +125,15 @@ void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter)
|
|||
/* IDXGIAdapter */
|
||||
struct dxgi_adapter
|
||||
{
|
||||
IWineDXGIAdapter IWineDXGIAdapter_iface;
|
||||
IWineDXGIFactory *parent;
|
||||
IDXGIAdapter1 IDXGIAdapter1_iface;
|
||||
struct dxgi_factory *parent;
|
||||
LONG refcount;
|
||||
UINT ordinal;
|
||||
IDXGIOutput *output;
|
||||
};
|
||||
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, IWineDXGIFactory *parent, UINT ordinal) DECLSPEC_HIDDEN;
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory *parent, UINT ordinal) DECLSPEC_HIDDEN;
|
||||
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* IDXGISwapChain */
|
||||
struct dxgi_swapchain
|
||||
|
@ -150,8 +154,11 @@ struct dxgi_surface
|
|||
IUnknown *outer_unknown;
|
||||
LONG refcount;
|
||||
IDXGIDevice *device;
|
||||
|
||||
DXGI_SURFACE_DESC desc;
|
||||
};
|
||||
|
||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, IUnknown *outer) DECLSPEC_HIDDEN;
|
||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
||||
IUnknown *outer, const DXGI_SURFACE_DESC *desc) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* __WINE_DXGI_PRIVATE_H */
|
||||
|
|
|
@ -19,75 +19,74 @@
|
|||
|
||||
#include "dxgi_private.h"
|
||||
|
||||
static inline struct dxgi_factory *impl_from_IWineDXGIFactory(IWineDXGIFactory *iface)
|
||||
#include <assert.h>
|
||||
|
||||
static inline struct dxgi_factory *impl_from_IDXGIFactory1(IDXGIFactory1 *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct dxgi_factory, IWineDXGIFactory_iface);
|
||||
return CONTAINING_RECORD(iface, struct dxgi_factory, IDXGIFactory1_iface);
|
||||
}
|
||||
|
||||
/* IUnknown methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *iface, REFIID riid, void **object)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IDXGIFactory1 *iface, REFIID iid, void **out)
|
||||
{
|
||||
struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface);
|
||||
struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
|
||||
|
||||
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
|
||||
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIObject)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIFactory)
|
||||
|| (factory->extended && IsEqualGUID(riid, &IID_IDXGIFactory1))
|
||||
|| IsEqualGUID(riid, &IID_IWineDXGIFactory))
|
||||
if ((factory->extended && IsEqualGUID(iid, &IID_IDXGIFactory1))
|
||||
|| IsEqualGUID(iid, &IID_IDXGIFactory)
|
||||
|| IsEqualGUID(iid, &IID_IDXGIObject)
|
||||
|| IsEqualGUID(iid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*object = iface;
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
||||
|
||||
*object = NULL;
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IWineDXGIFactory *iface)
|
||||
static ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IDXGIFactory1 *iface)
|
||||
{
|
||||
struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
|
||||
ULONG refcount = InterlockedIncrement(&This->refcount);
|
||||
struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
|
||||
ULONG refcount = InterlockedIncrement(&factory->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
||||
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
|
||||
static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IDXGIFactory1 *iface)
|
||||
{
|
||||
struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
|
||||
ULONG refcount = InterlockedDecrement(&This->refcount);
|
||||
struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
|
||||
ULONG refcount = InterlockedDecrement(&factory->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
for (i = 0; i < This->adapter_count; ++i)
|
||||
if (factory->device_window)
|
||||
DestroyWindow(factory->device_window);
|
||||
for (i = 0; i < factory->adapter_count; ++i)
|
||||
{
|
||||
IWineDXGIAdapter_Release(This->adapters[i]);
|
||||
IDXGIAdapter1_Release(factory->adapters[i]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->adapters);
|
||||
HeapFree(GetProcessHeap(), 0, factory->adapters);
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_decref(This->wined3d);
|
||||
wined3d_decref(factory->wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
HeapFree(GetProcessHeap(), 0, factory);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
/* IDXGIObject methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IDXGIFactory1 *iface,
|
||||
REFGUID guid, UINT data_size, const void *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
|
||||
|
@ -95,7 +94,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IWineDXGIFactory *i
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IDXGIFactory1 *iface,
|
||||
REFGUID guid, const IUnknown *object)
|
||||
{
|
||||
FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
|
||||
|
@ -103,7 +102,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IWineDXGIF
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IDXGIFactory1 *iface,
|
||||
REFGUID guid, UINT *data_size, void *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
|
||||
|
@ -111,23 +110,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IWineDXGIFactory *i
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface, REFIID riid, void **parent)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IDXGIFactory1 *iface, REFIID iid, void **parent)
|
||||
{
|
||||
WARN("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
|
||||
WARN("iface %p, iid %s, parent %p.\n", iface, debugstr_guid(iid), parent);
|
||||
|
||||
*parent = NULL;
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* IDXGIFactory methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters1(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters1(IDXGIFactory1 *iface,
|
||||
UINT adapter_idx, IDXGIAdapter1 **adapter)
|
||||
{
|
||||
struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface);
|
||||
struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
|
||||
|
||||
TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter);
|
||||
TRACE("iface %p, adapter_idx %u, adapter %p.\n", iface, adapter_idx, adapter);
|
||||
|
||||
if (!adapter)
|
||||
return DXGI_ERROR_INVALID_CALL;
|
||||
|
@ -141,27 +138,27 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters1(IWineDXGIFactory *if
|
|||
*adapter = (IDXGIAdapter1 *)factory->adapters[adapter_idx];
|
||||
IDXGIAdapter1_AddRef(*adapter);
|
||||
|
||||
TRACE("Returning adapter %p\n", *adapter);
|
||||
TRACE("Returning adapter %p.\n", *adapter);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IDXGIFactory1 *iface,
|
||||
UINT adapter_idx, IDXGIAdapter **adapter)
|
||||
{
|
||||
TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter);
|
||||
TRACE("iface %p, adapter_idx %u, adapter %p.\n", iface, adapter_idx, adapter);
|
||||
|
||||
return dxgi_factory_EnumAdapters1(iface, adapter_idx, (IDXGIAdapter1 **)adapter);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IWineDXGIFactory *iface, HWND window, UINT flags)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IDXGIFactory1 *iface, HWND window, UINT flags)
|
||||
{
|
||||
FIXME("iface %p, window %p, flags %#x stub!\n\n", iface, window, flags);
|
||||
FIXME("iface %p, window %p, flags %#x stub!\n", iface, window, flags);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IWineDXGIFactory *iface, HWND *window)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IDXGIFactory1 *iface, HWND *window)
|
||||
{
|
||||
FIXME("iface %p, window %p stub!\n", iface, window);
|
||||
|
||||
|
@ -176,14 +173,12 @@ static UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
|
|||
return rational->Numerator;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IDXGIFactory1 *iface,
|
||||
IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
|
||||
{
|
||||
struct wined3d_swapchain *wined3d_swapchain;
|
||||
struct wined3d_swapchain_desc wined3d_desc;
|
||||
struct wined3d_device *wined3d_device;
|
||||
IWineDXGIDevice *dxgi_device;
|
||||
UINT count;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("iface %p, device %p, desc %p, swapchain %p partial stub!\n", iface, device, desc, swapchain);
|
||||
|
@ -195,17 +190,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
|
|||
return hr;
|
||||
}
|
||||
|
||||
wined3d_device = IWineDXGIDevice_get_wined3d_device(dxgi_device);
|
||||
IWineDXGIDevice_Release(dxgi_device);
|
||||
|
||||
count = wined3d_device_get_swapchain_count(wined3d_device);
|
||||
if (count)
|
||||
{
|
||||
FIXME("Only a single swapchain supported.\n");
|
||||
wined3d_device_decref(wined3d_device);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (!desc->OutputWindow)
|
||||
{
|
||||
FIXME("No output window, should use factory output window\n");
|
||||
|
@ -236,33 +220,20 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
|
|||
wined3d_desc.refresh_rate = dxgi_rational_to_uint(&desc->BufferDesc.RefreshRate);
|
||||
wined3d_desc.swap_interval = WINED3DPRESENT_INTERVAL_DEFAULT;
|
||||
|
||||
hr = wined3d_device_init_3d(wined3d_device, &wined3d_desc);
|
||||
hr = IWineDXGIDevice_create_swapchain(dxgi_device, &wined3d_desc, &wined3d_swapchain);
|
||||
IWineDXGIDevice_Release(dxgi_device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize 3D, returning %#x\n", hr);
|
||||
wined3d_device_decref(wined3d_device);
|
||||
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
wined3d_swapchain = wined3d_device_get_swapchain(wined3d_device, 0);
|
||||
wined3d_device_decref(wined3d_device);
|
||||
if (!wined3d_swapchain)
|
||||
{
|
||||
WARN("Failed to get swapchain.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*swapchain = wined3d_swapchain_get_parent(wined3d_swapchain);
|
||||
|
||||
/* FIXME? The swapchain is created with refcount 1 by the wined3d device,
|
||||
* but the wined3d device can't hold a real reference. */
|
||||
|
||||
TRACE("Created IDXGISwapChain %p\n", *swapchain);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFactory *iface,
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IDXGIFactory1 *iface,
|
||||
HMODULE swrast, IDXGIAdapter **adapter)
|
||||
{
|
||||
FIXME("iface %p, swrast %p, adapter %p stub!\n", iface, swrast, adapter);
|
||||
|
@ -270,57 +241,45 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static BOOL STDMETHODCALLTYPE dxgi_factory_IsCurrent(IWineDXGIFactory *iface)
|
||||
static BOOL STDMETHODCALLTYPE dxgi_factory_IsCurrent(IDXGIFactory1 *iface)
|
||||
{
|
||||
FIXME("iface %p stub!\n", iface);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* IWineDXGIFactory methods */
|
||||
|
||||
static struct wined3d * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface)
|
||||
static const struct IDXGIFactory1Vtbl dxgi_factory_vtbl =
|
||||
{
|
||||
struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
|
||||
|
||||
TRACE("iface %p\n", iface);
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_incref(This->wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
return This->wined3d;
|
||||
}
|
||||
|
||||
static const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
dxgi_factory_QueryInterface,
|
||||
dxgi_factory_AddRef,
|
||||
dxgi_factory_Release,
|
||||
/* IDXGIObject methods */
|
||||
dxgi_factory_SetPrivateData,
|
||||
dxgi_factory_SetPrivateDataInterface,
|
||||
dxgi_factory_GetPrivateData,
|
||||
dxgi_factory_GetParent,
|
||||
/* IDXGIFactory methods */
|
||||
dxgi_factory_EnumAdapters,
|
||||
dxgi_factory_MakeWindowAssociation,
|
||||
dxgi_factory_GetWindowAssociation,
|
||||
dxgi_factory_CreateSwapChain,
|
||||
dxgi_factory_CreateSoftwareAdapter,
|
||||
/* IDXGIFactory1 methods */
|
||||
dxgi_factory_EnumAdapters1,
|
||||
dxgi_factory_IsCurrent,
|
||||
/* IWineDXGIFactory methods */
|
||||
dxgi_factory_get_wined3d,
|
||||
};
|
||||
|
||||
struct dxgi_factory *unsafe_impl_from_IDXGIFactory1(IDXGIFactory1 *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
assert(iface->lpVtbl == &dxgi_factory_vtbl);
|
||||
return CONTAINING_RECORD(iface, struct dxgi_factory, IDXGIFactory1_iface);
|
||||
}
|
||||
|
||||
static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended)
|
||||
{
|
||||
HRESULT hr;
|
||||
UINT i;
|
||||
|
||||
factory->IWineDXGIFactory_iface.lpVtbl = &dxgi_factory_vtbl;
|
||||
factory->IDXGIFactory1_iface.lpVtbl = &dxgi_factory_vtbl;
|
||||
factory->refcount = 1;
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
|
@ -352,14 +311,13 @@ static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended)
|
|||
|
||||
for (j = 0; j < i; ++j)
|
||||
{
|
||||
IWineDXGIAdapter_Release(factory->adapters[j]);
|
||||
IDXGIAdapter1_Release(factory->adapters[j]);
|
||||
}
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = dxgi_adapter_init(adapter, &factory->IWineDXGIFactory_iface, i);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = dxgi_adapter_init(adapter, factory, i)))
|
||||
{
|
||||
UINT j;
|
||||
|
||||
|
@ -368,12 +326,12 @@ static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended)
|
|||
HeapFree(GetProcessHeap(), 0, adapter);
|
||||
for (j = 0; j < i; ++j)
|
||||
{
|
||||
IWineDXGIAdapter_Release(factory->adapters[j]);
|
||||
IDXGIAdapter1_Release(factory->adapters[j]);
|
||||
}
|
||||
goto fail;
|
||||
}
|
||||
|
||||
factory->adapters[i] = &adapter->IWineDXGIAdapter_iface;
|
||||
factory->adapters[i] = &adapter->IDXGIAdapter1_iface;
|
||||
}
|
||||
|
||||
factory->extended = extended;
|
||||
|
@ -405,8 +363,28 @@ HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended)
|
|||
|
||||
TRACE("Created factory %p.\n", object);
|
||||
|
||||
hr = IWineDXGIFactory_QueryInterface(&object->IWineDXGIFactory_iface, riid, factory);
|
||||
IWineDXGIFactory_Release(&object->IWineDXGIFactory_iface);
|
||||
hr = IDXGIFactory1_QueryInterface(&object->IDXGIFactory1_iface, riid, factory);
|
||||
IDXGIFactory1_Release(&object->IDXGIFactory1_iface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HWND dxgi_factory_get_device_window(struct dxgi_factory *factory)
|
||||
{
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
|
||||
if (!factory->device_window)
|
||||
{
|
||||
if (!(factory->device_window = CreateWindowA("static", "DXGI device window",
|
||||
WS_DISABLED, 0, 0, 0, 0, NULL, NULL, NULL, NULL)))
|
||||
{
|
||||
ERR("Failed to create a window.\n");
|
||||
return NULL;
|
||||
}
|
||||
TRACE("Created device window %p for factory %p.\n", factory->device_window, factory);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
|
||||
return factory->device_window;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
wined3d = IWineDXGIFactory_get_wined3d(This->adapter->parent);
|
||||
wined3d = This->adapter->parent->wined3d;
|
||||
wined3d_format = wined3dformat_from_dxgi_format(format);
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
|
@ -144,7 +144,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
|
||||
if (!desc)
|
||||
{
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
*mode_count = max_count;
|
||||
return S_OK;
|
||||
|
@ -152,7 +151,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
|
||||
if (max_count > *mode_count)
|
||||
{
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
return DXGI_ERROR_MORE_DATA;
|
||||
}
|
||||
|
@ -169,7 +167,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
if (FAILED(hr))
|
||||
{
|
||||
WARN("EnumAdapterModes failed, hr %#x.\n", hr);
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
return hr;
|
||||
}
|
||||
|
@ -182,7 +179,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
desc[i].ScanlineOrdering = mode.scanline_ordering;
|
||||
desc[i].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
|
||||
}
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -149,9 +149,13 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDevice(IDXGISurface *iface, REF
|
|||
/* IDXGISurface methods */
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDesc(IDXGISurface *iface, DXGI_SURFACE_DESC *desc)
|
||||
{
|
||||
FIXME("iface %p, desc %p stub!\n", iface, desc);
|
||||
struct dxgi_surface *surface = impl_from_IDXGISurface(iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
*desc = surface->desc;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_surface_Map(IDXGISurface *iface, DXGI_MAPPED_RECT *mapped_rect, UINT flags)
|
||||
|
@ -195,13 +199,15 @@ static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl =
|
|||
dxgi_surface_inner_Release,
|
||||
};
|
||||
|
||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, IUnknown *outer)
|
||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
||||
IUnknown *outer, const DXGI_SURFACE_DESC *desc)
|
||||
{
|
||||
surface->IDXGISurface_iface.lpVtbl = &dxgi_surface_vtbl;
|
||||
surface->IUnknown_iface.lpVtbl = &dxgi_surface_inner_unknown_vtbl;
|
||||
surface->refcount = 1;
|
||||
surface->outer_unknown = outer ? outer : &surface->IUnknown_iface;
|
||||
surface->device = device;
|
||||
surface->desc = *desc;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -67,19 +67,7 @@ static ULONG STDMETHODCALLTYPE dxgi_swapchain_Release(IDXGISwapChain *iface)
|
|||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
struct wined3d_device *wined3d_device;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("Only a single swapchain is supported\n");
|
||||
|
||||
wined3d_device = wined3d_swapchain_get_device(This->wined3d_swapchain);
|
||||
hr = wined3d_device_uninit_3d(wined3d_device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Uninit3D failed, hr %#x\n", hr);
|
||||
}
|
||||
}
|
||||
wined3d_swapchain_decref(This->wined3d_swapchain);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
|
|
@ -18,26 +18,6 @@
|
|||
|
||||
import "dxgi.idl";
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(a07ad9ab-fb01-4574-8bfb-0a70a7373f04)
|
||||
]
|
||||
interface IWineDXGIFactory : IDXGIFactory1
|
||||
{
|
||||
struct wined3d *get_wined3d();
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(ab1de34c-2963-4ffd-8493-40f580e510e5)
|
||||
]
|
||||
interface IWineDXGIAdapter : IDXGIAdapter1
|
||||
{
|
||||
UINT get_ordinal();
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
|
@ -45,7 +25,6 @@ interface IWineDXGIAdapter : IDXGIAdapter1
|
|||
]
|
||||
interface IWineDXGIDevice : IDXGIDevice
|
||||
{
|
||||
struct wined3d_device *get_wined3d_device();
|
||||
HRESULT create_surface(
|
||||
[in] const DXGI_SURFACE_DESC *desc,
|
||||
[in] DXGI_USAGE usage,
|
||||
|
|
|
@ -42,7 +42,7 @@ reactos/dll/directx/wine/dplay # Synced to Wine-1.7.17
|
|||
reactos/dll/directx/wine/dplayx # Synced to Wine-1.7.27
|
||||
reactos/dll/directx/wine/dsound # Synced to Wine-1.5.26
|
||||
reactos/dll/directx/wine/dxdiagn # Synced to Wine-1.7.17
|
||||
reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.17
|
||||
reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.27
|
||||
reactos/dll/directx/wine/msdmo # Synced to Wine-1.7.17
|
||||
reactos/dll/directx/wine/qedit # Synced to Wine-1.7.17
|
||||
reactos/dll/directx/wine/quartz # Synced to Wine-1.7.17
|
||||
|
|
Loading…
Reference in a new issue