From e0baa817e4bbae073006c3bfc33e424793426101 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Tue, 15 Sep 2009 20:18:25 +0000 Subject: [PATCH] D3D: Switch color render target to a texture. Should not have any visible effects - if this causes slowdown compared to the previous revision right before this one, let me know in the comments. This is a prerequisite to do postprocessing, and also things like copy-efb-to-ram. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4278 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/FramebufferManager.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp index aa53e58dc4..dbc8c659b1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp @@ -22,6 +22,7 @@ namespace FBManager { +static LPDIRECT3DTEXTURE9 s_efb_color_texture; static LPDIRECT3DSURFACE9 s_efb_color_surface; static LPDIRECT3DSURFACE9 s_efb_depth_surface; @@ -31,14 +32,24 @@ static LPDIRECT3DSURFACE9 s_efb_depth_surface; LPDIRECT3DSURFACE9 GetEFBColorRTSurface() { return s_efb_color_surface; } LPDIRECT3DSURFACE9 GetEFBDepthRTSurface() { return s_efb_depth_surface; } +LPDIRECT3DTEXTURE9 GetEFBColorTexture(const EFBRectangle& sourceRc) +{ + return s_efb_color_texture; +} + void Create() { // Simplest possible setup to start with. int target_width = Renderer::GetTargetWidth(); int target_height = Renderer::GetTargetHeight(); - HRESULT hr = D3D::dev->CreateRenderTarget(target_width, target_height, D3DFMT_A8R8G8B8, - D3DMULTISAMPLE_NONE, 0, FALSE, &s_efb_color_surface, NULL); + + HRESULT hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, + D3DPOOL_DEFAULT, &s_efb_color_texture, NULL); CHECK(hr); + + hr = s_efb_color_texture->GetSurfaceLevel(0, &s_efb_color_surface); + CHECK(hr); + hr = D3D::dev->CreateDepthStencilSurface(target_width, target_height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &s_efb_depth_surface, NULL); CHECK(hr); @@ -48,8 +59,13 @@ void Destroy() { s_efb_depth_surface->Release(); s_efb_depth_surface = NULL; + s_efb_color_surface->Release(); s_efb_color_surface = NULL; +#ifdef TEXSURF + s_efb_color_texture->Release(); + s_efb_color_texture = NULL; +#endif } } // namespace \ No newline at end of file