On 16/04/07, Stefan Dösinger stefan@codeweavers.com wrote:
I have hope that this fixes the converted decl issues finally(appart of sorting the array, which will be another patch)
- convertedDecls = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirect3DVertexDeclaration9 *) * (This->numConvertedDecls + 1));
- if(!convertedDecls) {
/* This will destroy it */
IDirect3DVertexDeclaration9_Release(pDecl);
return NULL;
- }
- memcpy(convertedDecls, This->convertedDecls, sizeof(IDirect3DVertexDeclaration9 *) * (This->numConvertedDecls));
- HeapFree(GetProcessHeap(), 0, This->convertedDecls);
Growing the array by a single element each time looks a bit expensive. Also note that you could use HeapReAlloc there.
Growing the array by a single element each time looks a bit expensive. Also note that you could use HeapReAlloc there.
Well, there won't be much growing operation since the number of possible FVF code combinations is limited and I expect all the fvf codes to be used somewhen in the first frame, thus don't cause a performance penality later.
I want to send another patch which makes the array sorted today, and with that growing by more than one element or using HeapReAlloc won't buy us much since we have to iterate over the whole existing array anyway(to search for the place, and shift the bigger elements).