static DWORD WINAPI d3d9_indexbuffer_GetPriority(IDirect3DIndexBuffer9 *iface) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); DWORD priority; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); priority = wined3d_buffer_get_priority(buffer->wined3d_buffer); wined3d_mutex_unlock(); return priority; }
static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, DWORD priority) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); DWORD previous; TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); previous = wined3d_buffer_set_priority(buffer->wined3d_buffer, priority); wined3d_mutex_unlock(); return previous; }
static HRESULT WINAPI d3d9_indexbuffer_GetDevice(IDirect3DIndexBuffer9 *iface, IDirect3DDevice9 **device) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); TRACE("iface %p, device %p.\n", iface, device); *device = (IDirect3DDevice9 *)buffer->parent_device; IDirect3DDevice9_AddRef(*device); TRACE("Returning device %p.\n", *device); return D3D_OK; }
static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags) { IDirect3DIndexBuffer9Impl *buffer = impl_from_IDirect3DIndexBuffer9(iface); HRESULT hr; TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n", iface, offset, size, data, flags); wined3d_mutex_lock(); hr = wined3d_buffer_map(buffer->wineD3DIndexBuffer, offset, size, (BYTE **)data, flags); wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid) { IDirect3DIndexBuffer9Impl *buffer = impl_from_IDirect3DIndexBuffer9(iface); struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer); hr = wined3d_resource_free_private_data(resource, guid); wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size) { IDirect3DIndexBuffer9Impl *buffer = impl_from_IDirect3DIndexBuffer9(iface); struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer); hr = wined3d_resource_get_private_data(resource, guid, data, data_size); wined3d_mutex_unlock(); return hr; }
static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface) { IDirect3DIndexBuffer9Impl *buffer = impl_from_IDirect3DIndexBuffer9(iface); ULONG refcount = InterlockedIncrement(&buffer->ref); TRACE("%p increasing refcount to %u.\n", iface, refcount); if (refcount == 1) { IDirect3DDevice9Ex_AddRef(buffer->parentDevice); wined3d_mutex_lock(); wined3d_buffer_incref(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); } return refcount; }
static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3DINDEXBUFFER_DESC *desc) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); struct wined3d_resource_desc wined3d_desc; struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); desc->Format = d3dformat_from_wined3dformat(buffer->format); desc->Type = D3DRTYPE_INDEXBUFFER; desc->Usage = buffer->usage; desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; return D3D_OK; }
static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface) { IDirect3DIndexBuffer9Impl *buffer = impl_from_IDirect3DIndexBuffer9(iface); ULONG refcount = InterlockedDecrement(&buffer->ref); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) { IDirect3DDevice9Ex *device = buffer->parentDevice; wined3d_mutex_lock(); wined3d_buffer_decref(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ IDirect3DDevice9Ex_Release(device); } return refcount; }
static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); struct wined3d_resource *wined3d_resource; struct wined3d_map_desc wined3d_map_desc; struct wined3d_box wined3d_box = {0}; HRESULT hr; TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n", iface, offset, size, data, flags); wined3d_box.left = offset; wined3d_box.right = offset + size; wined3d_mutex_lock(); wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); hr = wined3d_resource_map(wined3d_resource, 0, &wined3d_map_desc, &wined3d_box, wined3dmapflags_from_d3dmapflags(flags, buffer->usage)); wined3d_mutex_unlock(); *data = wined3d_map_desc.data; return hr; }