I am writing a function that brings the content of a offscreen surface to the screen. The function is called after a frame finished rendering to the offscreen surface. Using Direct3D, the frame rate is much lower than using DirectDraw and the result animation jitters, which is very annoying. I'm wondering if there is a way to achieve same frame rate. Here is how I did it:
In DirectDraw, I use the Blt functiton to copy the offscreen surface directly to the onscreen surface:
directDrawObj->GetVerticalBlankStatus(&s);
if (s == FALSE)
directDrawObj->WaitForVerticalBlank( DDWAITVB_BLOCKBEGIN, NULL );
HRESULT hr = screenSurface->Blt(&dstR, offscreenSurface, &srcR, DDBLT_WAIT, NULL );
In Direct3D, the surface is copied to the backbuffer and than present. I am Using D3DPRESENT_INTERVAL_ONE, D3DSWAPEFFECT_DISCARD:
LPDIRECT3DSURFACE9 offscreenPlainSurface;
LPDIRECT3DSURFACE9 backSurface;
d3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backSurface);
d3dDevice->StretchRect(offscreenPlainSurface, srcR, backSurface, dstR);
d3dDevice->Present(dstR, dstR, NULL, NULL);
Comparing Direct3D method to DirectDraw method, the frame rate drop about 50% which kinda can be expected. I've also tried D3DSWAPEFFECT_FLIP, and it didn't help much there.
Is there a way to solve this problem?
Thanks in advance.