From 647aad0a19acc2a7bcb637160bb43d794771ed41 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 15 Feb 2014 18:57:55 +0100 Subject: [PATCH] inline SetViewport into VertexShaderManager --- Source/Core/VideoBackends/D3D/Render.cpp | 4 ++++ Source/Core/VideoCommon/RenderBase.cpp | 6 ------ Source/Core/VideoCommon/RenderBase.h | 2 -- Source/Core/VideoCommon/VertexShaderManager.cpp | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index cb803c270b..818a8ad62e 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -486,6 +486,10 @@ void Renderer::SetViewport() // [4] = yorig + height/2 + 342 // [5] = 16777215 * farz + // D3D crashes for zero viewports + if (xfregs.viewport.wd == 0 || xfregs.viewport.ht == 0) + return; + int scissorXOff = bpmem.scissorOffset.x * 2; int scissorYOff = bpmem.scissorOffset.y * 2; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 31d5d091c7..45bd870670 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -512,12 +512,6 @@ void Renderer::RecordVideoMemory() FifoRecorder::GetInstance().SetVideoMemory(bpMem, cpMem, xfMem, xfRegs, sizeof(XFRegisters) / 4); } -void SetViewport() -{ - if (xfregs.viewport.wd != 0 && xfregs.viewport.ht != 0) - g_renderer->SetViewport(); -} - void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc, float Gamma) { // TODO: merge more generic parts into VideoCommon diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 6744767d14..fb99362a2a 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -160,5 +160,3 @@ private: extern Renderer *g_renderer; -extern void SetViewport(); - diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 169de08e4e..f39bd6231f 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -372,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. - SetViewport(); + g_renderer->SetViewport(); // Update projection if the viewport isn't 1:1 useable if(!g_ActiveConfig.backend_info.bSupportsOversizedViewports)