[PATCH 4/5] d3d10core: Implement d3d10_device_DrawInstanced().
Henri Verbeet
hverbeet at codeweavers.com
Tue Mar 24 03:38:26 CDT 2015
---
dlls/d3d10core/device.c | 9 +++++++--
dlls/wined3d/device.c | 9 +++++++++
dlls/wined3d/directx.c | 1 +
dlls/wined3d/drawprim.c | 14 ++++++++++++--
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 2 ++
6 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index ed59ee6..d8b3d7e 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -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,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 631045a..870e384 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 3667840..13061f4 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -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 */
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 4916c05..c0654a6 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -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");
+ }
}
}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 9de0baf..a79d6a6 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -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)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 116918d..0f70848 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -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);
--
1.7.10.4
More information about the wine-patches
mailing list