DX9: Create textures needed for CPU->EFB access even if it's disabled.

That way, one can toggle that option during emulation.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6025 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-08-01 14:20:50 +00:00
parent 2c6f851bba
commit 910d543536

View File

@ -97,7 +97,7 @@ void FramebufferManager::Create()
{ {
hr = s_efb_color_texture->GetSurfaceLevel(0, &s_efb_color_surface); hr = s_efb_color_texture->GetSurfaceLevel(0, &s_efb_color_surface);
} }
CHECK(hr, "Create Color Texture (size: %dx%d; hr=%#x)", target_width, target_height, hr); CHECK(hr, "Create color texture (size: %dx%d; hr=%#x)", target_width, target_height, hr);
hr = D3D::dev->CreateTexture(1, 1, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, hr = D3D::dev->CreateTexture(1, 1, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format,
D3DPOOL_DEFAULT, &s_efb_colorRead_texture, NULL); D3DPOOL_DEFAULT, &s_efb_colorRead_texture, NULL);
CHECK(hr, "Create Color Read Texture (hr=%#x)", hr); CHECK(hr, "Create Color Read Texture (hr=%#x)", hr);
@ -107,11 +107,9 @@ void FramebufferManager::Create()
} }
// Create an offscreen surface that we can lock to retrieve the data // Create an offscreen surface that we can lock to retrieve the data
hr = D3D::dev->CreateOffscreenPlainSurface(1, 1, s_efb_color_surface_Format, D3DPOOL_SYSTEMMEM, &s_efb_color_OffScreenReadBuffer, NULL); hr = D3D::dev->CreateOffscreenPlainSurface(1, 1, s_efb_color_surface_Format, D3DPOOL_SYSTEMMEM, &s_efb_color_OffScreenReadBuffer, NULL);
CHECK(hr, "Create Color offScreen Surface (hr=%#x)", hr); CHECK(hr, "Create offscreen color surface (hr=%#x)", hr);
// Select Zbuffer format supported by hardware. // Select a Z-buffer format with hardware support
if (g_ActiveConfig.bEFBAccessEnable)
{
D3DFORMAT *DepthTexFormats = new D3DFORMAT[5]; D3DFORMAT *DepthTexFormats = new D3DFORMAT[5];
DepthTexFormats[0] = FOURCC_INTZ; DepthTexFormats[0] = FOURCC_INTZ;
DepthTexFormats[1] = FOURCC_DF24; DepthTexFormats[1] = FOURCC_DF24;
@ -122,13 +120,13 @@ void FramebufferManager::Create()
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
{ {
s_efb_depth_surface_Format = DepthTexFormats[i]; s_efb_depth_surface_Format = DepthTexFormats[i];
// Get the framebuffer Depth texture // Create the framebuffer depth texture
hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_DEPTHSTENCIL, s_efb_depth_surface_Format, hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_DEPTHSTENCIL, s_efb_depth_surface_Format,
D3DPOOL_DEFAULT, &s_efb_depth_texture, NULL); D3DPOOL_DEFAULT, &s_efb_depth_texture, NULL);
if (!FAILED(hr)) if (!FAILED(hr))
break; break;
} }
CHECK(hr, "Depth Color Texture (size: %dx%d; hr=%#x)", target_width, target_height, hr); CHECK(hr, "Framebuffer depth texture (size: %dx%d; hr=%#x)", target_width, target_height, hr);
// Get the Surface // Get the Surface
if(s_efb_depth_texture) if(s_efb_depth_texture)
{ {
@ -155,24 +153,16 @@ void FramebufferManager::Create()
break; break;
} }
CHECK(hr, "Create Depth Read texture (hr=%#x)", hr); CHECK(hr, "Create depth read texture (hr=%#x)", hr);
if(s_efb_depthRead_texture) if(s_efb_depthRead_texture)
{ {
s_efb_depthRead_texture->GetSurfaceLevel(0, &s_efb_depth_ReadBuffer); s_efb_depthRead_texture->GetSurfaceLevel(0, &s_efb_depth_ReadBuffer);
} }
// Create an offscreen surface that we can lock to retrieve the data // Create an offscreen surface that we can lock to retrieve the data
hr = D3D::dev->CreateOffscreenPlainSurface(4, 4, s_efb_depth_ReadBuffer_Format, D3DPOOL_SYSTEMMEM, &s_efb_depth_OffScreenReadBuffer, NULL); hr = D3D::dev->CreateOffscreenPlainSurface(4, 4, s_efb_depth_ReadBuffer_Format, D3DPOOL_SYSTEMMEM, &s_efb_depth_OffScreenReadBuffer, NULL);
CHECK(hr, "Create Depth offScreen Surface (hr=%#x)", hr); CHECK(hr, "Create depth offscreen surface (hr=%#x)", hr);
delete [] DepthTexFormats; delete [] DepthTexFormats;
} }
else
{
s_efb_depth_surface_Format = D3DFMT_D24X8;
hr = D3D::dev->CreateDepthStencilSurface(target_width, target_height, s_efb_depth_surface_Format,
D3DMULTISAMPLE_NONE, 0, FALSE, &s_efb_depth_surface, NULL);
CHECK(hr, "CreateDepthStencilSurface (hr=%#x)", hr);
}
}
void FramebufferManager::Destroy() void FramebufferManager::Destroy()
{ {