Re: d3dx9 [patch 1/2]: Implement D3DXCreatePolygon

2013-08-02 Thread Nozomi Kodama





 De : Matteo Bruni matteo.myst...@gmail.com
À : Nozomi Kodama nozomi.kod...@yahoo.com 
Cc : Wine Devel wine-devel@winehq.org 
Envoyé le : Jeudi 1 août 2013 9h46
Objet : Re: d3dx9 [patch 1/2]: Implement D3DXCreatePolygon
 

2013/8/1 Nozomi Kodama nozomi.kod...@yahoo.com:


+    vertices = HeapAlloc(GetProcessHeap(), 0, 2 * (sides + 1) *
sizeof(D3DXVECTOR3));
+    if (!vertices)
+    {
+        TRACE(Not memory enough for vertex buffer\n);
+        polygon-lpVtbl-Release(polygon);
+        return E_OUTOFMEMORY;
+    }
+
+    hr = polygon-lpVtbl-LockVertexBuffer(polygon, D3DLOCK_DISCARD,
(VOID **)vertices);

Why are you allocating memory and immediately dropping track of it?
Recheck how ID3DXMesh::LockVertexBuffer works.

It is a leftover of my tests about the requested size of the buffer :( 

Also I'm having a deja-vu here, this patch looks suspiciously similar
(up to having this same issue) to one I've already reviewed in the
past.
I don't understand what you mean here. Can you tell more?

I send a newer version. This one should be fine.

Nozomi.


Re: d3dx9 [patch 1/2]: Implement D3DXCreatePolygon

2013-08-01 Thread Matteo Bruni
2013/8/1 Nozomi Kodama nozomi.kod...@yahoo.com:


+vertices = HeapAlloc(GetProcessHeap(), 0, 2 * (sides + 1) *
sizeof(D3DXVECTOR3));
+if (!vertices)
+{
+TRACE(Not memory enough for vertex buffer\n);
+polygon-lpVtbl-Release(polygon);
+return E_OUTOFMEMORY;
+}
+
+hr = polygon-lpVtbl-LockVertexBuffer(polygon, D3DLOCK_DISCARD,
(VOID **)vertices);

Why are you allocating memory and immediately dropping track of it?
Recheck how ID3DXMesh::LockVertexBuffer works.
Also I'm having a deja-vu here, this patch looks suspiciously similar
(up to having this same issue) to one I've already reviewed in the
past.