Must copy static const D3DVERTEXELEMENT9 into dynamically alllocated D3DVERTEXELEMENT9 * before pointer passed correctly in Wine?
misha680
misha680 at gmail.com
Tue Sep 7 07:43:13 CDT 2010
My apologies if my first patch was unclear.
Here is a slightly modified git diff
http://wine.1045685.n5.nabble.com/file/n2806011/patch patch
along with the relevant make test output
http://wine.1045685.n5.nabble.com/file/n2806011/maketestoutput
maketestoutput
The relevant part of the make test output:
../../../tools/runtest -q -P wine -M d3dx9_36.dll -T ../../.. -p
d3dx9_36_test.exe.so mesh.c && touch mesh.ok
0x684e7c86 (nil)
0x32fcf8 0x123170
And the relevant statements are, in test/mesh.c:
D3DVERTEXELEMENT9 *decl;
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(), };
hr = D3DXCreateMesh(1, 3, D3DXMESH_MANAGED, (LPD3DVERTEXELEMENT9
*)&decl1, NULL, &d3dxmesh);
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x
(D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
decl = HeapAlloc(GetProcessHeap(), 0, sizeof(decl1));
if (!decl)
{
skip("Couldn't create declaration copy\n");
return;
}
memcpy(decl, decl1, sizeof(decl1));
hr = D3DXCreateMesh(1, 3, D3DXMESH_MANAGED, &decl, NULL, &d3dxmesh);
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x
(D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
return;
and in mesh.c:
HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD
options, CONST LPD3DVERTEXELEMENT9 *declaration,
LPDIRECT3DDEVICE9 device, LPD3DXMESH *mesh)
{
printf("%p %p\n", declaration, *declaration);
Now
LPD3DVERTEXELEMENT9 is a D3DVERTEXELEMENT9 *,
http://msdn.microsoft.com/en-us/library/bb172630%28VS.85%29.aspx
so LPD3DVERTEXELEMENT9 * is a D3DVERTEXELEMENT9 **, and to get at the
underlying D3DVERTEXELEMENT9 array, I believe I need to access *declaration,
e.g., (*declaration)[0], [1], etc.
Notably, if I use the HeapAlloc + memcpy approach, the test _fail_ in
Windows (I only tried once fyi), so at the moment it seems like one thing
works in Wine, another in Windows.
Thank you
Misha
--
View this message in context: http://wine.1045685.n5.nabble.com/Must-copy-static-const-D3DVERTEXELEMENT9-into-dynamically-alllocated-D3DVERTEXELEMENT9-before-pointe-tp2805603p2806011.html
Sent from the Wine - Devel mailing list archive at Nabble.com.
More information about the wine-devel
mailing list