Commit d17bd8d8 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi: Implement dxgi_surface_GetDesc().

parent 20ef8d29
......@@ -253,6 +253,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
if (desc->MipLevels == 1 && desc->ArraySize == 1)
{
DXGI_SURFACE_DESC surface_desc;
IWineDXGIDevice *wine_device;
if (FAILED(hr = ID3D10Device1_QueryInterface(&device->ID3D10Device1_iface, &IID_IWineDXGIDevice,
......@@ -262,7 +263,12 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
return E_FAIL;
}
hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
surface_desc.Width = desc->Width;
surface_desc.Height = desc->Height;
surface_desc.Format = desc->Format;
surface_desc.SampleDesc = desc->SampleDesc;
hr = IWineDXGIDevice_create_surface(wine_device, &surface_desc, 0, NULL,
(IUnknown *)&texture->ID3D10Texture2D_iface, (void **)&texture->dxgi_surface);
IWineDXGIDevice_Release(wine_device);
if (FAILED(hr))
......
......@@ -276,8 +276,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);
......
......@@ -142,8 +142,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 */
......@@ -154,9 +154,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)
......@@ -200,13 +204,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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment