diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 1c1955aea6..c46b44c07d 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -476,8 +476,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) } -// Called from VertexShaderManager -void Renderer::UpdateViewport() +void Renderer::SetViewport() { // reversed gxsetviewport(xorig, yorig, width, height, nearz, farz) // [0] = width/2 @@ -1018,7 +1017,7 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r RestoreAPIState(); D3D::BeginFrame(); D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV()); - UpdateViewport(); + SetViewport(); Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)); XFBWrited = false; @@ -1038,7 +1037,7 @@ void Renderer::RestoreAPIState() D3D::stateman->PopBlendState(); D3D::stateman->PopDepthState(); D3D::stateman->PopRasterizerState(); - UpdateViewport(); + SetViewport(); BPFunctions::SetScissor(); } diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index f391e4b47d..11b902c93e 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -21,6 +21,7 @@ public: void SetLineWidth(); void SetSamplerState(int stage,int texindex); void SetInterlacingMode(); + void SetViewport(); // TODO: Fix confusing names (see ResetAPIState and RestoreAPIState) void ApplyState(bool bUseDstAlpha); @@ -44,8 +45,6 @@ public: void ReinterpretPixelData(unsigned int convtype); - void UpdateViewport(); - bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc); static bool CheckForResize(); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 6d4d73da38..3d22168300 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1078,8 +1078,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) return 0; } -// Called from VertexShaderManager -void Renderer::UpdateViewport() +void Renderer::SetViewport() { // reversed gxsetviewport(xorig, yorig, width, height, nearz, farz) // [0] = width/2 @@ -1651,7 +1650,7 @@ void Renderer::RestoreAPIState() SetDepthMode(); SetBlendMode(true); SetLogicOpMode(); - UpdateViewport(); + SetViewport(); if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) glPolygonMode(GL_FRONT_AND_BACK, g_ActiveConfig.bWireFrame ? GL_LINE : GL_FILL); diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index feaad32aa1..8f3e37ef1c 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -54,6 +54,7 @@ public: void SetLineWidth() override; void SetSamplerState(int stage,int texindex) override; void SetInterlacingMode() override; + void SetViewport() override; // TODO: Implement and use these void ApplyState(bool bUseDstAlpha) override {} @@ -76,8 +77,6 @@ public: void ReinterpretPixelData(unsigned int convtype) override; - void UpdateViewport() override; - bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc); private: diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 7f046e53a3..836a0ec03d 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -509,8 +509,8 @@ void Renderer::RecordVideoMemory() FifoRecorder::GetInstance().SetVideoMemory(bpMem, cpMem, xfMem, xfRegs, sizeof(XFRegisters) / 4); } -void UpdateViewport() +void SetViewport() { if (xfregs.viewport.wd != 0 && xfregs.viewport.ht != 0) - g_renderer->UpdateViewport(); + g_renderer->SetViewport(); } diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 81ca9f75fd..acb6797264 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -57,6 +57,7 @@ public: virtual void SetLineWidth() = 0; virtual void SetSamplerState(int stage,int texindex) = 0; virtual void SetInterlacingMode() = 0; + virtual void SetViewport() = 0; virtual void ApplyState(bool bUseDstAlpha) = 0; virtual void RestoreState() = 0; @@ -107,8 +108,6 @@ public: // Finish up the current frame, print some stats virtual void Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma = 1.0f) = 0; - virtual void UpdateViewport() = 0; - virtual bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) = 0; static unsigned int GetPrevPixelFormat() { return prev_efb_format; } @@ -160,4 +159,5 @@ private: extern Renderer *g_renderer; -void UpdateViewport(); +extern void SetViewport(); + diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 4632d098c4..169de08e4e 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -18,6 +18,7 @@ #include "XFMemory.h" #include "VideoCommon.h" #include "VertexManagerBase.h" +#include "RenderBase.h" #include "RenderBase.h" float GC_ALIGNED16(g_fProjectionMatrix[16]); @@ -173,8 +174,6 @@ static void ViewportCorrectionMatrix(Matrix44& result) result.data[4*1+3] = (-intendedHt + 2.f * (Y - intendedY)) / Ht + 1.f; } -void UpdateViewport(); - void VertexShaderManager::Init() { Dirty(); @@ -373,7 +372,7 @@ void VertexShaderManager::SetConstants() constants.depthparams[1] = xfregs.viewport.zRange / 16777216.0f; dirty = true; // This is so implementation-dependent that we can't have it here. - UpdateViewport(); + SetViewport(); // Update projection if the viewport isn't 1:1 useable if(!g_ActiveConfig.backend_info.bSupportsOversizedViewports)