wined3d: Just return the buffer from wined3d_device_get_index_buffer().
This commit is contained in:
parent
a3e28f6ce5
commit
c8f4ca315e
|
@ -2367,9 +2367,8 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
|
|||
IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
struct wined3d_buffer *wined3d_buffer = NULL;
|
||||
struct wined3d_buffer *wined3d_buffer;
|
||||
struct d3d8_indexbuffer *buffer_impl;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index);
|
||||
|
||||
|
@ -2379,23 +2378,19 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
|
|||
/* The case from UINT to INT is safe because d3d8 will never set negative values */
|
||||
wined3d_mutex_lock();
|
||||
*base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device);
|
||||
hr = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_buffer);
|
||||
if (SUCCEEDED(hr) && wined3d_buffer)
|
||||
if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device)))
|
||||
{
|
||||
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
||||
*buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;
|
||||
IDirect3DIndexBuffer8_AddRef(*buffer);
|
||||
wined3d_buffer_decref(wined3d_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr))
|
||||
ERR("Failed to get wined3d index buffer, hr %#x.\n", hr);
|
||||
*buffer = NULL;
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface,
|
||||
|
|
|
@ -2539,9 +2539,8 @@ static HRESULT WINAPI d3d9_device_SetIndices(IDirect3DDevice9Ex *iface, IDirect3
|
|||
static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **buffer)
|
||||
{
|
||||
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
|
||||
struct wined3d_buffer *retIndexData = NULL;
|
||||
struct wined3d_buffer *wined3d_buffer;
|
||||
struct d3d9_indexbuffer *buffer_impl;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, buffer %p.\n", iface, buffer);
|
||||
|
||||
|
@ -2549,23 +2548,19 @@ static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3
|
|||
return D3DERR_INVALIDCALL;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_get_index_buffer(device->wined3d_device, &retIndexData);
|
||||
if (SUCCEEDED(hr) && retIndexData)
|
||||
if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device)))
|
||||
{
|
||||
buffer_impl = wined3d_buffer_get_parent(retIndexData);
|
||||
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
||||
*buffer = &buffer_impl->IDirect3DIndexBuffer9_iface;
|
||||
IDirect3DIndexBuffer9_AddRef(*buffer);
|
||||
wined3d_buffer_decref(retIndexData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr))
|
||||
FIXME("Call to GetIndices failed\n");
|
||||
*buffer = NULL;
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d9_device_CreatePixelShader(IDirect3DDevice9Ex *iface,
|
||||
|
|
|
@ -2256,18 +2256,11 @@ void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device,
|
|||
}
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device, struct wined3d_buffer **buffer)
|
||||
struct wined3d_buffer * CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device)
|
||||
{
|
||||
TRACE("device %p, buffer %p.\n", device, buffer);
|
||||
TRACE("device %p.\n", device);
|
||||
|
||||
*buffer = device->stateBlock->state.index_buffer;
|
||||
|
||||
if (*buffer)
|
||||
wined3d_buffer_incref(*buffer);
|
||||
|
||||
TRACE("Returning %p.\n", *buffer);
|
||||
|
||||
return WINED3D_OK;
|
||||
return device->stateBlock->state.index_buffer;
|
||||
}
|
||||
|
||||
/* Method to offer d3d9 a simple way to set the base vertex index without messing with the index buffer */
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
@ cdecl wined3d_device_get_display_mode(ptr long ptr ptr)
|
||||
@ cdecl wined3d_device_get_front_buffer_data(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_gamma_ramp(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_index_buffer(ptr ptr)
|
||||
@ cdecl wined3d_device_get_index_buffer(ptr)
|
||||
@ cdecl wined3d_device_get_light(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_light_enable(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_material(ptr ptr)
|
||||
|
|
|
@ -2125,8 +2125,7 @@ HRESULT __cdecl wined3d_device_get_front_buffer_data(const struct wined3d_device
|
|||
UINT swapchain_idx, struct wined3d_surface *dst_surface);
|
||||
void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device,
|
||||
UINT swapchain_idx, struct wined3d_gamma_ramp *ramp);
|
||||
HRESULT __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device,
|
||||
struct wined3d_buffer **index_buffer);
|
||||
struct wined3d_buffer * __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device,
|
||||
UINT light_idx, struct wined3d_light *light);
|
||||
HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable);
|
||||
|
|
Loading…
Reference in New Issue