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

Michael Mc Donnell michael at mcdonnell.dk
Wed May 25 02:53:37 CDT 2011


On Tue, May 24, 2011 at 8:32 PM, Stefan Dösinger <stefandoesinger at gmx.at> wrote:
> 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.

Yeah it might not be a problem at all. I'll give it a quick second
look to see if it's possible to cache things. I anyway need to read
some more code too to see exactly how the APIs interact.

>> 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.

Ok good, I started to doubt this last night. I'll remove it and try to
get a better sense of how the API works.

>> > *) 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.

Ok thanks I'll do that.

>> > *) 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.

Ok :-) I don't have any strong feelings about it, so I'll just follow
your convention until somebody complains.



More information about the wine-devel mailing list