Commit 010ff106 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Implement d3d10_device_DrawInstanced().

parent a33d3ad4
......@@ -304,9 +304,14 @@ static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device1 *iface,
UINT instance_vertex_count, UINT instance_count,
UINT start_vertex_location, UINT start_instance_location)
{
FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
"\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
struct d3d10_device *device = impl_from_ID3D10Device(iface);
TRACE("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
"start_instance_location %u.\n", iface, instance_vertex_count, instance_count,
start_vertex_location, start_instance_location);
wined3d_device_draw_primitive_instanced(device->wined3d_device, start_vertex_location,
instance_vertex_count, start_instance_location, instance_count);
}
static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device1 *iface,
......
......@@ -3427,6 +3427,15 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
return WINED3D_OK;
}
void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device,
UINT start_vertex, UINT vertex_count, UINT start_instance, UINT instance_count)
{
TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
device, start_vertex, vertex_count, start_instance, instance_count);
wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
......
......@@ -2890,6 +2890,7 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
USE_GL_FUNC(glDeleteShader) /* OpenGL 2.0 */
USE_GL_FUNC(glDetachShader) /* OpenGL 2.0 */
USE_GL_FUNC(glDisableVertexAttribArray) /* OpenGL 2.0 */
USE_GL_FUNC(glDrawArraysInstanced) /* OpenGL 3.1 */
USE_GL_FUNC(glDrawBuffers) /* OpenGL 2.0 */
USE_GL_FUNC(glDrawElementsInstanced) /* OpenGL 3.1 */
USE_GL_FUNC(glEnableVertexAttribArray) /* OpenGL 2.0 */
......
......@@ -74,8 +74,18 @@ static void drawStridedFast(const struct wined3d_gl_info *gl_info, GLenum primit
}
else
{
gl_info->gl_ops.gl.p_glDrawArrays(primitive_type, start_idx, count);
checkGLcall("glDrawArrays");
if (instance_count)
{
if (start_instance)
FIXME("Start instance (%u) not supported.\n", start_instance);
GL_EXTCALL(glDrawArraysInstanced(primitive_type, start_idx, count, instance_count));
checkGLcall("glDrawArraysInstanced");
}
else
{
gl_info->gl_ops.gl.p_glDrawArrays(primitive_type, start_idx, count);
checkGLcall("glDrawArrays");
}
}
}
......
......@@ -43,6 +43,7 @@
@ cdecl wined3d_device_draw_indexed_primitive(ptr long long)
@ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long)
@ cdecl wined3d_device_draw_primitive(ptr long long)
@ cdecl wined3d_device_draw_primitive_instanced(ptr long long long long)
@ cdecl wined3d_device_end_scene(ptr)
@ cdecl wined3d_device_end_stateblock(ptr ptr)
@ cdecl wined3d_device_evict_managed_resources(ptr)
......
......@@ -2143,6 +2143,8 @@ HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *dev
void __cdecl wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device,
UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count);
HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count);
void __cdecl wined3d_device_draw_primitive_instanced(struct wined3d_device *device,
UINT start_vertex, UINT vertex_count, UINT start_instance, UINT instance_count);
HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock);
void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment