d3d11: Implement d3d11_device_CreateTexture3D().

This commit is contained in:
Józef Kucia 2015-09-01 00:27:36 +02:00 committed by Alexandre Julliard
parent 11cd2dd897
commit 9a2b73d315
3 changed files with 38 additions and 16 deletions

View File

@ -130,8 +130,8 @@ struct d3d_texture3d
ID3D11Device *device; ID3D11Device *device;
}; };
HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device, HRESULT d3d_texture3d_create(struct d3d_device *device, const D3D11_TEXTURE3D_DESC *desc,
const D3D11_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN; const D3D11_SUBRESOURCE_DATA *data, struct d3d_texture3d **texture) DECLSPEC_HIDDEN;
/* ID3D10Buffer */ /* ID3D10Buffer */
struct d3d10_buffer struct d3d10_buffer

View File

@ -92,9 +92,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture2D(ID3D11Device *ifac
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture3D(ID3D11Device *iface, static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture3D(ID3D11Device *iface,
const D3D11_TEXTURE3D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data, ID3D11Texture3D **texture) 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, 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); 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.Width = desc->Width;
d3d11_desc.Height = desc->Height; d3d11_desc.Height = desc->Height;
d3d11_desc.Depth = desc->Depth; 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.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); 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))) if (FAILED(hr = d3d_texture3d_create(device, &d3d11_desc, (const D3D11_SUBRESOURCE_DATA *)data, &object)))
{
WARN("Failed to initialize texture, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr; return hr;
}
TRACE("Created 3D texture %p.\n", object);
*texture = &object->ID3D10Texture3D_iface; *texture = &object->ID3D10Texture3D_iface;
return S_OK; return S_OK;

View File

@ -897,8 +897,8 @@ static const struct wined3d_parent_ops d3d_texture3d_wined3d_parent_ops =
d3d_texture3d_wined3d_object_released, d3d_texture3d_wined3d_object_released,
}; };
HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device, static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device,
const D3D11_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) const D3D11_TEXTURE3D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data)
{ {
struct wined3d_resource_desc wined3d_desc; struct wined3d_resource_desc wined3d_desc;
unsigned int levels; unsigned int levels;
@ -941,3 +941,25 @@ HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *dev
return S_OK; 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;
}