diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 373bdc557f..086317c5be 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -152,8 +152,9 @@ bool FramebufferManagerCommon::ShouldDownloadFramebuffer(const VirtualFramebuffe // Heuristics to figure out the size of FBO to create. void FramebufferManagerCommon::EstimateDrawingSize(int &drawing_width, int &drawing_height) { static const int MAX_FRAMEBUF_HEIGHT = 512; - const int viewport_width = (int) gstate.getViewportX1(); - const int viewport_height = (int) gstate.getViewportY1(); + // Viewport-X1 and Y1 are not the upper left corner, but half the width/height. A bit confusing. + const int viewport_width = (int)(fabsf(gstate.getViewportX1()*2.0f)); + const int viewport_height = (int)(fabsf(gstate.getViewportY1()*2.0f)); const int region_width = gstate.getRegionX2() + 1; const int region_height = gstate.getRegionY2() + 1; const int scissor_width = gstate.getScissorX2() + 1; diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 6c27467386..0e1f68f739 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -392,12 +392,15 @@ struct GPUgstate int getRegionY1() const { return (region1 >> 10) & 0x3FF; } int getRegionX2() const { return (region2 & 0x3FF); } int getRegionY2() const { return (region2 >> 10) & 0x3FF; } + + // Note that the X1/Y1/Z1 here does not mean the upper-left corner, but half the dimensions. X2/Y2/Z2 are the center. float getViewportX1() const { return getFloat24(viewportx1); } float getViewportY1() const { return getFloat24(viewporty1); } float getViewportZ1() const { return getFloat24(viewportz1); } float getViewportX2() const { return getFloat24(viewportx2); } float getViewportY2() const { return getFloat24(viewporty2); } float getViewportZ2() const { return getFloat24(viewportz2); } + // Fixed 16 point. int getOffsetX16() const { return offsetx & 0xFFFF; } // Fixed 16 point. diff --git a/headless/Compare.cpp b/headless/Compare.cpp index 607816aac4..446546df81 100644 --- a/headless/Compare.cpp +++ b/headless/Compare.cpp @@ -20,6 +20,8 @@ #include "Common/ColorConv.h" #include "Core/Host.h" + +#include "GPU/GPUState.h" #include "GPU/Common/GPUDebugInterface.h" #include "GPU/Common/TextureDecoder.h"