dxgi: Get rid of IWineDXGIFactory.
This commit is contained in:
parent
22abd896fa
commit
72aaaac486
|
@ -105,7 +105,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IDXGIAdapter1 *iface, RE
|
|||
|
||||
TRACE("iface %p, iid %s, parent %p\n", iface, debugstr_guid(iid), parent);
|
||||
|
||||
return IWineDXGIFactory_QueryInterface(adapter->parent, iid, parent);
|
||||
return IDXGIFactory1_QueryInterface(&adapter->parent->IDXGIFactory1_iface, iid, parent);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IDXGIAdapter1 *iface,
|
||||
|
@ -134,7 +134,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IDXGIAdapter1 *iface, DXG
|
|||
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);
|
||||
|
@ -142,15 +141,13 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IDXGIAdapter1 *iface, DXG
|
|||
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))
|
||||
|
@ -224,7 +221,7 @@ struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface)
|
|||
return CONTAINING_RECORD(iface, struct dxgi_adapter, IDXGIAdapter1_iface);
|
||||
}
|
||||
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, IWineDXGIFactory *parent, UINT ordinal)
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory *parent, UINT ordinal)
|
||||
{
|
||||
struct dxgi_output *output;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ static ULONG STDMETHODCALLTYPE dxgi_device_Release(IWineDXGIDevice *iface)
|
|||
EnterCriticalSection(&dxgi_cs);
|
||||
wined3d_device_decref(This->wined3d_device);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
IWineDXGIFactory_Release(This->factory);
|
||||
IDXGIFactory1_Release(This->factory);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,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,
|
||||
|
@ -349,11 +349,17 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
struct wined3d_device_parent *wined3d_device_parent;
|
||||
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||
struct dxgi_adapter *dxgi_adapter;
|
||||
struct wined3d *wined3d;
|
||||
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");
|
||||
|
@ -365,65 +371,48 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
|
||||
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 = 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, dxgi_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, dxgi_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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ 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;
|
||||
|
@ -89,6 +89,7 @@ struct dxgi_factory
|
|||
};
|
||||
|
||||
HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended) DECLSPEC_HIDDEN;
|
||||
struct dxgi_factory *unsafe_impl_from_IDXGIFactory1(IDXGIFactory1 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* IDXGIDevice */
|
||||
struct dxgi_device
|
||||
|
@ -97,7 +98,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,
|
||||
|
@ -117,13 +118,13 @@ void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter)
|
|||
struct dxgi_adapter
|
||||
{
|
||||
IDXGIAdapter1 IDXGIAdapter1_iface;
|
||||
IWineDXGIFactory *parent;
|
||||
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 */
|
||||
|
|
|
@ -24,75 +24,70 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
|
||||
|
||||
static inline struct dxgi_factory *impl_from_IWineDXGIFactory(IWineDXGIFactory *iface)
|
||||
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)
|
||||
for (i = 0; i < factory->adapter_count; ++i)
|
||||
{
|
||||
IDXGIAdapter1_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);
|
||||
|
@ -100,7 +95,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);
|
||||
|
@ -108,7 +103,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);
|
||||
|
@ -116,23 +111,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;
|
||||
|
@ -146,27 +139,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", 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);
|
||||
|
||||
|
@ -181,7 +174,7 @@ 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;
|
||||
|
@ -267,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
|
|||
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);
|
||||
|
@ -275,57 +268,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);
|
||||
|
@ -363,8 +344,7 @@ static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended)
|
|||
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;
|
||||
|
||||
|
@ -410,8 +390,8 @@ 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;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,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);
|
||||
|
@ -149,7 +149,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
|
||||
if (!desc)
|
||||
{
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
*mode_count = max_count;
|
||||
return S_OK;
|
||||
|
@ -157,7 +156,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;
|
||||
}
|
||||
|
@ -174,7 +172,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;
|
||||
}
|
||||
|
@ -187,7 +184,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;
|
||||
|
|
|
@ -18,16 +18,6 @@
|
|||
|
||||
import "dxgi.idl";
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(a07ad9ab-fb01-4574-8bfb-0a70a7373f04)
|
||||
]
|
||||
interface IWineDXGIFactory : IDXGIFactory1
|
||||
{
|
||||
struct wined3d *get_wined3d();
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
|
|
Loading…
Reference in New Issue