dxgi: Implement dxgi_surface_GetDesc() on top of wined3d.
This commit is contained in:
parent
d29f263c79
commit
4a843f2826
|
@ -296,35 +296,6 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
|
|||
wined3d_private_store_init(&texture->private_store);
|
||||
texture->desc = *desc;
|
||||
|
||||
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,
|
||||
(void **)&wine_device)))
|
||||
{
|
||||
ERR("Device should implement IWineDXGIDevice.\n");
|
||||
wined3d_private_store_cleanup(&texture->private_store);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
ERR("Failed to create DXGI surface, returning %#x\n", hr);
|
||||
wined3d_private_store_cleanup(&texture->private_store);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
if (desc->ArraySize != 1)
|
||||
FIXME("Array textures not implemented.\n");
|
||||
if (desc->SampleDesc.Count > 1)
|
||||
|
@ -348,13 +319,35 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
|
|||
&d3d10_texture2d_wined3d_parent_ops, &texture->wined3d_texture)))
|
||||
{
|
||||
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
|
||||
if (texture->dxgi_surface)
|
||||
IUnknown_Release(texture->dxgi_surface);
|
||||
wined3d_private_store_cleanup(&texture->private_store);
|
||||
return hr;
|
||||
}
|
||||
texture->desc.MipLevels = levels;
|
||||
|
||||
if (desc->MipLevels == 1 && desc->ArraySize == 1)
|
||||
{
|
||||
IWineDXGIDevice *wine_device;
|
||||
|
||||
if (FAILED(hr = ID3D10Device1_QueryInterface(&device->ID3D10Device1_iface, &IID_IWineDXGIDevice,
|
||||
(void **)&wine_device)))
|
||||
{
|
||||
ERR("Device should implement IWineDXGIDevice.\n");
|
||||
wined3d_texture_decref(texture->wined3d_texture);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hr = IWineDXGIDevice_create_surface(wine_device, wined3d_texture_get_resource(texture->wined3d_texture),
|
||||
0, NULL, (IUnknown *)&texture->ID3D10Texture2D_iface, (void **)&texture->dxgi_surface);
|
||||
IWineDXGIDevice_Release(wine_device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to create DXGI surface, returning %#x\n", hr);
|
||||
texture->dxgi_surface = NULL;
|
||||
wined3d_texture_decref(texture->wined3d_texture);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
texture->device = &device->ID3D10Device1_iface;
|
||||
ID3D10Device1_AddRef(texture->device);
|
||||
|
||||
|
|
|
@ -256,23 +256,23 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_GetGPUThreadPriority(IWineDXGIDevic
|
|||
|
||||
/* IWineDXGIDevice methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *iface, const DXGI_SURFACE_DESC *desc,
|
||||
DXGI_USAGE usage, const DXGI_SHARED_RESOURCE *shared_resource, IUnknown *outer, void **surface)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *iface,
|
||||
struct wined3d_resource *wined3d_resource, DXGI_USAGE usage,
|
||||
const DXGI_SHARED_RESOURCE *shared_resource, IUnknown *outer, void **surface)
|
||||
{
|
||||
struct dxgi_surface *object;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("iface %p, desc %p, usage %#x, shared_resource %p, outer %p, surface %p partial stub!\n",
|
||||
iface, desc, usage, shared_resource, outer, surface);
|
||||
TRACE("iface %p, wined3d_resource %p, usage %#x, shared_resource %p, outer %p, surface %p.\n",
|
||||
iface, wined3d_resource, usage, shared_resource, outer, surface);
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
{
|
||||
ERR("Failed to allocate DXGI surface object memory\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (FAILED(hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer, desc)))
|
||||
if (FAILED(hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer, wined3d_resource)))
|
||||
{
|
||||
WARN("Failed to initialize surface, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
|
|
|
@ -164,11 +164,10 @@ struct dxgi_surface
|
|||
LONG refcount;
|
||||
struct wined3d_private_store private_store;
|
||||
IDXGIDevice *device;
|
||||
|
||||
DXGI_SURFACE_DESC desc;
|
||||
struct wined3d_resource *wined3d_resource;
|
||||
};
|
||||
|
||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
||||
IUnknown *outer, const DXGI_SURFACE_DESC *desc) DECLSPEC_HIDDEN;
|
||||
IUnknown *outer, struct wined3d_resource *wined3d_resource) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* __WINE_DXGI_PRIVATE_H */
|
||||
|
|
|
@ -164,10 +164,15 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDevice(IDXGISurface *iface, REF
|
|||
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDesc(IDXGISurface *iface, DXGI_SURFACE_DESC *desc)
|
||||
{
|
||||
struct dxgi_surface *surface = impl_from_IDXGISurface(iface);
|
||||
struct wined3d_resource_desc wined3d_desc;
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
*desc = surface->desc;
|
||||
wined3d_resource_get_desc(surface->wined3d_resource, &wined3d_desc);
|
||||
desc->Width = wined3d_desc.width;
|
||||
desc->Height = wined3d_desc.height;
|
||||
desc->Format = dxgi_format_from_wined3dformat(wined3d_desc.format);
|
||||
dxgi_sample_desc_from_wined3d(&desc->SampleDesc, wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -214,7 +219,7 @@ static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl =
|
|||
};
|
||||
|
||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
||||
IUnknown *outer, const DXGI_SURFACE_DESC *desc)
|
||||
IUnknown *outer, struct wined3d_resource *wined3d_resource)
|
||||
{
|
||||
surface->IDXGISurface_iface.lpVtbl = &dxgi_surface_vtbl;
|
||||
surface->IUnknown_iface.lpVtbl = &dxgi_surface_inner_unknown_vtbl;
|
||||
|
@ -222,7 +227,7 @@ HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
|||
wined3d_private_store_init(&surface->private_store);
|
||||
surface->outer_unknown = outer ? outer : &surface->IUnknown_iface;
|
||||
surface->device = device;
|
||||
surface->desc = *desc;
|
||||
surface->wined3d_resource = wined3d_resource;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import "dxgi.idl";
|
|||
interface IWineDXGIDevice : IDXGIDevice
|
||||
{
|
||||
HRESULT create_surface(
|
||||
[in] const DXGI_SURFACE_DESC *desc,
|
||||
[in] struct wined3d_resource *wined3d_resource,
|
||||
[in] DXGI_USAGE usage,
|
||||
[in] const DXGI_SHARED_RESOURCE *shared_resource,
|
||||
[in] IUnknown *outer,
|
||||
|
|
Loading…
Reference in New Issue