Question

Now I can get backbuffer pointer called pBackBuffer by

m_pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, 
    IREF_GETPPTR(pBackBuffer,IDirect3DSurface9));

And then create a surface called pSurfTemp in syetem memory by

m_pDevice->CreateOffscreenPlainSurface(
    g_Proc.m_Stats.m_SizeWnd.cx, g_Proc.m_Stats.m_SizeWnd.cy, 
    s_bbFormat, D3DPOOL_SYSTEMMEM, 
    IREF_GETPPTR(pSurfTemp,IDirect3DSurface9), NULL );

Then I get the back buffer data by

m_pDevice->GetRenderTargetData(pBackBuffer, pSurfTemp);

Data seems transforming like this: videoMemory->systemMemory

Since next step is to operate the data in video memory again, it will copy it from system memory back into video memory. It wastes time.

I want to copy the data inside video memory, How can I do it?

Était-ce utile?

La solution

If I understood right, you will want to CreateOffscreenPlainSurface() with D3DPOOL_DEFAULT flag, so driver will choose appropriate memory location automatically. But it never guaranteed that it always will be videocard's on-board memory.

By the way, premature optimization is the root of all evil. =)

Edit: Another option is to switch API from DirectX 9 (which is obsolete) to DirectX 11, which allows much more precise resources manipulations. Also, OpenGL goes somewhere in between. Both, is a huge code rewrite.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top