D3D: code clean up, nothing special.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4305 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
2c7214f2af
commit
f9d1354c29
|
@ -402,13 +402,13 @@ void EndFrame()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bFrameInProgress = false;
|
bFrameInProgress = false;
|
||||||
|
dev->EndScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Present()
|
void Present()
|
||||||
{
|
{
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
dev->EndScene();
|
|
||||||
dev->Present(NULL, NULL, NULL, NULL);
|
dev->Present(NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,16 +238,62 @@ void CheckForResize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void EFBTextureToD3DBackBuffer(const EFBRectangle& sourceRc)
|
||||||
|
{
|
||||||
|
// Set the backbuffer as the rendering target
|
||||||
|
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
||||||
|
D3D::dev->SetDepthStencilSurface(NULL);
|
||||||
|
|
||||||
void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc)
|
// Blit our render target onto the backbuffer.
|
||||||
|
// TODO: Change to a quad so we can do post processing.
|
||||||
|
TargetRectangle src_rect, dst_rect;
|
||||||
|
src_rect = Renderer::ConvertEFBRectangle(sourceRc);
|
||||||
|
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
||||||
|
|
||||||
|
//LPD3DXSPRITE pSprite=NULL;
|
||||||
|
//D3DXCreateSprite(D3D::dev, &pSprite);
|
||||||
|
//D3DXVECTOR3 pos(0,0,0);
|
||||||
|
//EFBRectangle efbRect;
|
||||||
|
//
|
||||||
|
//pSprite->Begin(D3DXSPRITE_ALPHABLEND);
|
||||||
|
//pSprite->Draw(FBManager::GetEFBColorTexture(efbRect),NULL, NULL, &pos, 0xFFFFFFFF);
|
||||||
|
//pSprite->End();
|
||||||
|
//pSprite->Release();
|
||||||
|
|
||||||
|
//D3D::dev->Clear(0,NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1.0f,0);
|
||||||
|
|
||||||
|
// todo, to draw the EFB texture to the backbuffer instead of StretchRect
|
||||||
|
D3D::dev->StretchRect(FBManager::GetEFBColorRTSurface(), src_rect.AsRECT(),
|
||||||
|
D3D::GetBackBufferSurface(), dst_rect.AsRECT(),
|
||||||
|
D3DTEXF_LINEAR);
|
||||||
|
|
||||||
|
// Finish up the current frame, print some stats
|
||||||
|
if (g_ActiveConfig.bOverlayStats)
|
||||||
{
|
{
|
||||||
if (g_bSkipCurrentFrame)
|
Statistics::ToString(st);
|
||||||
|
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);
|
||||||
|
}
|
||||||
|
else if (g_ActiveConfig.bOverlayProjStats)
|
||||||
{
|
{
|
||||||
g_VideoInitialize.pCopiedToXFB(false);
|
Statistics::ToStringProj(st);
|
||||||
DEBUGGER_PAUSE_LOG_AT(NEXT_XFB_CMD,false,{printf("RenderToXFB - disabled");});
|
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OSD::DrawMessages();
|
||||||
|
|
||||||
|
// u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
|
||||||
|
|
||||||
|
// Clear the render target. We probably don't need to do this every frame.
|
||||||
|
//D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, 0x0, 1.0f, 0);
|
||||||
|
|
||||||
|
// Set rendering target back to the EFB rendering texture
|
||||||
|
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
|
||||||
|
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void D3DDumpFrame()
|
||||||
|
{
|
||||||
if (EmuWindow::GetParentWnd())
|
if (EmuWindow::GetParentWnd())
|
||||||
{
|
{
|
||||||
// Re-stretch window to parent window size again, if it has a parent window.
|
// Re-stretch window to parent window size again, if it has a parent window.
|
||||||
|
@ -308,18 +354,23 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
|
||||||
|
|
||||||
s_LastFrameDumped = false;
|
s_LastFrameDumped = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
|
||||||
D3D::dev->SetDepthStencilSurface(NULL);
|
|
||||||
|
|
||||||
// Blit our render target onto the backbuffer.
|
void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc)
|
||||||
// TODO: Change to a quad so we can do post processing.
|
{
|
||||||
TargetRectangle src_rect, dst_rect;
|
if (g_bSkipCurrentFrame)
|
||||||
src_rect = ConvertEFBRectangle(sourceRc);
|
{
|
||||||
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
g_VideoInitialize.pCopiedToXFB(false);
|
||||||
D3D::dev->StretchRect(FBManager::GetEFBColorRTSurface(), src_rect.AsRECT(),
|
DEBUGGER_PAUSE_LOG_AT(NEXT_XFB_CMD,false,{printf("RenderToXFB - disabled");});
|
||||||
D3D::GetBackBufferSurface(), dst_rect.AsRECT(),
|
return;
|
||||||
D3DTEXF_LINEAR);
|
}
|
||||||
|
|
||||||
|
D3D::EndFrame();
|
||||||
|
D3DDumpFrame();
|
||||||
|
EFBTextureToD3DBackBuffer(sourceRc);
|
||||||
|
D3D::BeginFrame();
|
||||||
|
|
||||||
DEBUGGER_LOG_AT((NEXT_XFB_CMD|NEXT_EFB_CMD|NEXT_FRAME),
|
DEBUGGER_LOG_AT((NEXT_XFB_CMD|NEXT_EFB_CMD|NEXT_FRAME),
|
||||||
{printf("StretchRect, EFB->XFB\n");});
|
{printf("StretchRect, EFB->XFB\n");});
|
||||||
DEBUGGER_PAUSE_LOG_AT(
|
DEBUGGER_PAUSE_LOG_AT(
|
||||||
|
@ -329,29 +380,6 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
|
||||||
sourceRc.left, sourceRc.top, sourceRc.right, sourceRc.bottom);}
|
sourceRc.left, sourceRc.top, sourceRc.right, sourceRc.bottom);}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Finish up the current frame, print some stats
|
|
||||||
if (g_ActiveConfig.bOverlayStats)
|
|
||||||
{
|
|
||||||
Statistics::ToString(st);
|
|
||||||
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);
|
|
||||||
}
|
|
||||||
else if (g_ActiveConfig.bOverlayProjStats)
|
|
||||||
{
|
|
||||||
Statistics::ToStringProj(st);
|
|
||||||
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
OSD::DrawMessages();
|
|
||||||
D3D::EndFrame();
|
|
||||||
|
|
||||||
// u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
|
|
||||||
D3D::BeginFrame();
|
|
||||||
|
|
||||||
// Clear the render target. We probably don't need to do this every frame.
|
|
||||||
//D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, 0x0, 1.0f, 0);
|
|
||||||
|
|
||||||
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
|
|
||||||
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
|
|
||||||
|
|
||||||
RECT rc;
|
RECT rc;
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
|
|
Loading…
Reference in New Issue