GSoC-2011: Implement Missing Mesh Functions in Wine’s D3DX9

Stefan Dösinger stefandoesinger at gmx.at
Tue May 24 13:32:10 CDT 2011


On Tuesday 24 May 2011 19:56:06 Michael Mc Donnell wrote:

> Sorry I phrased that in a wrong way. In the UpdateSemantics function I
> call IDirect3DDevice9_CreateVertexDeclaration which allocates a new
> Vertex Declaration on the heap. 
Is there an alternative? I guess you could cache existing declarations. The 
d3d9 API doesn't give you an option to reuse an existing declaration.

I doubt apps will regularly change the declaration, usually this doesn't make 
sense without also changing the data. Of course that doesn't mean there isn't 
a broken app out there that does this.

> I also noticed that I didn't call
> IDirect3DDevice9_SetVertexDeclaration. I've added it to stick with the
> defined locking scheme.
Locking scheme? I've just started reading into into the Mesh API, but I don't 
think you're supposed to apply the declaration until the mesh is used for 
drawing.

> > *) In your first test you forgot to check the HeapAlloc result.
> 
> Ok, I'll return E_OUTOFMEMORY in that case.
I guess the callers will only abort the tests if NewTestContext fails, so I 
think the NULL / non-NULL return value was better.

> Should I try to make some more invalid
> D3DVERTEXELEMENT9 arrays to see if I can provoke an error?
I was thinking about something that would make CreateVertexDeclaration fail, 
e.g. declaring a usage+usage index twice or using an undefined type. 
dlls/d3d9/vertexdeclaration.c and dlls/wined3d/vertexdeclaration.c check for a 
few error conditions in their vertexdeclaration_init functions. Just pick one 
of them(no need to check all of them)

But watch out that you don't open a can of worms here. Our 
CreateVertexDeclaration probably doesn't catch all error conditions. I 
recommend that you pick one it does catch, otherwise you'll have to fix 
d3d9.dll and wined3d.dll too for a small test.

> > *) In the wined3d code(and its client libs) Henri and I avoid structure
> > typedefs. The existing d3dx9 code has a few of them. I'm ok with either
> > way, but maybe you and the other d3dx9 devs want to go the wined3d way.
> 
> Sure I can change them. So just normal structs? Is it to keep the
> namespace clean?
Henri started with this change, I think keeping the namespace clean was a 
consideration. What you do is up to you and the other devs working on d3dx9. 
I'm only suggesting that you discuss the code style and agree on a format.

Either way it is a fairly minor point IMO, but it tends to end up in holy war.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110524/49c3c29a/attachment.pgp>


More information about the wine-devel mailing list