mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-09-20 11:21:43 +02:00
RenderBase: Return a tuple from ConvertStereoRectangle instead of using out parameters
This commit is contained in:
parent
671b5f9747
commit
c7ab6861c2
6 changed files with 30 additions and 23 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <tuple>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#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)
|
if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||||
{
|
{
|
||||||
TargetRectangle leftRc, rightRc;
|
TargetRectangle leftRc, rightRc;
|
||||||
ConvertStereoRectangle(dst, leftRc, rightRc);
|
std::tie(leftRc, rightRc) = ConvertStereoRectangle(dst);
|
||||||
|
|
||||||
D3D11_VIEWPORT leftVp = CD3D11_VIEWPORT((float)leftRc.left, (float)leftRc.top,
|
D3D11_VIEWPORT leftVp = CD3D11_VIEWPORT((float)leftRc.left, (float)leftRc.top,
|
||||||
(float)leftRc.GetWidth(), (float)leftRc.GetHeight());
|
(float)leftRc.GetWidth(), (float)leftRc.GetHeight());
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <tuple>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "Common/Align.h"
|
#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)
|
if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||||
{
|
{
|
||||||
TargetRectangle left_rc, right_rc;
|
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..
|
// Swap chain backbuffer is never multisampled..
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/Atomic.h"
|
#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.
|
// Top-and-Bottom mode needs to compensate for inverted vertical screen coordinates.
|
||||||
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||||
ConvertStereoRectangle(dst, rightRc, leftRc);
|
std::tie(rightRc, leftRc) = ConvertStereoRectangle(dst);
|
||||||
else
|
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, leftRc, src_texture, src_width, src_height, 0);
|
||||||
m_post_processor->BlitFromTexture(src, rightRc, src_texture, src_width, src_height, 1);
|
m_post_processor->BlitFromTexture(src, rightRc, src_texture, src_width, src_height, 1);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
@ -907,7 +908,7 @@ void Renderer::BlitScreen(VkRenderPass render_pass, const TargetRectangle& dst_r
|
||||||
{
|
{
|
||||||
TargetRectangle left_rect;
|
TargetRectangle left_rect;
|
||||||
TargetRectangle right_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(),
|
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(),
|
src_rect.left, src_rect.top, 0, src_rect.GetWidth(), src_rect.GetHeight(),
|
||||||
|
|
|
@ -252,41 +252,44 @@ bool Renderer::CalculateTargetSize()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc,
|
std::tuple<TargetRectangle, TargetRectangle>
|
||||||
TargetRectangle& rightRc) const
|
Renderer::ConvertStereoRectangle(const TargetRectangle& rc) const
|
||||||
{
|
{
|
||||||
// Resize target to half its original size
|
// Resize target to half its original size
|
||||||
TargetRectangle drawRc = rc;
|
TargetRectangle draw_rc = rc;
|
||||||
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||||
{
|
{
|
||||||
// The height may be negative due to flipped rectangles
|
// The height may be negative due to flipped rectangles
|
||||||
int height = rc.bottom - rc.top;
|
int height = rc.bottom - rc.top;
|
||||||
drawRc.top += height / 4;
|
draw_rc.top += height / 4;
|
||||||
drawRc.bottom -= height / 4;
|
draw_rc.bottom -= height / 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int width = rc.right - rc.left;
|
int width = rc.right - rc.left;
|
||||||
drawRc.left += width / 4;
|
draw_rc.left += width / 4;
|
||||||
drawRc.right -= width / 4;
|
draw_rc.right -= width / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create two target rectangle offset to the sides of the backbuffer
|
// 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)
|
if (g_ActiveConfig.iStereoMode == STEREO_TAB)
|
||||||
{
|
{
|
||||||
leftRc.top -= m_backbuffer_height / 4;
|
left_rc.top -= m_backbuffer_height / 4;
|
||||||
leftRc.bottom -= m_backbuffer_height / 4;
|
left_rc.bottom -= m_backbuffer_height / 4;
|
||||||
rightRc.top += m_backbuffer_height / 4;
|
right_rc.top += m_backbuffer_height / 4;
|
||||||
rightRc.bottom += m_backbuffer_height / 4;
|
right_rc.bottom += m_backbuffer_height / 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leftRc.left -= m_backbuffer_width / 4;
|
left_rc.left -= m_backbuffer_width / 4;
|
||||||
leftRc.right -= m_backbuffer_width / 4;
|
left_rc.right -= m_backbuffer_width / 4;
|
||||||
rightRc.left += m_backbuffer_width / 4;
|
right_rc.left += m_backbuffer_width / 4;
|
||||||
rightRc.right += 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)
|
void Renderer::SaveScreenshot(const std::string& filename, bool wait_for_completion)
|
||||||
|
|
|
@ -100,8 +100,8 @@ public:
|
||||||
void UpdateDrawRectangle();
|
void UpdateDrawRectangle();
|
||||||
|
|
||||||
// Use this to convert a single target rectangle to two stereo rectangles
|
// Use this to convert a single target rectangle to two stereo rectangles
|
||||||
void ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc,
|
std::tuple<TargetRectangle, TargetRectangle>
|
||||||
TargetRectangle& rightRc) const;
|
ConvertStereoRectangle(const TargetRectangle& rc) const;
|
||||||
|
|
||||||
// Use this to upscale native EFB coordinates to IDEAL internal resolution
|
// Use this to upscale native EFB coordinates to IDEAL internal resolution
|
||||||
int EFBToScaledX(int x) const;
|
int EFBToScaledX(int x) const;
|
||||||
|
|
Loading…
Reference in a new issue