diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index e6bfa90e026..c3ad3dae3fe 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1536,29 +1536,10 @@ static void wined3d_device_set_material(struct wined3d_device *device, const str void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset) { - struct wined3d_state *state = device->cs->c.state; - enum wined3d_format_id prev_format; - struct wined3d_buffer *prev_buffer; - unsigned int prev_offset; - TRACE("device %p, buffer %p, format %s, offset %u.\n", device, buffer, debug_d3dformat(format_id), offset); - prev_buffer = state->index_buffer; - prev_format = state->index_format; - prev_offset = state->index_offset; - - if (prev_buffer == buffer && prev_format == format_id && prev_offset == offset) - return; - - if (buffer) - wined3d_buffer_incref(buffer); - state->index_buffer = buffer; - state->index_format = format_id; - state->index_offset = offset; - wined3d_device_context_emit_set_index_buffer(&device->cs->c, buffer, format_id, offset); - if (prev_buffer) - wined3d_buffer_decref(prev_buffer); + wined3d_device_context_set_index_buffer(&device->cs->c, buffer, format_id, offset); } struct wined3d_buffer * CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device, @@ -2372,6 +2353,34 @@ HRESULT CDECL wined3d_device_context_set_stream_source(struct wined3d_device_con return WINED3D_OK; } +void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context *context, + struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset) +{ + struct wined3d_state *state = context->state; + enum wined3d_format_id prev_format; + struct wined3d_buffer *prev_buffer; + unsigned int prev_offset; + + TRACE("context %p, buffer %p, format %s, offset %u.\n", + context, buffer, debug_d3dformat(format_id), offset); + + prev_buffer = state->index_buffer; + prev_format = state->index_format; + prev_offset = state->index_offset; + + if (prev_buffer == buffer && prev_format == format_id && prev_offset == offset) + return; + + if (buffer) + wined3d_buffer_incref(buffer); + state->index_buffer = buffer; + state->index_format = format_id; + state->index_offset = offset; + wined3d_device_context_emit_set_index_buffer(context, buffer, format_id, offset); + if (prev_buffer) + wined3d_buffer_decref(prev_buffer); +} + void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) { TRACE("device %p, shader %p.\n", device, shader); diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index cac0c19bab4..54d4ef4c23c 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -170,6 +170,7 @@ @ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr) @ cdecl wined3d_device_context_set_depth_stencil_state(ptr ptr long) @ cdecl wined3d_device_context_set_depth_stencil_view(ptr ptr) +@ cdecl wined3d_device_context_set_index_buffer(ptr ptr long long) @ cdecl wined3d_device_context_set_predication(ptr ptr long) @ cdecl wined3d_device_context_set_rasterizer_state(ptr ptr) @ cdecl wined3d_device_context_set_rendertarget_view(ptr long ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 3f29b78044e..3937f1f5be2 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2563,6 +2563,8 @@ void __cdecl wined3d_device_context_set_depth_stencil_state(struct wined3d_devic struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref); HRESULT __cdecl wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context, struct wined3d_rendertarget_view *view); +void __cdecl wined3d_device_context_set_index_buffer(struct wined3d_device_context *context, + struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset); void __cdecl wined3d_device_context_set_predication(struct wined3d_device_context *context, struct wined3d_query *predicate, BOOL value); void __cdecl wined3d_device_context_set_rasterizer_state(struct wined3d_device_context *context,