dxgi: Get rid of IWineDXGIAdapter.
This commit is contained in:
parent
240c454089
commit
22abd896fa
|
@ -24,63 +24,58 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
|
||||
|
||||
static inline struct dxgi_adapter *impl_from_IWineDXGIAdapter(IWineDXGIAdapter *iface)
|
||||
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);
|
||||
|
@ -88,7 +83,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);
|
||||
|
@ -96,7 +91,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);
|
||||
|
@ -104,21 +99,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 IWineDXGIFactory_QueryInterface(adapter->parent, 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);
|
||||
|
||||
|
@ -128,7 +121,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);
|
||||
|
@ -136,9 +129,9 @@ 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;
|
||||
|
@ -183,7 +176,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;
|
||||
|
@ -200,7 +193,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);
|
||||
|
@ -208,43 +201,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,
|
||||
};
|
||||
|
||||
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, IWineDXGIFactory *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;
|
||||
|
|
|
@ -348,13 +348,18 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
{
|
||||
struct wined3d_device_parent *wined3d_device_parent;
|
||||
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||
IWineDXGIAdapter *wine_adapter;
|
||||
UINT adapter_ordinal;
|
||||
struct dxgi_adapter *dxgi_adapter;
|
||||
struct wined3d *wined3d;
|
||||
void *layer_base;
|
||||
HRESULT hr;
|
||||
WINED3DCAPS caps;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -376,18 +381,6 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
}
|
||||
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))
|
||||
|
@ -400,7 +393,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
|
||||
FIXME("Ignoring adapter type.\n");
|
||||
|
||||
hr = wined3d_get_device_caps(wined3d, adapter_ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
|
||||
hr = wined3d_get_device_caps(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");
|
||||
|
@ -410,7 +403,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
|||
}
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
hr = wined3d_device_create(wined3d, adapter_ordinal, WINED3D_DEVICE_TYPE_HAL, NULL, 0, 4,
|
||||
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);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
|
@ -82,7 +84,7 @@ struct dxgi_factory
|
|||
LONG refcount;
|
||||
struct wined3d *wined3d;
|
||||
UINT adapter_count;
|
||||
IWineDXGIAdapter **adapters;
|
||||
IDXGIAdapter1 **adapters;
|
||||
BOOL extended;
|
||||
};
|
||||
|
||||
|
@ -114,7 +116,7 @@ void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter)
|
|||
/* IDXGIAdapter */
|
||||
struct dxgi_adapter
|
||||
{
|
||||
IWineDXGIAdapter IWineDXGIAdapter_iface;
|
||||
IDXGIAdapter1 IDXGIAdapter1_iface;
|
||||
IWineDXGIFactory *parent;
|
||||
LONG refcount;
|
||||
UINT ordinal;
|
||||
|
@ -122,6 +124,7 @@ struct dxgi_adapter
|
|||
};
|
||||
|
||||
HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, IWineDXGIFactory *parent, UINT ordinal) DECLSPEC_HIDDEN;
|
||||
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* IDXGISwapChain */
|
||||
struct dxgi_swapchain
|
||||
|
|
|
@ -77,7 +77,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
|
|||
|
||||
for (i = 0; i < This->adapter_count; ++i)
|
||||
{
|
||||
IWineDXGIAdapter_Release(This->adapters[i]);
|
||||
IDXGIAdapter1_Release(This->adapters[i]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->adapters);
|
||||
|
||||
|
@ -357,7 +357,7 @@ 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;
|
||||
|
@ -373,12 +373,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;
|
||||
|
|
|
@ -28,16 +28,6 @@ interface IWineDXGIFactory : IDXGIFactory1
|
|||
struct wined3d *get_wined3d();
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(ab1de34c-2963-4ffd-8493-40f580e510e5)
|
||||
]
|
||||
interface IWineDXGIAdapter : IDXGIAdapter1
|
||||
{
|
||||
UINT get_ordinal();
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
|
|
Loading…
Reference in New Issue