wined3d: Implement wined3d_buffer_create_vb() on top of wined3d_buffer_create().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8623bd3b6b
commit
1377e7a608
|
@ -1464,8 +1464,7 @@ static DWORD resource_access_from_pool(enum wined3d_pool pool)
|
||||||
HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size, DWORD usage, enum wined3d_pool pool,
|
HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size, DWORD usage, enum wined3d_pool pool,
|
||||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
|
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
|
||||||
{
|
{
|
||||||
struct wined3d_buffer *object;
|
struct wined3d_buffer_desc desc;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
TRACE("device %p, size %u, usage %#x, pool %#x, parent %p, parent_ops %p, buffer %p.\n",
|
TRACE("device %p, size %u, usage %#x, pool %#x, parent %p, parent_ops %p, buffer %p.\n",
|
||||||
device, size, usage, pool, parent, parent_ops, buffer);
|
device, size, usage, pool, parent, parent_ops, buffer);
|
||||||
|
@ -1479,25 +1478,14 @@ HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size,
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
desc.byte_width = size;
|
||||||
if (!object)
|
desc.usage = usage;
|
||||||
{
|
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
|
||||||
*buffer = NULL;
|
desc.access = resource_access_from_pool(pool);
|
||||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
desc.misc_flags = 0;
|
||||||
}
|
desc.structure_byte_stride = 0;
|
||||||
|
|
||||||
if (FAILED(hr = buffer_init(object, device, size, usage, WINED3DFMT_UNKNOWN,
|
return wined3d_buffer_create(device, &desc, NULL, parent, parent_ops, buffer);
|
||||||
resource_access_from_pool(pool), WINED3D_BIND_VERTEX_BUFFER, NULL, parent, parent_ops)))
|
|
||||||
{
|
|
||||||
WARN("Failed to initialize buffer, hr %#x.\n", hr);
|
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("Created buffer %p.\n", object);
|
|
||||||
*buffer = object;
|
|
||||||
|
|
||||||
return WINED3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, DWORD usage, enum wined3d_pool pool,
|
HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, DWORD usage, enum wined3d_pool pool,
|
||||||
|
|
Loading…
Reference in New Issue