Must copy static const D3DVERTEXELEMENT9 into dynamically alllocated D3DVERTEXELEMENT9 * before pointer passed correctly in Wine?

Nicolas Le Cam niko.lecam at gmail.com
Tue Sep 7 03:41:55 CDT 2010


2010/9/7 misha680 <misha680 at gmail.com>

>
> Sorry for reposting - apparently my original nabble link did not work :(
>
> ---
>
> Dear All:
>
> Sorry to bother... I am working on a D3DXCreateMesh/ID3DXMesh patch, and I
> encountered a very strange error.
>
> Specifically, it seems that when passing a LPD3DVERTEXELEMENT9 * parameter
> to D3DXCreateMesh,
> a) in Windows - one can create
>
>    static const D3DVERTEXELEMENT9 decl1[3] = {
>        {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
> D3DDECLUSAGE_POSITION, 0},
>        {0, 0xC, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
> D3DDECLUSAGE_NORMAL, 0},
>        D3DDECL_END(), };
>
> and pass (LPD3DVERTEXELEMENT9 *)&decl1 directly.
>
> b) in Wine tests - I must first allocate a D3DVERTELEMENT9 *, then call
> HeapAlloc, and finally copy my original decl1 and pass &decl (pointer to
> newly allocated structure) for it to work. Any ideas?
>
> Here is my git diff
> http://wine.1045685.n5.nabble.com/file/n2805603/patch patch
>
> Thx
> Misha
>
> --
> View this message in context:
> http://wine.1045685.n5.nabble.com/Must-copy-static-const-D3DVERTEXELEMENT9-into-dynamically-alllocated-D3DVERTEXELEMENT9-before-pointe-tp2805603p2805603.html
> Sent from the Wine - Devel mailing list archive at Nabble.com.
>
>
> Hi Misha,

It's currently a stub in wine [1] and tests are using a static const
D3DVERTEXELEMENT9 array as parameter [2] so it should be because of your
modified D3DXCreateMesh implementation which isn't visible in your patch.

[1]
http://source.winehq.org/git/wine.git/?a=blob;f=dlls/d3dx9_36/mesh.c#l586
[2]
http://source.winehq.org/git/wine.git/?a=blob;f=dlls/d3dx9_36/tests/mesh.c#l988

-- 
Nicolas Le Cam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20100907/e81b71fb/attachment.htm>


More information about the wine-devel mailing list