Original Post
Hi, I am interested in the virtual texture algorithm for rendering of a large terrain. I am trying some tests to update Direct3D textures at each frames. But there is something strange: On my PC, it is faster to read texture's data directely from Hard Drive than from memory.
D3DLOCKED_RECT lockedRect;
m_TextureId->LockRect(0, &lockedRect, 0, D3DLOCK_DISCARD);
m_HDTextures[0][0].read((char*) lockedRect.pBits , imageSize*imageSize*4);
m_TextureId->UnlockRect(0);
// Where m_HDTextures[0][0] is std::fstream
Is faster than:
D3DLOCKED_RECT lockedRect;
m_TextureId->LockRect(0, &lockedRect, 0, D3DLOCK_DISCARD);
memcpy(lockedRect.pBits, m_FinalImage, imageSize*imageSize*4);
m_TextureId->UnlockRect(0);
// Where m_FinalImage has been read in the beginning of the application
Why ? A copy from memory should be faster than a read from Hard Drive ? Is it something faster than memcpy ?