Commit d429aaa9 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Verify the viewport belongs to the device on execute buffer execution.

parent 9edeb22c
......@@ -515,8 +515,8 @@ HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer,
IDirect3DDeviceImpl *device, D3DEXECUTEBUFFERDESC *desc) DECLSPEC_HIDDEN;
/* The execute function */
void IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
IDirect3DDeviceImpl *Device, IDirect3DViewportImpl *ViewportImpl) DECLSPEC_HIDDEN;
HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *execute_buffer,
IDirect3DDeviceImpl *device, IDirect3DViewportImpl *viewport) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirect3DVertexBuffer
......
......@@ -718,6 +718,7 @@ IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
IDirect3DDeviceImpl *This = device_from_device1(iface);
IDirect3DExecuteBufferImpl *Direct3DExecuteBufferImpl = (IDirect3DExecuteBufferImpl *)ExecuteBuffer;
IDirect3DViewportImpl *Direct3DViewportImpl = (IDirect3DViewportImpl *)Viewport;
HRESULT hr;
TRACE("iface %p, buffer %p, viewport %p, flags %#x.\n", iface, ExecuteBuffer, Viewport, Flags);
......@@ -726,10 +727,10 @@ IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
/* Execute... */
EnterCriticalSection(&ddraw_cs);
IDirect3DExecuteBufferImpl_Execute(Direct3DExecuteBufferImpl, This, Direct3DViewportImpl);
hr = d3d_execute_buffer_execute(Direct3DExecuteBufferImpl, This, Direct3DViewportImpl);
LeaveCriticalSection(&ddraw_cs);
return D3D_OK;
return hr;
}
/*****************************************************************************
......
......@@ -68,10 +68,8 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) {
* Viewport: Viewport for this operation
*
*****************************************************************************/
void
IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
IDirect3DDeviceImpl *lpDevice,
IDirect3DViewportImpl *lpViewport)
HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
IDirect3DDeviceImpl *lpDevice, IDirect3DViewportImpl *lpViewport)
{
/* DWORD bs = This->desc.dwBufferSize; */
DWORD vs = This->data.dwVertexOffset;
......@@ -81,10 +79,14 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
char *instr = (char *)This->desc.lpData + is;
/* Should check if the viewport was added or not to the device */
if (lpViewport->active_device != lpDevice)
{
WARN("Viewport %p active device is %p.\n",
lpViewport, lpViewport->active_device);
return DDERR_INVALIDPARAMS;
}
/* Activate the viewport */
lpViewport->active_device = lpDevice;
viewport_activate(lpViewport, FALSE);
TRACE("ExecuteData :\n");
......@@ -551,7 +553,7 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
}
end_of_buffer:
;
return D3D_OK;
}
/*****************************************************************************
......
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