d3d10core: Implement d3d10_device_IAGetIndexBuffer().

This commit is contained in:
Henri Verbeet 2012-11-20 22:40:21 +01:00 committed by Alexandre Julliard
parent 4904156946
commit d0d213f7d1
6 changed files with 30 additions and 7 deletions

View File

@ -534,7 +534,25 @@ static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *ifac
static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface, static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset) ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
{ {
FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset); struct d3d10_device *device = impl_from_ID3D10Device(iface);
enum wined3d_format_id wined3d_format;
struct wined3d_buffer *wined3d_buffer;
struct d3d10_buffer *buffer_impl;
TRACE("iface %p, buffer %p, format %p, offset %p.\n", iface, buffer, format, offset);
wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format);
*format = dxgi_format_from_wined3dformat(wined3d_format);
*offset = 0; /* FIXME */
if (!wined3d_buffer)
{
*buffer = NULL;
return;
}
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
*buffer = &buffer_impl->ID3D10Buffer_iface;
ID3D10Buffer_AddRef(*buffer);
} }
static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface, static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,

View File

@ -2302,6 +2302,7 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index) IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
enum wined3d_format_id wined3d_format;
struct wined3d_buffer *wined3d_buffer; struct wined3d_buffer *wined3d_buffer;
struct d3d8_indexbuffer *buffer_impl; struct d3d8_indexbuffer *buffer_impl;
@ -2313,7 +2314,7 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
/* The case from UINT to INT is safe because d3d8 will never set negative values */ /* The case from UINT to INT is safe because d3d8 will never set negative values */
wined3d_mutex_lock(); wined3d_mutex_lock();
*base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device); *base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device);
if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device))) if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format)))
{ {
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer); buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
*buffer = &buffer_impl->IDirect3DIndexBuffer8_iface; *buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;

View File

@ -2483,6 +2483,7 @@ static HRESULT WINAPI d3d9_device_SetIndices(IDirect3DDevice9Ex *iface, IDirect3
static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **buffer) static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **buffer)
{ {
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
enum wined3d_format_id wined3d_format;
struct wined3d_buffer *wined3d_buffer; struct wined3d_buffer *wined3d_buffer;
struct d3d9_indexbuffer *buffer_impl; struct d3d9_indexbuffer *buffer_impl;
@ -2492,7 +2493,7 @@ static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
wined3d_mutex_lock(); wined3d_mutex_lock();
if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device))) if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format)))
{ {
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer); buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
*buffer = &buffer_impl->IDirect3DIndexBuffer9_iface; *buffer = &buffer_impl->IDirect3DIndexBuffer9_iface;

View File

@ -2236,10 +2236,12 @@ void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device,
} }
} }
struct wined3d_buffer * CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device) struct wined3d_buffer * CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device,
enum wined3d_format_id *format)
{ {
TRACE("device %p.\n", device); TRACE("device %p, format %p.\n", device, format);
*format = device->stateBlock->state.index_format;
return device->stateBlock->state.index_buffer; return device->stateBlock->state.index_buffer;
} }

View File

@ -65,7 +65,7 @@
@ cdecl wined3d_device_get_front_buffer_data(ptr long ptr) @ cdecl wined3d_device_get_front_buffer_data(ptr long ptr)
@ cdecl wined3d_device_get_gamma_ramp(ptr long ptr) @ cdecl wined3d_device_get_gamma_ramp(ptr long ptr)
@ cdecl wined3d_device_get_geometry_shader(ptr) @ cdecl wined3d_device_get_geometry_shader(ptr)
@ cdecl wined3d_device_get_index_buffer(ptr) @ cdecl wined3d_device_get_index_buffer(ptr ptr)
@ cdecl wined3d_device_get_light(ptr long ptr) @ cdecl wined3d_device_get_light(ptr long ptr)
@ cdecl wined3d_device_get_light_enable(ptr long ptr) @ cdecl wined3d_device_get_light_enable(ptr long ptr)
@ cdecl wined3d_device_get_material(ptr ptr) @ cdecl wined3d_device_get_material(ptr ptr)

View File

@ -2125,7 +2125,8 @@ HRESULT __cdecl wined3d_device_get_front_buffer_data(const struct wined3d_device
void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device, void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device,
UINT swapchain_idx, struct wined3d_gamma_ramp *ramp); UINT swapchain_idx, struct wined3d_gamma_ramp *ramp);
struct wined3d_shader * __cdecl wined3d_device_get_geometry_shader(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_geometry_shader(const struct wined3d_device *device);
struct wined3d_buffer * __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device); struct wined3d_buffer * __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device,
enum wined3d_format_id *format);
HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device, HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device,
UINT light_idx, struct wined3d_light *light); UINT light_idx, struct wined3d_light *light);
HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable); HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable);