RenderBase: Return a tuple from ConvertStereoRectangle instead of using out parameters
This commit is contained in:
parent
671b5f9747
commit
c7ab6861c2
|
@ -9,6 +9,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <strsafe.h>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
@ -1173,7 +1174,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
|
|||
if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||
{
|
||||
TargetRectangle leftRc, rightRc;
|
||||
ConvertStereoRectangle(dst, leftRc, rightRc);
|
||||
std::tie(leftRc, rightRc) = ConvertStereoRectangle(dst);
|
||||
|
||||
D3D11_VIEWPORT leftVp = CD3D11_VIEWPORT((float)leftRc.left, (float)leftRc.top,
|
||||
(float)leftRc.GetWidth(), (float)leftRc.GetHeight());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <strsafe.h>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Common/Align.h"
|
||||
|
@ -1203,7 +1204,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
|
|||
if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||
{
|
||||
TargetRectangle left_rc, right_rc;
|
||||
ConvertStereoRectangle(dst, left_rc, right_rc);
|
||||
std::tie(left_rc, right_rc) = ConvertStereoRectangle(dst);
|
||||
|
||||
// Swap chain backbuffer is never multisampled..
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Atomic.h"
|
||||
|
@ -1181,9 +1182,9 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_t
|
|||
|
||||
// Top-and-Bottom mode needs to compensate for inverted vertical screen coordinates.
|
||||
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||
ConvertStereoRectangle(dst, rightRc, leftRc);
|
||||
std::tie(rightRc, leftRc) = ConvertStereoRectangle(dst);
|
||||
else
|
||||
ConvertStereoRectangle(dst, leftRc, rightRc);
|
||||
std::tie(leftRc, rightRc) = ConvertStereoRectangle(dst);
|
||||
|
||||
m_post_processor->BlitFromTexture(src, leftRc, src_texture, src_width, src_height, 0);
|
||||
m_post_processor->BlitFromTexture(src, rightRc, src_texture, src_width, src_height, 1);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
@ -907,7 +908,7 @@ void Renderer::BlitScreen(VkRenderPass render_pass, const TargetRectangle& dst_r
|
|||
{
|
||||
TargetRectangle left_rect;
|
||||
TargetRectangle right_rect;
|
||||
ConvertStereoRectangle(dst_rect, left_rect, right_rect);
|
||||
std::tie(left_rect, right_rect) = ConvertStereoRectangle(dst_rect);
|
||||
|
||||
draw.DrawQuad(left_rect.left, left_rect.top, left_rect.GetWidth(), left_rect.GetHeight(),
|
||||
src_rect.left, src_rect.top, 0, src_rect.GetWidth(), src_rect.GetHeight(),
|
||||
|
|
|
@ -252,41 +252,44 @@ bool Renderer::CalculateTargetSize()
|
|||
return false;
|
||||
}
|
||||
|
||||
void Renderer::ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc,
|
||||
TargetRectangle& rightRc) const
|
||||
std::tuple<TargetRectangle, TargetRectangle>
|
||||
Renderer::ConvertStereoRectangle(const TargetRectangle& rc) const
|
||||
{
|
||||
// Resize target to half its original size
|
||||
TargetRectangle drawRc = rc;
|
||||
TargetRectangle draw_rc = rc;
|
||||
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||
{
|
||||
// The height may be negative due to flipped rectangles
|
||||
int height = rc.bottom - rc.top;
|
||||
drawRc.top += height / 4;
|
||||
drawRc.bottom -= height / 4;
|
||||
draw_rc.top += height / 4;
|
||||
draw_rc.bottom -= height / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = rc.right - rc.left;
|
||||
drawRc.left += width / 4;
|
||||
drawRc.right -= width / 4;
|
||||
draw_rc.left += width / 4;
|
||||
draw_rc.right -= width / 4;
|
||||
}
|
||||
|
||||
// Create two target rectangle offset to the sides of the backbuffer
|
||||
leftRc = drawRc, rightRc = drawRc;
|
||||
TargetRectangle left_rc = draw_rc;
|
||||
TargetRectangle right_rc = draw_rc;
|
||||
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||
{
|
||||
leftRc.top -= m_backbuffer_height / 4;
|
||||
leftRc.bottom -= m_backbuffer_height / 4;
|
||||
rightRc.top += m_backbuffer_height / 4;
|
||||
rightRc.bottom += m_backbuffer_height / 4;
|
||||
left_rc.top -= m_backbuffer_height / 4;
|
||||
left_rc.bottom -= m_backbuffer_height / 4;
|
||||
right_rc.top += m_backbuffer_height / 4;
|
||||
right_rc.bottom += m_backbuffer_height / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
leftRc.left -= m_backbuffer_width / 4;
|
||||
leftRc.right -= m_backbuffer_width / 4;
|
||||
rightRc.left += m_backbuffer_width / 4;
|
||||
rightRc.right += m_backbuffer_width / 4;
|
||||
left_rc.left -= m_backbuffer_width / 4;
|
||||
left_rc.right -= m_backbuffer_width / 4;
|
||||
right_rc.left += m_backbuffer_width / 4;
|
||||
right_rc.right += m_backbuffer_width / 4;
|
||||
}
|
||||
|
||||
return std::make_tuple(left_rc, right_rc);
|
||||
}
|
||||
|
||||
void Renderer::SaveScreenshot(const std::string& filename, bool wait_for_completion)
|
||||
|
|
|
@ -100,8 +100,8 @@ public:
|
|||
void UpdateDrawRectangle();
|
||||
|
||||
// Use this to convert a single target rectangle to two stereo rectangles
|
||||
void ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc,
|
||||
TargetRectangle& rightRc) const;
|
||||
std::tuple<TargetRectangle, TargetRectangle>
|
||||
ConvertStereoRectangle(const TargetRectangle& rc) const;
|
||||
|
||||
// Use this to upscale native EFB coordinates to IDEAL internal resolution
|
||||
int EFBToScaledX(int x) const;
|
||||
|
|
Loading…
Reference in New Issue