d3d10core: Set the initial buffer data, when present.
This commit is contained in:
parent
0591442469
commit
4ccbc948a1
|
@ -620,7 +620,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
|
|||
wined3d_desc.misc_flags = desc->MiscFlags;
|
||||
|
||||
hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
|
||||
(IUnknown *)object, &object->wined3d_buffer);
|
||||
data ? data->pSysMem : NULL, (IUnknown *)object, &object->wined3d_buffer);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("CreateBuffer failed, returning %#x\n", hr);
|
||||
|
|
|
@ -435,13 +435,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetParent(IWineD3DDevice *iface, IUnkno
|
|||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface,
|
||||
struct wined3d_buffer_desc *desc, IUnknown *parent, IWineD3DBuffer **buffer)
|
||||
struct wined3d_buffer_desc *desc, const void *data, IUnknown *parent, IWineD3DBuffer **buffer)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
struct wined3d_buffer *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, desc %p, parent %p, buffer %p\n", iface, desc, parent, buffer);
|
||||
TRACE("iface %p, desc %p, data %p, parent %p, buffer %p\n", iface, desc, data, parent, buffer);
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
|
@ -471,6 +471,29 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface,
|
|||
TRACE("size %#x, usage=%#x, format %s, memory @ %p, iface @ %p\n", object->resource.size, object->resource.usage,
|
||||
debug_d3dformat(object->resource.format_desc->format), object->resource.allocatedMemory, object);
|
||||
|
||||
if (data)
|
||||
{
|
||||
BYTE *ptr;
|
||||
|
||||
hr = IWineD3DBuffer_Map((IWineD3DBuffer *)object, 0, desc->byte_width, &ptr, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to map buffer, hr %#x\n", hr);
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
memcpy(ptr, data, desc->byte_width);
|
||||
|
||||
hr = IWineD3DBuffer_Unmap((IWineD3DBuffer *)object);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to unmap buffer, hr %#x\n", hr);
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)object);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
*buffer = (IWineD3DBuffer *)object;
|
||||
|
||||
return WINED3D_OK;
|
||||
|
|
|
@ -2909,6 +2909,7 @@ interface IWineD3DDevice : IWineD3DBase
|
|||
{
|
||||
HRESULT CreateBuffer(
|
||||
[in] struct wined3d_buffer_desc *desc,
|
||||
[in] const void *data,
|
||||
[in] IUnknown *parent,
|
||||
[out] IWineD3DBuffer **buffer
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue