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
This commit is contained in:
hrydgard 2009-09-15 20:18:25 +00:00
parent dc4f712f74
commit e0baa817e4

View File

@ -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