Merge pull request #4816 from lioncash/pair
FramebufferManagerBase: Return a std::pair from GetTargetSize
This commit is contained in:
commit
72d887cb20
|
@ -2,13 +2,15 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "VideoBackends/D3D/FramebufferManager.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "VideoBackends/D3D/D3DBase.h"
|
#include "VideoBackends/D3D/D3DBase.h"
|
||||||
#include "VideoBackends/D3D/D3DState.h"
|
#include "VideoBackends/D3D/D3DState.h"
|
||||||
#include "VideoBackends/D3D/D3DUtil.h"
|
#include "VideoBackends/D3D/D3DUtil.h"
|
||||||
#include "VideoBackends/D3D/FramebufferManager.h"
|
|
||||||
#include "VideoBackends/D3D/GeometryShaderCache.h"
|
#include "VideoBackends/D3D/GeometryShaderCache.h"
|
||||||
#include "VideoBackends/D3D/PixelShaderCache.h"
|
#include "VideoBackends/D3D/PixelShaderCache.h"
|
||||||
#include "VideoBackends/D3D/Render.h"
|
#include "VideoBackends/D3D/Render.h"
|
||||||
|
@ -292,10 +294,9 @@ std::unique_ptr<XFBSourceBase> FramebufferManager::CreateXFBSource(unsigned int
|
||||||
layers);
|
layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height)
|
std::pair<u32, u32> FramebufferManager::GetTargetSize() const
|
||||||
{
|
{
|
||||||
*width = m_target_width;
|
return std::make_pair(m_target_width, m_target_height);
|
||||||
*height = m_target_height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XFBSource::DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
|
void XFBSource::DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
|
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoBackends/D3D/D3DTexture.h"
|
#include "VideoBackends/D3D/D3DTexture.h"
|
||||||
#include "VideoCommon/FramebufferManagerBase.h"
|
#include "VideoCommon/FramebufferManagerBase.h"
|
||||||
|
|
||||||
|
@ -84,7 +86,7 @@ private:
|
||||||
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
||||||
unsigned int target_height,
|
unsigned int target_height,
|
||||||
unsigned int layers) override;
|
unsigned int layers) override;
|
||||||
void GetTargetSize(unsigned int* width, unsigned int* height) override;
|
std::pair<u32, u32> GetTargetSize() const override;
|
||||||
|
|
||||||
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
||||||
float Gamma) override;
|
float Gamma) override;
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "VideoBackends/D3D12/FramebufferManager.h"
|
#include "VideoBackends/D3D12/FramebufferManager.h"
|
||||||
|
|
||||||
#include "Common/Align.h"
|
#include "Common/Align.h"
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "VideoBackends/D3D12/D3DBase.h"
|
#include "VideoBackends/D3D12/D3DBase.h"
|
||||||
#include "VideoBackends/D3D12/D3DCommandListManager.h"
|
#include "VideoBackends/D3D12/D3DCommandListManager.h"
|
||||||
|
@ -218,10 +220,9 @@ std::unique_ptr<XFBSourceBase> FramebufferManager::CreateXFBSource(unsigned int
|
||||||
layers);
|
layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height)
|
std::pair<u32, u32> FramebufferManager::GetTargetSize() const
|
||||||
{
|
{
|
||||||
*width = m_target_width;
|
return std::make_pair(m_target_width, m_target_height);
|
||||||
*height = m_target_height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::ResolveDepthTexture()
|
void FramebufferManager::ResolveDepthTexture()
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoBackends/D3D12/D3DTexture.h"
|
#include "VideoBackends/D3D12/D3DTexture.h"
|
||||||
#include "VideoCommon/FramebufferManagerBase.h"
|
#include "VideoCommon/FramebufferManagerBase.h"
|
||||||
|
@ -86,7 +88,7 @@ private:
|
||||||
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
||||||
unsigned int target_height,
|
unsigned int target_height,
|
||||||
unsigned int layers) override;
|
unsigned int layers) override;
|
||||||
void GetTargetSize(unsigned int* width, unsigned int* height) override;
|
std::pair<u32, u32> GetTargetSize() const override;
|
||||||
|
|
||||||
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
||||||
float gamma) override;
|
float gamma) override;
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/FramebufferManagerBase.h"
|
#include "VideoCommon/FramebufferManagerBase.h"
|
||||||
|
|
||||||
class XFBSource : public XFBSourceBase
|
class XFBSource : public XFBSourceBase
|
||||||
|
@ -23,7 +26,7 @@ public:
|
||||||
return std::make_unique<XFBSource>();
|
return std::make_unique<XFBSource>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTargetSize(unsigned int* width, unsigned int* height) override {}
|
std::pair<u32, u32> GetTargetSize() const override { return std::make_pair(0, 0); }
|
||||||
void CopyToRealXFB(u32 xfb_addr, u32 fb_stride, u32 fb_height, const EFBRectangle& source_rc,
|
void CopyToRealXFB(u32 xfb_addr, u32 fb_stride, u32 fb_height, const EFBRectangle& source_rc,
|
||||||
float gamma = 1.0f) override
|
float gamma = 1.0f) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -668,10 +668,9 @@ std::unique_ptr<XFBSourceBase> FramebufferManager::CreateXFBSource(unsigned int
|
||||||
return std::make_unique<XFBSource>(texture, layers);
|
return std::make_unique<XFBSource>(texture, layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height)
|
std::pair<u32, u32> FramebufferManager::GetTargetSize() const
|
||||||
{
|
{
|
||||||
*width = m_targetWidth;
|
return std::make_pair(m_targetWidth, m_targetHeight);
|
||||||
*height = m_targetHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points)
|
void FramebufferManager::PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points)
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/GL/GLUtil.h"
|
#include "Common/GL/GLUtil.h"
|
||||||
#include "VideoBackends/OGL/ProgramShaderCache.h"
|
#include "VideoBackends/OGL/ProgramShaderCache.h"
|
||||||
#include "VideoBackends/OGL/Render.h"
|
#include "VideoBackends/OGL/Render.h"
|
||||||
|
@ -103,7 +105,7 @@ private:
|
||||||
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
||||||
unsigned int target_height,
|
unsigned int target_height,
|
||||||
unsigned int layers) override;
|
unsigned int layers) override;
|
||||||
void GetTargetSize(unsigned int* width, unsigned int* height) override;
|
std::pair<u32, u32> GetTargetSize() const override;
|
||||||
|
|
||||||
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
||||||
float Gamma) override;
|
float Gamma) override;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
@ -101,7 +102,8 @@ class FramebufferManager : public FramebufferManagerBase
|
||||||
{
|
{
|
||||||
return std::make_unique<XFBSource>();
|
return std::make_unique<XFBSource>();
|
||||||
}
|
}
|
||||||
void GetTargetSize(unsigned int* width, unsigned int* height) override{};
|
|
||||||
|
std::pair<u32, u32> GetTargetSize() const override { return std::make_pair(0, 0); }
|
||||||
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
void CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,
|
||||||
float Gamma = 1.0f) override
|
float Gamma = 1.0f) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,10 +115,9 @@ bool FramebufferManager::Initialize()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height)
|
std::pair<u32, u32> FramebufferManager::GetTargetSize() const
|
||||||
{
|
{
|
||||||
*width = m_efb_width;
|
return std::make_pair(m_efb_width, m_efb_height);
|
||||||
*height = m_efb_height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FramebufferManager::CreateEFBRenderPass()
|
bool FramebufferManager::CreateEFBRenderPass()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoBackends/Vulkan/Constants.h"
|
#include "VideoBackends/Vulkan/Constants.h"
|
||||||
|
@ -39,7 +40,7 @@ public:
|
||||||
Texture2D* GetEFBColorTexture() const { return m_efb_color_texture.get(); }
|
Texture2D* GetEFBColorTexture() const { return m_efb_color_texture.get(); }
|
||||||
Texture2D* GetEFBDepthTexture() const { return m_efb_depth_texture.get(); }
|
Texture2D* GetEFBDepthTexture() const { return m_efb_depth_texture.get(); }
|
||||||
VkFramebuffer GetEFBFramebuffer() const { return m_efb_framebuffer; }
|
VkFramebuffer GetEFBFramebuffer() const { return m_efb_framebuffer; }
|
||||||
void GetTargetSize(unsigned int* width, unsigned int* height) override;
|
std::pair<u32, u32> GetTargetSize() const override;
|
||||||
|
|
||||||
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width,
|
||||||
unsigned int target_height,
|
unsigned int target_height,
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "VideoCommon/FramebufferManagerBase.h"
|
#include "VideoCommon/FramebufferManagerBase.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#include "VideoCommon/RenderBase.h"
|
#include "VideoCommon/RenderBase.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
|
@ -158,8 +161,8 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbStride, u32 fbH
|
||||||
if (m_virtualXFBList.begin() != vxfb)
|
if (m_virtualXFBList.begin() != vxfb)
|
||||||
m_virtualXFBList.splice(m_virtualXFBList.begin(), m_virtualXFBList, vxfb);
|
m_virtualXFBList.splice(m_virtualXFBList.begin(), m_virtualXFBList, vxfb);
|
||||||
|
|
||||||
unsigned int target_width, target_height;
|
u32 target_width, target_height;
|
||||||
g_framebuffer_manager->GetTargetSize(&target_width, &target_height);
|
std::tie(target_width, target_height) = g_framebuffer_manager->GetTargetSize();
|
||||||
|
|
||||||
// recreate if needed
|
// recreate if needed
|
||||||
if (vxfb->xfbSource &&
|
if (vxfb->xfbSource &&
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/VideoCommon.h"
|
#include "VideoCommon/VideoCommon.h"
|
||||||
|
@ -60,7 +61,7 @@ public:
|
||||||
static int ScaleToVirtualXfbHeight(int y);
|
static int ScaleToVirtualXfbHeight(int y);
|
||||||
|
|
||||||
static unsigned int GetEFBLayers() { return m_EFBLayers; }
|
static unsigned int GetEFBLayers() { return m_EFBLayers; }
|
||||||
virtual void GetTargetSize(unsigned int* width, unsigned int* height) = 0;
|
virtual std::pair<u32, u32> GetTargetSize() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct VirtualXFB
|
struct VirtualXFB
|
||||||
|
|
|
@ -12,11 +12,14 @@
|
||||||
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
|
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
|
||||||
// ---------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "VideoCommon/RenderBase.h"
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
@ -48,7 +51,6 @@
|
||||||
#include "VideoCommon/ImageWrite.h"
|
#include "VideoCommon/ImageWrite.h"
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
#include "VideoCommon/PostProcessing.h"
|
#include "VideoCommon/PostProcessing.h"
|
||||||
#include "VideoCommon/RenderBase.h"
|
|
||||||
#include "VideoCommon/Statistics.h"
|
#include "VideoCommon/Statistics.h"
|
||||||
#include "VideoCommon/TextureCacheBase.h"
|
#include "VideoCommon/TextureCacheBase.h"
|
||||||
#include "VideoCommon/TextureDecoder.h"
|
#include "VideoCommon/TextureDecoder.h"
|
||||||
|
@ -509,8 +511,8 @@ TargetRectangle Renderer::CalculateFrameDumpDrawRectangle()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the dimensions of the EFB textures, we scale either of these depending on the ratio.
|
// Grab the dimensions of the EFB textures, we scale either of these depending on the ratio.
|
||||||
unsigned int efb_width, efb_height;
|
u32 efb_width, efb_height;
|
||||||
g_framebuffer_manager->GetTargetSize(&efb_width, &efb_height);
|
std::tie(efb_width, efb_height) = g_framebuffer_manager->GetTargetSize();
|
||||||
|
|
||||||
float draw_width, draw_height;
|
float draw_width, draw_height;
|
||||||
std::tie(draw_width, draw_height) = ScaleToDisplayAspectRatio(efb_width, efb_height);
|
std::tie(draw_width, draw_height) = ScaleToDisplayAspectRatio(efb_width, efb_height);
|
||||||
|
|
Loading…
Reference in New Issue