Remove old XFB logic

This commit is contained in:
iwubcode
2017-08-06 23:05:42 -05:00
parent 081b92b8a7
commit 33bc286baa
25 changed files with 4 additions and 1727 deletions

View File

@ -1377,93 +1377,4 @@ void FramebufferManager::DestroyPokeShaders()
}
}
std::unique_ptr<XFBSourceBase> FramebufferManager::CreateXFBSource(unsigned int target_width,
unsigned int target_height,
unsigned int layers)
{
TextureConfig config;
config.width = target_width;
config.height = target_height;
config.layers = layers;
config.rendertarget = true;
auto texture = TextureCache::GetInstance()->CreateTexture(config);
if (!texture)
{
PanicAlert("Failed to create texture for XFB source");
return nullptr;
}
return std::make_unique<XFBSource>(std::move(texture));
}
void FramebufferManager::CopyToRealXFB(u32 xfb_addr, u32 fb_stride, u32 fb_height,
const EFBRectangle& source_rc, float gamma)
{
// Pending/batched EFB pokes should be included in the copied image.
FlushEFBPokes();
// Schedule early command-buffer execution.
StateTracker::GetInstance()->EndRenderPass();
StateTracker::GetInstance()->OnReadback();
// GPU EFB textures -> Guest memory
u8* xfb_ptr = Memory::GetPointer(xfb_addr);
_assert_(xfb_ptr);
// source_rc is in native coordinates, so scale it to the internal resolution.
TargetRectangle scaled_rc = g_renderer->ConvertEFBRectangle(source_rc);
VkRect2D scaled_rc_vk = {
{scaled_rc.left, scaled_rc.top},
{static_cast<u32>(scaled_rc.GetWidth()), static_cast<u32>(scaled_rc.GetHeight())}};
Texture2D* src_texture = ResolveEFBColorTexture(scaled_rc_vk);
// The destination stride can differ from the copy region width, in which case the pixels
// outside the copy region should not be written to.
TextureCache::GetInstance()->GetTextureConverter()->EncodeTextureToMemoryYUYV(
xfb_ptr, static_cast<u32>(source_rc.GetWidth()), fb_stride, fb_height, src_texture,
scaled_rc);
// If we sourced directly from the EFB framebuffer, restore it to a color attachment.
if (src_texture == m_efb_color_texture.get())
{
src_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentCommandBuffer(),
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
}
}
XFBSource::XFBSource(std::unique_ptr<AbstractTexture> texture)
: XFBSourceBase(), m_texture(std::move(texture))
{
}
XFBSource::~XFBSource()
{
}
VKTexture* XFBSource::GetTexture() const
{
return static_cast<VKTexture*>(m_texture.get());
}
void XFBSource::CopyEFB(float gamma)
{
// Pending/batched EFB pokes should be included in the copied image.
FramebufferManager::GetInstance()->FlushEFBPokes();
// Virtual XFB, copy EFB at native resolution to m_texture
MathUtil::Rectangle<int> rect(0, 0, static_cast<int>(texWidth), static_cast<int>(texHeight));
VkRect2D vk_rect = {{rect.left, rect.top},
{static_cast<u32>(rect.GetWidth()), static_cast<u32>(rect.GetHeight())}};
Texture2D* src_texture = FramebufferManager::GetInstance()->ResolveEFBColorTexture(vk_rect);
static_cast<VKTexture*>(m_texture.get())->CopyRectangleFromTexture(src_texture, rect, rect);
// If we sourced directly from the EFB framebuffer, restore it to a color attachment.
if (src_texture == FramebufferManager::GetInstance()->GetEFBColorTexture())
{
src_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentCommandBuffer(),
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
}
}
} // namespace Vulkan