d3d11: Add ID3D11Texture2D stub interface.
This commit is contained in:
parent
7f2ebb337d
commit
06ca9e226d
@ -87,6 +87,7 @@ HRESULT parse_dxbc(const char *data, SIZE_T data_size,
|
|||||||
/* ID3D10Texture2D */
|
/* ID3D10Texture2D */
|
||||||
struct d3d10_texture2d
|
struct d3d10_texture2d
|
||||||
{
|
{
|
||||||
|
ID3D11Texture2D ID3D11Texture2D_iface;
|
||||||
ID3D10Texture2D ID3D10Texture2D_iface;
|
ID3D10Texture2D ID3D10Texture2D_iface;
|
||||||
LONG refcount;
|
LONG refcount;
|
||||||
|
|
||||||
@ -97,6 +98,11 @@ struct d3d10_texture2d
|
|||||||
ID3D10Device1 *device;
|
ID3D10Device1 *device;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline struct d3d10_texture2d *impl_from_ID3D10Texture2D(ID3D10Texture2D *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, struct d3d10_texture2d, ID3D10Texture2D_iface);
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d_device *device,
|
HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d_device *device,
|
||||||
const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *initial_data) DECLSPEC_HIDDEN;
|
const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *initial_data) DECLSPEC_HIDDEN;
|
||||||
struct d3d10_texture2d *unsafe_impl_from_ID3D10Texture2D(ID3D10Texture2D *iface) DECLSPEC_HIDDEN;
|
struct d3d10_texture2d *unsafe_impl_from_ID3D10Texture2D(ID3D10Texture2D *iface) DECLSPEC_HIDDEN;
|
||||||
|
@ -2888,6 +2888,7 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic
|
|||||||
struct d3d_device *device = device_from_wined3d_device_parent(device_parent);
|
struct d3d_device *device = device_from_wined3d_device_parent(device_parent);
|
||||||
struct wined3d_resource *sub_resource;
|
struct wined3d_resource *sub_resource;
|
||||||
struct d3d10_texture2d *texture;
|
struct d3d10_texture2d *texture;
|
||||||
|
ID3D10Texture2D *texture_iface;
|
||||||
D3D10_TEXTURE2D_DESC desc;
|
D3D10_TEXTURE2D_DESC desc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@ -2909,16 +2910,18 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic
|
|||||||
desc.MiscFlags = 0;
|
desc.MiscFlags = 0;
|
||||||
|
|
||||||
if (FAILED(hr = d3d10_device_CreateTexture2D(&device->ID3D10Device1_iface,
|
if (FAILED(hr = d3d10_device_CreateTexture2D(&device->ID3D10Device1_iface,
|
||||||
&desc, NULL, (ID3D10Texture2D **)&texture)))
|
&desc, NULL, &texture_iface)))
|
||||||
{
|
{
|
||||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
texture = impl_from_ID3D10Texture2D(texture_iface);
|
||||||
|
|
||||||
sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, 0);
|
sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, 0);
|
||||||
*surface = wined3d_surface_from_resource(sub_resource);
|
*surface = wined3d_surface_from_resource(sub_resource);
|
||||||
wined3d_surface_incref(*surface);
|
wined3d_surface_incref(*surface);
|
||||||
ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
|
ID3D10Texture2D_Release(texture_iface);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -24,59 +24,182 @@
|
|||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
|
||||||
|
|
||||||
static inline struct d3d10_texture2d *impl_from_ID3D10Texture2D(ID3D10Texture2D *iface)
|
/* ID3D11Texture2D methods */
|
||||||
|
|
||||||
|
static inline struct d3d10_texture2d *impl_from_ID3D11Texture2D(ID3D11Texture2D *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, struct d3d10_texture2d, ID3D10Texture2D_iface);
|
return CONTAINING_RECORD(iface, struct d3d10_texture2d, ID3D11Texture2D_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IUnknown methods */
|
static HRESULT STDMETHODCALLTYPE d3d11_texture2d_QueryInterface(ID3D11Texture2D *iface, REFIID riid, void **object)
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D *iface, REFIID riid, void **object)
|
|
||||||
{
|
{
|
||||||
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
|
struct d3d10_texture2d *texture = impl_from_ID3D11Texture2D(iface);
|
||||||
|
|
||||||
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_ID3D10Texture2D)
|
if (IsEqualGUID(riid, &IID_ID3D11Texture2D)
|
||||||
|| IsEqualGUID(riid, &IID_ID3D10Resource)
|
|| IsEqualGUID(riid, &IID_ID3D11Resource)
|
||||||
|| IsEqualGUID(riid, &IID_ID3D10DeviceChild)
|
|| IsEqualGUID(riid, &IID_ID3D11DeviceChild)
|
||||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||||
{
|
{
|
||||||
IUnknown_AddRef(iface);
|
*object = &texture->ID3D11Texture2D_iface;
|
||||||
*object = iface;
|
IUnknown_AddRef((IUnknown *)*object);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
else if (IsEqualGUID(riid, &IID_ID3D10Texture2D)
|
||||||
|
|| IsEqualGUID(riid, &IID_ID3D10Resource)
|
||||||
|
|| IsEqualGUID(riid, &IID_ID3D10DeviceChild))
|
||||||
|
{
|
||||||
|
*object = &texture->ID3D10Texture2D_iface;
|
||||||
|
IUnknown_AddRef((IUnknown *)*object);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->dxgi_surface)
|
if (texture->dxgi_surface)
|
||||||
{
|
{
|
||||||
TRACE("Forwarding to dxgi surface\n");
|
TRACE("Forwarding to dxgi surface.\n");
|
||||||
return IUnknown_QueryInterface(This->dxgi_surface, riid, object);
|
return IUnknown_QueryInterface(texture->dxgi_surface, riid, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||||
|
|
||||||
*object = NULL;
|
*object = NULL;
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE d3d10_texture2d_AddRef(ID3D10Texture2D *iface)
|
static ULONG STDMETHODCALLTYPE d3d11_texture2d_AddRef(ID3D11Texture2D *iface)
|
||||||
{
|
{
|
||||||
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
|
struct d3d10_texture2d *texture = impl_from_ID3D11Texture2D(iface);
|
||||||
ULONG refcount = InterlockedIncrement(&This->refcount);
|
ULONG refcount = InterlockedIncrement(&texture->refcount);
|
||||||
|
|
||||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
TRACE("%p increasing refcount to %u.\n", texture, refcount);
|
||||||
|
|
||||||
if (refcount == 1)
|
if (refcount == 1)
|
||||||
{
|
{
|
||||||
ID3D10Device1_AddRef(This->device);
|
ID3D10Device1_AddRef(texture->device);
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d_texture_incref(This->wined3d_texture);
|
wined3d_texture_incref(texture->wined3d_texture);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ULONG STDMETHODCALLTYPE d3d11_texture2d_Release(ID3D11Texture2D *iface)
|
||||||
|
{
|
||||||
|
struct d3d10_texture2d *texture = impl_from_ID3D11Texture2D(iface);
|
||||||
|
ULONG refcount = InterlockedDecrement(&texture->refcount);
|
||||||
|
|
||||||
|
TRACE("%p decreasing refcount to %u.\n", texture, refcount);
|
||||||
|
|
||||||
|
if (!refcount)
|
||||||
|
{
|
||||||
|
ID3D10Device1 *device = texture->device;
|
||||||
|
|
||||||
|
wined3d_mutex_lock();
|
||||||
|
wined3d_texture_decref(texture->wined3d_texture);
|
||||||
|
wined3d_mutex_unlock();
|
||||||
|
/* Release the device last, it may cause the wined3d device to be
|
||||||
|
* destroyed. */
|
||||||
|
ID3D10Device1_Release(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
return refcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE d3d11_texture2d_GetDevice(ID3D11Texture2D *iface, ID3D11Device **device)
|
||||||
|
{
|
||||||
|
FIXME("iface %p, device %p stub!\n", iface, device);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT STDMETHODCALLTYPE d3d11_texture2d_GetPrivateData(ID3D11Texture2D *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);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT STDMETHODCALLTYPE d3d11_texture2d_SetPrivateData(ID3D11Texture2D *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);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT STDMETHODCALLTYPE d3d11_texture2d_SetPrivateDataInterface(ID3D11Texture2D *iface,
|
||||||
|
REFGUID guid, const IUnknown *data)
|
||||||
|
{
|
||||||
|
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE d3d11_texture2d_GetType(ID3D11Texture2D *iface,
|
||||||
|
D3D11_RESOURCE_DIMENSION *resource_dimension)
|
||||||
|
{
|
||||||
|
TRACE("iface %p, resource_dimension %p.\n", iface, resource_dimension);
|
||||||
|
|
||||||
|
*resource_dimension = D3D11_RESOURCE_DIMENSION_TEXTURE2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE d3d11_texture2d_SetEvictionPriority(ID3D11Texture2D *iface, UINT eviction_priority)
|
||||||
|
{
|
||||||
|
FIXME("iface %p, eviction_priority %#x stub!\n", iface, eviction_priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT STDMETHODCALLTYPE d3d11_texture2d_GetEvictionPriority(ID3D11Texture2D *iface)
|
||||||
|
{
|
||||||
|
FIXME("iface %p stub!\n", iface);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE d3d11_texture2d_GetDesc(ID3D11Texture2D *iface, D3D11_TEXTURE2D_DESC *desc)
|
||||||
|
{
|
||||||
|
FIXME("iface %p, desc %p stub!\n", iface, desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct ID3D11Texture2DVtbl d3d11_texture2d_vtbl =
|
||||||
|
{
|
||||||
|
/* IUnknown methods */
|
||||||
|
d3d11_texture2d_QueryInterface,
|
||||||
|
d3d11_texture2d_AddRef,
|
||||||
|
d3d11_texture2d_Release,
|
||||||
|
/* ID3D11DeviceChild methods */
|
||||||
|
d3d11_texture2d_GetDevice,
|
||||||
|
d3d11_texture2d_GetPrivateData,
|
||||||
|
d3d11_texture2d_SetPrivateData,
|
||||||
|
d3d11_texture2d_SetPrivateDataInterface,
|
||||||
|
/* ID3D11Resource methods */
|
||||||
|
d3d11_texture2d_GetType,
|
||||||
|
d3d11_texture2d_SetEvictionPriority,
|
||||||
|
d3d11_texture2d_GetEvictionPriority,
|
||||||
|
/* ID3D11Texture2D methods */
|
||||||
|
d3d11_texture2d_GetDesc,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* IUnknown methods */
|
||||||
|
|
||||||
|
static HRESULT STDMETHODCALLTYPE d3d10_texture2d_QueryInterface(ID3D10Texture2D *iface, REFIID riid, void **object)
|
||||||
|
{
|
||||||
|
struct d3d10_texture2d *texture = impl_from_ID3D10Texture2D(iface);
|
||||||
|
|
||||||
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
||||||
|
|
||||||
|
return d3d11_texture2d_QueryInterface(&texture->ID3D11Texture2D_iface, riid, object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG STDMETHODCALLTYPE d3d10_texture2d_AddRef(ID3D10Texture2D *iface)
|
||||||
|
{
|
||||||
|
struct d3d10_texture2d *texture = impl_from_ID3D10Texture2D(iface);
|
||||||
|
|
||||||
|
TRACE("iface %p.\n", iface);
|
||||||
|
|
||||||
|
return d3d11_texture2d_AddRef(&texture->ID3D11Texture2D_iface);
|
||||||
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d10_texture2d_wined3d_object_released(void *parent)
|
static void STDMETHODCALLTYPE d3d10_texture2d_wined3d_object_released(void *parent)
|
||||||
{
|
{
|
||||||
struct d3d10_texture2d *This = parent;
|
struct d3d10_texture2d *This = parent;
|
||||||
@ -88,24 +211,11 @@ static void STDMETHODCALLTYPE d3d10_texture2d_wined3d_object_released(void *pare
|
|||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
|
static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
|
||||||
{
|
{
|
||||||
struct d3d10_texture2d *This = impl_from_ID3D10Texture2D(iface);
|
struct d3d10_texture2d *texture = impl_from_ID3D10Texture2D(iface);
|
||||||
ULONG refcount = InterlockedDecrement(&This->refcount);
|
|
||||||
|
|
||||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
TRACE("iface %p.\n", iface);
|
||||||
|
|
||||||
if (!refcount)
|
return d3d11_texture2d_Release(&texture->ID3D11Texture2D_iface);
|
||||||
{
|
|
||||||
ID3D10Device1 *device = This->device;
|
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
|
||||||
wined3d_texture_decref(This->wined3d_texture);
|
|
||||||
wined3d_mutex_unlock();
|
|
||||||
/* Release the device last, it may cause the wined3d device to be
|
|
||||||
* destroyed. */
|
|
||||||
ID3D10Device1_Release(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
return refcount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ID3D10DeviceChild methods */
|
/* ID3D10DeviceChild methods */
|
||||||
@ -317,6 +427,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d_device
|
|||||||
unsigned int levels;
|
unsigned int levels;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
texture->ID3D11Texture2D_iface.lpVtbl = &d3d11_texture2d_vtbl;
|
||||||
texture->ID3D10Texture2D_iface.lpVtbl = &d3d10_texture2d_vtbl;
|
texture->ID3D10Texture2D_iface.lpVtbl = &d3d10_texture2d_vtbl;
|
||||||
texture->refcount = 1;
|
texture->refcount = 1;
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user