=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d9: Check if valid vertex declaration is set before issuing draw call.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue May 24 11:08:35 CDT 2016
Module: wine
Branch: master
Commit: bd41d53a2334efe1b6d86296e971f0d34de22ad1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bd41d53a2334efe1b6d86296e971f0d34de22ad1
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Tue May 24 10:17:48 2016 +0200
d3d9: Check if valid vertex declaration is set before issuing draw call.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d9/d3d9_private.h | 1 +
dlls/d3d9/device.c | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index a0703ab..b618ff4 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -167,6 +167,7 @@ struct d3d9_device
LONG device_state;
BOOL in_destruction;
BOOL in_scene;
+ BOOL has_vertex_declaration;
UINT implicit_swapchain_count;
struct d3d9_swapchain **implicit_swapchains;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 4bbdd42..6301ae9 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2292,6 +2292,12 @@ static HRESULT WINAPI d3d9_device_DrawPrimitive(IDirect3DDevice9Ex *iface,
iface, primitive_type, start_vertex, primitive_count);
wined3d_mutex_lock();
+ if (!device->has_vertex_declaration)
+ {
+ wined3d_mutex_unlock();
+ WARN("Called without a valid vertex declaration set.\n");
+ return D3DERR_INVALIDCALL;
+ }
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex,
vertex_count_from_primitive_count(primitive_type, primitive_count));
@@ -2313,6 +2319,12 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface
vertex_count, start_idx, primitive_count);
wined3d_mutex_lock();
+ if (!device->has_vertex_declaration)
+ {
+ wined3d_mutex_unlock();
+ WARN("Called without a valid vertex declaration set.\n");
+ return D3DERR_INVALIDCALL;
+ }
wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx,
@@ -2373,6 +2385,13 @@ static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface,
wined3d_mutex_lock();
+ if (!device->has_vertex_declaration)
+ {
+ wined3d_mutex_unlock();
+ WARN("Called without a valid vertex declaration set.\n");
+ return D3DERR_INVALIDCALL;
+ }
+
hr = d3d9_device_prepare_vertex_buffer(device, size);
if (FAILED(hr))
goto done;
@@ -2466,6 +2485,13 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
wined3d_mutex_lock();
+ if (!device->has_vertex_declaration)
+ {
+ wined3d_mutex_unlock();
+ WARN("Called without a valid vertex declaration set.\n");
+ return D3DERR_INVALIDCALL;
+ }
+
hr = d3d9_device_prepare_vertex_buffer(device, vtx_size);
if (FAILED(hr))
goto done;
@@ -2579,6 +2605,7 @@ static HRESULT WINAPI d3d9_device_SetVertexDeclaration(IDirect3DDevice9Ex *iface
wined3d_mutex_lock();
wined3d_device_set_vertex_declaration(device->wined3d_device,
decl_impl ? decl_impl->wined3d_declaration : NULL);
+ device->has_vertex_declaration = !!decl_impl;
wined3d_mutex_unlock();
return D3D_OK;
@@ -2702,6 +2729,7 @@ static HRESULT WINAPI d3d9_device_SetFVF(IDirect3DDevice9Ex *iface, DWORD fvf)
}
wined3d_device_set_vertex_declaration(device->wined3d_device, decl);
+ device->has_vertex_declaration = TRUE;
wined3d_mutex_unlock();
return D3D_OK;
More information about the wine-cvs
mailing list