Original Post
I am implementing a vertex cache system but have hit a problem. Heres the code thn I''ll explain:
In my vertex cache
and is called like:
Now when it gets to the
void CVertexCache::Fill(void *pVertices,UINT pNumVertices,void *pIndices,UINT pNumIndices)
{
void *pBits=NULL;
m_pVB->Lock(m_numVertices*m_stride,pNumVertices*m_stride,&pBits,0);
memcpy(pBits,pVertices,pNumVertices*m_stride);
m_pVB->Unlock();
pBits=NULL;
m_pIB->Lock(m_numIndices*sizeof(WORD),pNumVertices*sizeof(WORD),&pBits,0);
memcpy(&pBits,pIndices,pNumIndices*sizeof(WORD));
m_pIB->Unlock();
m_numVertices+=pNumVertices;
m_numIndices+=pNumIndices;
}
FinalMesh->LockVertexBuffer(0,&verts); FinalMesh->LockIndexBuffer(0,&inds); m_pVertexCache->Fill(verts,FinalMesh->GetNumVertices(),inds,FinalMesh->GetNumFaces()*3); FinalMesh->UnlockIndexBuffer(); FinalMesh->UnlockVertexBuffer();
memcpy(pBits,pVertices,pNumVertices*m_stride);it fails. I''ve checked all HRESULTS (all S_OK), debug doesnt help as it only happens in release mode (in D3D control panel app). Is there anything obvious I''m doing/not doing that anyone might recommend? I''ve been looking at this error for about a week and am tearing my hair out (whats left of it anyway)/ Cheers Neil WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!