d3d8: Use wined3d_buffer_create() in indexbuffer_init().

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-06 03:04:16 +03:30 committed by Alexandre Julliard
parent a3ca7a308a
commit 9801f09b57
1 changed files with 10 additions and 10 deletions

View File

@ -565,25 +565,25 @@ static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops =
HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device, HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device,
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{ {
enum wined3d_pool wined3d_pool; struct wined3d_buffer_desc desc;
DWORD wined3d_usage;
HRESULT hr; HRESULT hr;
wined3d_pool = pool; desc.byte_width = size;
wined3d_usage = usage & WINED3DUSAGE_MASK; desc.usage = (usage & WINED3DUSAGE_MASK) | WINED3DUSAGE_STATICDECL;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
{ desc.usage |= WINED3DUSAGE_SCRATCH;
wined3d_pool = WINED3D_POOL_SYSTEM_MEM; desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
wined3d_usage |= WINED3DUSAGE_SCRATCH; desc.access = wined3daccess_from_d3dpool(pool);
} desc.misc_flags = 0;
desc.structure_byte_stride = 0;
buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl; buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl;
d3d8_resource_init(&buffer->resource); d3d8_resource_init(&buffer->resource);
buffer->format = wined3dformat_from_d3dformat(format); buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_buffer_create_ib(device->wined3d_device, size, wined3d_usage, wined3d_pool, hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer); &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {