From 79387dddb24ddf035b70cd9379a42368dcd49e93 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 29 May 2017 17:02:09 -0500 Subject: Add support for hybrid XFB --- Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp index 53351e0325..c23c19b544 100644 --- a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp @@ -89,11 +89,6 @@ MultisamplingState FramebufferManager::GetEFBMultisamplingState() const return ms; } -std::pair FramebufferManager::GetTargetSize() const -{ - return std::make_pair(GetEFBWidth(), GetEFBHeight()); -} - bool FramebufferManager::Initialize() { if (!CreateEFBRenderPass()) @@ -1450,15 +1445,6 @@ VKTexture* XFBSource::GetTexture() const return static_cast(m_texture.get()); } -void XFBSource::DecodeToTexture(u32 xfb_addr, u32 fb_width, u32 fb_height) -{ - // Guest memory -> GPU EFB Textures - const u8* src_ptr = Memory::GetPointer(xfb_addr); - _assert_(src_ptr); - TextureCache::GetInstance()->GetTextureConverter()->DecodeYUYVTextureFromMemory( - static_cast(m_texture.get()), src_ptr, fb_width, fb_width * 2, fb_height); -} - void XFBSource::CopyEFB(float gamma) { // Pending/batched EFB pokes should be included in the copied image. -- cgit v1.2.3 From 33bc286baaafe31b2b564dd5d5574307cbd9e921 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sun, 6 Aug 2017 23:05:42 -0500 Subject: Remove old XFB logic --- .../VideoBackends/Vulkan/FramebufferManager.cpp | 89 ---------------------- 1 file changed, 89 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp index c23c19b544..305f0343f7 100644 --- a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp @@ -1377,93 +1377,4 @@ void FramebufferManager::DestroyPokeShaders() } } -std::unique_ptr 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(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(scaled_rc.GetWidth()), static_cast(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(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 texture) - : XFBSourceBase(), m_texture(std::move(texture)) -{ -} - -XFBSource::~XFBSource() -{ -} - -VKTexture* XFBSource::GetTexture() const -{ - return static_cast(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 rect(0, 0, static_cast(texWidth), static_cast(texHeight)); - VkRect2D vk_rect = {{rect.left, rect.top}, - {static_cast(rect.GetWidth()), static_cast(rect.GetHeight())}}; - - Texture2D* src_texture = FramebufferManager::GetInstance()->ResolveEFBColorTexture(vk_rect); - static_cast(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 -- cgit v1.2.3