Commit 9a2b73d3 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Implement d3d11_device_CreateTexture3D().

parent 11cd2dd8
......@@ -130,8 +130,8 @@ struct d3d_texture3d
ID3D11Device *device;
};
HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device,
const D3D11_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN;
HRESULT d3d_texture3d_create(struct d3d_device *device, const D3D11_TEXTURE3D_DESC *desc,
const D3D11_SUBRESOURCE_DATA *data, struct d3d_texture3d **texture) DECLSPEC_HIDDEN;
/* ID3D10Buffer */
struct d3d10_buffer
......
......@@ -92,9 +92,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture2D(ID3D11Device *ifac
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture3D(ID3D11Device *iface,
const D3D11_TEXTURE3D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data, ID3D11Texture3D **texture)
{
FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
struct d3d_device *device = impl_from_ID3D11Device(iface);
struct d3d_texture3d *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
if (FAILED(hr = d3d_texture3d_create(device, desc, data, &object)))
return hr;
*texture = &object->ID3D11Texture3D_iface;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateShaderResourceView(ID3D11Device *iface,
......@@ -2050,10 +2059,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device1 *ifa
TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
d3d11_desc.Width = desc->Width;
d3d11_desc.Height = desc->Height;
d3d11_desc.Depth = desc->Depth;
......@@ -2064,14 +2069,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device1 *ifa
d3d11_desc.CPUAccessFlags = d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(desc->CPUAccessFlags);
d3d11_desc.MiscFlags = d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(desc->MiscFlags);
if (FAILED(hr = d3d_texture3d_init(object, device, &d3d11_desc, data)))
{
WARN("Failed to initialize texture, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
if (FAILED(hr = d3d_texture3d_create(device, &d3d11_desc, (const D3D11_SUBRESOURCE_DATA *)data, &object)))
return hr;
}
TRACE("Created 3D texture %p.\n", object);
*texture = &object->ID3D10Texture3D_iface;
return S_OK;
......
......@@ -897,8 +897,8 @@ static const struct wined3d_parent_ops d3d_texture3d_wined3d_parent_ops =
d3d_texture3d_wined3d_object_released,
};
HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device,
const D3D11_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data)
static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device,
const D3D11_TEXTURE3D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data)
{
struct wined3d_resource_desc wined3d_desc;
unsigned int levels;
......@@ -941,3 +941,25 @@ HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *dev
return S_OK;
}
HRESULT d3d_texture3d_create(struct d3d_device *device, const D3D11_TEXTURE3D_DESC *desc,
const D3D11_SUBRESOURCE_DATA *data, struct d3d_texture3d **texture)
{
struct d3d_texture3d *object;
HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_texture3d_init(object, device, desc, data)))
{
WARN("Failed to initialize texture, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created texture %p.\n", object);
*texture = object;
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