On 04/09/06, Paul Chitescu pchitescu@voip.null.ro wrote:
Changelog: Avoid a segfault in IWineD3DDeviceImpl_ProcessVertices by checking if SrcImpl (parameter pVertexDecl) is NULL.
The function is called from dlls/d3d8/device.c IDirect3DDevice8Impl_ProcessVertices with an explicit NULL as vertex declaration parameter.
Crash was observed in Age of Mythology Trial.
This doesn't look correct to me, the call does effectively nothing for d3d8 now.
On Mon, 4 Sep 2006, H. Verbeet wrote:
On 04/09/06, Paul Chitescu pchitescu@voip.null.ro wrote:
Changelog: Avoid a segfault in IWineD3DDeviceImpl_ProcessVertices by checking if SrcImpl (parameter pVertexDecl) is NULL.
The function is called from dlls/d3d8/device.c IDirect3DDevice8Impl_ProcessVertices with an explicit NULL as vertex declaration parameter.
Crash was observed in Age of Mythology Trial.
This doesn't look correct to me, the call does effectively nothing for d3d8 now.
Well, what do you thing it did before at the line if(SrcImpl->vbo) { ... if SrcImpl is NULL?
I don't understand what the code does but every part of it depends on having a non-NULL SrcImpl. I think screaming bloody murder but continuing is better than crashing.
I agree that the code doesn't look good but at least testing can proceed past this point.
Paul Chitescu
On 04/09/06, Paul Chitescu paulc@voip.null.ro wrote:
Well, what do you thing it did before at the line if(SrcImpl->vbo) { ... if SrcImpl is NULL?
I don't understand what the code does but every part of it depends on having a non-NULL SrcImpl. I think screaming bloody murder but continuing is better than crashing.
Well, no, crashing is preferred over continuing incorrectly. I would have to look into how the function is supposed to work in d3d8, but we should probably figure out where to get SrcImpl in case of d3d8.
Hi,
I don't understand what the code does but every part of it depends on having a non-NULL SrcImpl. I think screaming bloody murder but continuing is better than crashing.
I agree that the code doesn't look good but at least testing can proceed past this point.
For some reason I didn't get that patch, but from consulting the msdn documentation for IDirect3DDevice9::ProcessVertices it looks like ProcessVertices is a bit wrong. It doesn't get a Vertex buffer as in argument, instead it gets a vertex declaration. Furthermore our processvertices implementation doesn't handle vertex shaders.
The msdn page doesn't state explicitly, but I think if the vertex declaration is NULL either the current declaration in the device should be used, or D3DERR_INVALIDCALL returned. This should preferably be tested with a unit test.
I was the one who implemented ProcessVertices, but I only implemented it for Direct3D7 applications, and it is only tested with Half-Life 1 and Anarchy Online. It should work for d3d8 and d3d9 apps with the fixed function pipeline, but not with shaders.