wined3d: Implement wined3d_buffer_create_ib() 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:
Henri Verbeet 2018-02-04 17:20:55 +03:30 committed by Alexandre Julliard
parent 1377e7a608
commit c0f92bd318
1 changed files with 8 additions and 20 deletions

View File

@ -1491,29 +1491,17 @@ HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size,
HRESULT CDECL wined3d_buffer_create_ib(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)
{
struct wined3d_buffer *object;
HRESULT hr;
struct wined3d_buffer_desc desc;
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);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
*buffer = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}
desc.byte_width = size;
desc.usage = usage | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = resource_access_from_pool(pool);
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
if (FAILED(hr = buffer_init(object, device, size, usage | WINED3DUSAGE_STATICDECL, WINED3DFMT_UNKNOWN,
resource_access_from_pool(pool), WINED3D_BIND_INDEX_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;
return wined3d_buffer_create(device, &desc, NULL, parent, parent_ops, buffer);
}