From: Henri Verbeet Subject: [PATCH 1/5] dxgi: Implement dxgi_surface_GetDesc(). Message-Id: <1406011464-30644-1-git-send-email-hverbeet@codeweavers.com> Date: Tue, 22 Jul 2014 08:44:20 +0200 --- dlls/d3d10core/texture.c | 8 +++++++- dlls/dxgi/device.c | 3 +-- dlls/dxgi/dxgi_private.h | 5 ++++- dlls/dxgi/surface.c | 12 +++++++++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/dlls/d3d10core/texture.c b/dlls/d3d10core/texture.c index f169190..80ac899 100644 --- a/dlls/d3d10core/texture.c +++ b/dlls/d3d10core/texture.c @@ -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)) diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c index e98a2c0..837c57f 100644 --- a/dlls/dxgi/device.c +++ b/dlls/dxgi/device.c @@ -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); diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index 24d9a26..75126cf 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -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 */ diff --git a/dlls/dxgi/surface.c b/dlls/dxgi/surface.c index 2814742..10daff7 100644 --- a/dlls/dxgi/surface.c +++ b/dlls/dxgi/surface.c @@ -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; } -- 1.7.10.4