From 0ef3bd9c778a786ec439950f65c863d64ccf98b6 Mon Sep 17 00:00:00 2001 From: lioncash Date: Wed, 16 Jan 2013 15:46:11 -0500 Subject: [PATCH] Revert "Made several variables/parameters unsigned in the DX9, DX11 and OGL plugins. They make more sense like this (given their names)." Turns out I was wrong in my previous commit. My bad. This reverts commit 87431666639c7036ea0f5b0d499df639cefb3d51. --- .../VideoCommon/Src/FramebufferManagerBase.h | 2 +- Source/Core/VideoCommon/Src/RenderBase.cpp | 22 +++++------ Source/Core/VideoCommon/Src/RenderBase.h | 24 ++++++------ .../Src/FramebufferManager.cpp | 2 +- .../Plugin_VideoDX11/Src/FramebufferManager.h | 2 +- .../Plugins/Plugin_VideoDX11/Src/Render.cpp | 27 ++++++++----- .../Plugins/Plugin_VideoDX9/Src/D3DBase.cpp | 29 ++++++-------- Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h | 6 +-- .../Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp | 16 ++++---- Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h | 16 ++++---- .../Src/FramebufferManager.cpp | 6 +-- .../Plugin_VideoDX9/Src/FramebufferManager.h | 2 +- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 38 ++++++++++--------- .../Src/FramebufferManager.cpp | 2 +- .../Plugin_VideoOGL/Src/FramebufferManager.h | 2 +- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 6 +-- 16 files changed, 104 insertions(+), 98 deletions(-) diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h index 902e781a70..e529bb1a39 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h @@ -17,7 +17,7 @@ struct XFBSourceBase // TODO: only DX9 uses the width/height params virtual void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const = 0; + const MathUtil::Rectangle &drawrc, int width, int height) const = 0; virtual void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) = 0; diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 1ea7afbc1e..8e1d012fa2 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -60,12 +60,12 @@ std::string Renderer::s_sScreenshotName; volatile bool Renderer::s_bScreenshot; // The framebuffer size -unsigned int Renderer::s_target_width; -unsigned int Renderer::s_target_height; +int Renderer::s_target_width; +int Renderer::s_target_height; // TODO: Add functionality to reinit all the render targets when the window is resized. -unsigned int Renderer::s_backbuffer_width; -unsigned int Renderer::s_backbuffer_height; +int Renderer::s_backbuffer_width; +int Renderer::s_backbuffer_height; TargetRectangle Renderer::target_rc; @@ -163,7 +163,7 @@ int Renderer::EFBToScaledY(int y) }; } -void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY) +void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) { if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1) { @@ -172,15 +172,15 @@ void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int } else { - scaledX = x * (efb_scale_numeratorX / efb_scale_denominatorX); - scaledY = y * (efb_scale_numeratorY / efb_scale_denominatorY); + scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; + scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; } } // return true if target size changed -bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier) +bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier) { - u32 newEFBWidth, newEFBHeight; + int newEFBWidth, newEFBHeight; // TODO: Ugly. Clean up switch (s_LastEFBScale) @@ -374,7 +374,7 @@ void Renderer::DrawDebugText() // TODO: remove extern bool g_aspect_wide; -void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height) +void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) { float FloatGLWidth = (float)backbuffer_width; float FloatGLHeight = (float)backbuffer_height; @@ -492,7 +492,7 @@ void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height) target_rc.bottom = YOffset + iHeight; } -void Renderer::SetWindowSize(u32 width, u32 height) +void Renderer::SetWindowSize(int width, int height) { if (width < 1) width = 1; diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 38cab83562..5376577cbd 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -67,14 +67,14 @@ public: virtual void RestoreState() = 0; // Ideal internal resolution - determined by display resolution (automatic scaling) and/or a multiple of the native EFB resolution - static u32 GetTargetWidth() { return s_target_width; } - static u32 GetTargetHeight() { return s_target_height; } + static int GetTargetWidth() { return s_target_width; } + static int GetTargetHeight() { return s_target_height; } // Display resolution - static u32 GetBackbufferWidth() { return s_backbuffer_width; } - static u32 GetBackbufferHeight() { return s_backbuffer_height; } + static int GetBackbufferWidth() { return s_backbuffer_width; } + static int GetBackbufferHeight() { return s_backbuffer_height; } - static void SetWindowSize(u32 width, u32 height); + static void SetWindowSize(int width, int height); // EFB coordinate conversion functions @@ -82,7 +82,7 @@ public: virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0; static const TargetRectangle& GetTargetRectangle() { return target_rc; } - static void UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height); + static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height); // Use this to upscale native EFB coordinates to IDEAL internal resolution @@ -132,8 +132,8 @@ public: protected: - static void CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY); - static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier = 1); + static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY); + static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1); static void CheckFifoRecording(); static void RecordVideoMemory(); @@ -151,12 +151,12 @@ protected: bool bLastFrameDumped; // The framebuffer size - static u32 s_target_width; - static u32 s_target_height; + static int s_target_width; + static int s_target_height; // TODO: Add functionality to reinit all the render targets when the window is resized. - static u32 s_backbuffer_width; - static u32 s_backbuffer_height; + static int s_backbuffer_width; + static int s_backbuffer_height; static TargetRectangle target_rc; diff --git a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp index 6d9c0ff232..cb94884eb7 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp @@ -193,7 +193,7 @@ void FramebufferManager::GetTargetSize(unsigned int *width, unsigned int *height } void XFBSource::Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const + const MathUtil::Rectangle &drawrc, int width, int height) const { D3D::drawShadedTexSubQuad(tex->GetSRV(), &sourcerc, texWidth, texHeight, &drawrc, PixelShaderCache::GetColorCopyProgram(false), diff --git a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.h b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.h index 30b99ce0f2..83db4370db 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.h +++ b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.h @@ -64,7 +64,7 @@ struct XFBSource : public XFBSourceBase ~XFBSource() { tex->Release(); } void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const; + const MathUtil::Rectangle &drawrc, int width, int height) const; void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight); void CopyEFB(float Gamma); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 1355ac2990..44eaaf5dcf 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -691,14 +691,18 @@ void Renderer::UpdateViewport(Matrix44& vpCorrection) } // In D3D, the viewport rectangle must fit within the render target. - u32 X = intendedX; - u32 Y = intendedY; - u32 Wd = intendedWd; - u32 Ht = intendedHt; + int X = intendedX; + if (X < 0) + X = 0; + int Y = intendedY; + if (Y < 0) + Y = 0; + + int Wd = intendedWd; if (X + Wd > GetTargetWidth()) Wd = GetTargetWidth() - X; - + int Ht = intendedHt; if (Y + Ht > GetTargetHeight()) Ht = GetTargetHeight() - Y; @@ -924,17 +928,20 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons // Prepare to copy the XFBs to our backbuffer UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); - u32 X = GetTargetRectangle().left; - u32 Y = GetTargetRectangle().top; - u32 Width = GetTargetRectangle().right - GetTargetRectangle().left; - u32 Height = GetTargetRectangle().bottom - GetTargetRectangle().top; + int X = GetTargetRectangle().left; + int Y = GetTargetRectangle().top; + int Width = GetTargetRectangle().right - GetTargetRectangle().left; + int Height = GetTargetRectangle().bottom - GetTargetRectangle().top; // TODO: Redundant checks... + if (X < 0) X = 0; + if (Y < 0) Y = 0; if (X > s_backbuffer_width) X = s_backbuffer_width; if (Y > s_backbuffer_height) Y = s_backbuffer_height; + if (Width < 0) Width = 0; + if (Height < 0) Height = 0; if (Width > (s_backbuffer_width - X)) Width = s_backbuffer_width - X; if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y; - D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height); D3D::context->RSSetViewports(1, &vp); D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp index 7b33844f92..ff3f68a6cd 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp @@ -49,9 +49,9 @@ LPDIRECT3DSURFACE9 back_buffer_z; D3DCAPS9 caps; HWND hWnd; -static unsigned int multisample; -static unsigned int resolution; -static unsigned int xres, yres; +static int multisample; +static int resolution; +static int xres, yres; static bool auto_depth_stencil = false; #define VENDOR_NVIDIA 4318 @@ -480,25 +480,24 @@ const D3DCAPS9 &GetCaps() } // returns true if size was changed -bool FixTextureSize(u32& width, u32& height) +bool FixTextureSize(int& width, int& height) { - u32 oldw = width; - u32 oldh = height; + int oldw = width, oldh = height; // conditional nonpow2 support should work fine for us if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && !(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL)) { // all texture dimensions need to be powers of two - width = MakePow2(width); - height = MakePow2(height); + width = (int)MakePow2((u32)width); + height = (int)MakePow2((u32)height); } if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) { width = height = max(width, height); } - width = min(width, (u32)caps.MaxTextureWidth); - height = min(height, (u32)caps.MaxTextureHeight); + width = min(width, (int)caps.MaxTextureWidth); + height = min(height, (int)caps.MaxTextureHeight); return (width != oldw) || (height != oldh); } @@ -516,22 +515,18 @@ bool CheckDepthStencilSupport(D3DFORMAT target_format, D3DFORMAT depth_format) D3DFORMAT GetSupportedDepthTextureFormat() { - for (size_t i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i) - { + for (int i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i) if (D3D::CheckTextureSupport(D3DUSAGE_DEPTHSTENCIL, DepthFormats[i])) return DepthFormats[i]; - } return D3DFMT_UNKNOWN; } D3DFORMAT GetSupportedDepthSurfaceFormat(D3DFORMAT target_format) { - for (size_t i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i) - { + for (int i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i) if (D3D::CheckDepthStencilSupport(target_format, DepthFormats[i])) return DepthFormats[i]; - } return D3DFMT_UNKNOWN; } @@ -572,7 +567,7 @@ void ShowD3DError(HRESULT err) PanicAlert("Driver Internal Error"); break; case D3DERR_OUTOFVIDEOMEMORY: - PanicAlert("Out of video memory"); + PanicAlert("Out of vid mem"); break; default: // MessageBox(0,_T("Other error or success"),_T("ERROR"),0); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h index bd55c87819..d1e7eeaa91 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h @@ -75,7 +75,7 @@ const char *VertexShaderVersionString(); void ShowD3DError(HRESULT err); // returns true if size was changed -bool FixTextureSize(u32& width, u32& height); +bool FixTextureSize(int& width, int& height); // returns true if format is supported bool CheckTextureSupport(DWORD usage, D3DFORMAT tex_format); @@ -115,8 +115,8 @@ void EnableAlphaToCoverage(); struct Resolution { char name[32]; - unsigned int xres; - unsigned int yres; + int xres; + int yres; std::set bitdepths; std::set refreshes; }; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp index a8343d7987..9510ad444c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp @@ -365,10 +365,10 @@ int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, flo */ void drawShadedTexQuad(IDirect3DTexture9 *texture, const RECT *rSource, - u32 SourceWidth, - u32 SourceHeight, - u32 DestWidth, - u32 DestHeight, + int SourceWidth, + int SourceHeight, + int DestWidth, + int DestHeight, IDirect3DPixelShader9 *PShader, IDirect3DVertexShader9 *Vshader, float Gamma) @@ -399,11 +399,11 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture, void drawShadedTexSubQuad(IDirect3DTexture9 *texture, const MathUtil::Rectangle *rSource, - u32 SourceWidth, - u32 SourceHeight, + int SourceWidth, + int SourceHeight, const MathUtil::Rectangle *rDest, - u32 DestWidth, - u32 DestHeight, + int DestWidth, + int DestHeight, IDirect3DPixelShader9 *PShader, IDirect3DVertexShader9 *Vshader, float Gamma) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h index 217ddf069b..882f112ece 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h @@ -65,20 +65,20 @@ namespace D3D void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1); void drawShadedTexQuad(IDirect3DTexture9 *texture, const RECT *rSource, - u32 SourceWidth, - u32 SourceHeight, - u32 DestWidth, - u32 DestHeight, + int SourceWidth, + int SourceHeight, + int DestWidth, + int DestHeight, IDirect3DPixelShader9 *PShader, IDirect3DVertexShader9 *Vshader, float Gamma = 1.0f); void drawShadedTexSubQuad(IDirect3DTexture9 *texture, const MathUtil::Rectangle *rSource, - u32 SourceWidth, - u32 SourceHeight, + int SourceWidth, + int SourceHeight, const MathUtil::Rectangle *rDest, - u32 DestWidth, - u32 DestHeight, + int DestWidth, + int DestHeight, IDirect3DPixelShader9 *PShader, IDirect3DVertexShader9 *Vshader, float Gamma = 1.0f); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp index f1d1fa3133..1903bce989 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp @@ -44,8 +44,8 @@ FramebufferManager::Efb FramebufferManager::s_efb; FramebufferManager::FramebufferManager() { bool depth_textures_supported = true; - u32 target_width = Renderer::GetTargetWidth(); - u32 target_height = Renderer::GetTargetHeight(); + int target_width = Renderer::GetTargetWidth(); + int target_height = Renderer::GetTargetHeight(); s_efb.color_surface_Format = D3DFMT_A8R8G8B8; // EFB color texture - primary render target @@ -161,7 +161,7 @@ void FramebufferManager::GetTargetSize(unsigned int *width, unsigned int *height } void XFBSource::Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const + const MathUtil::Rectangle &drawrc, int width, int height) const { D3D::drawShadedTexSubQuad(texture, &sourcerc, texWidth, texHeight, &drawrc, width , height, PixelShaderCache::GetColorCopyProgram(0), VertexShaderCache::GetSimpleVertexShader(0)); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h index dad5eda513..5b5993a12b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h @@ -58,7 +58,7 @@ struct XFBSource : public XFBSourceBase ~XFBSource() { texture->Release(); } void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const; + const MathUtil::Rectangle &drawrc, int width, int height) const; void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight); void CopyEFB(float Gamma); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 8bd5cda969..f750313642 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -288,10 +288,10 @@ Renderer::Renderer() UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); s_LastAA = g_ActiveConfig.iMultisampleMode; - u32 SupersampleCoefficient = (s_LastAA % 3) + 1; + int SupersampleCoeficient = (s_LastAA % 3) + 1; s_LastEFBScale = g_ActiveConfig.iEFBScale; - CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoefficient); + CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoeficient); // Make sure to use valid texture sizes D3D::FixTextureSize(s_target_width, s_target_height); @@ -305,7 +305,7 @@ Renderer::Renderer() SetupDeviceObjects(); - for (u32 stage = 0; stage < 8; stage++) + for (int stage = 0; stage < 8; stage++) D3D::SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, 1 << g_ActiveConfig.iMaxAnisotropy); D3DVIEWPORT9 vp; @@ -468,10 +468,8 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // if depth textures aren't supported by the hardware, just return if (type == PEEK_Z) - { if (FramebufferManager::GetEFBDepthTexture() == NULL) return 0; - } // We're using three surfaces here: // - pEFBSurf: EFB Surface. Source surface when peeking, destination surface when poking. @@ -695,14 +693,16 @@ void Renderer::UpdateViewport(Matrix44& vpCorrection) } // In D3D, the viewport rectangle must fit within the render target. - u32 X = intendedX; - u32 Y = intendedY; - u32 Wd = intendedWd; - u32 Ht = intendedHt; - + int X = intendedX; + if (X < 0) + X = 0; + int Y = intendedY; + if (Y < 0) + Y = 0; + int Wd = intendedWd; if (X + Wd > GetTargetWidth()) Wd = GetTargetWidth() - X; - + int Ht = intendedHt; if (Y + Ht > GetTargetHeight()) Ht = GetTargetHeight() - Y; @@ -907,14 +907,18 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); } - u32 X = GetTargetRectangle().left; - u32 Y = GetTargetRectangle().top; - u32 Width = (GetTargetRectangle().right - GetTargetRectangle().left); - u32 Height = (GetTargetRectangle().bottom - GetTargetRectangle().top); + int X = GetTargetRectangle().left; + int Y = GetTargetRectangle().top; + int Width = GetTargetRectangle().right - GetTargetRectangle().left; + int Height = GetTargetRectangle().bottom - GetTargetRectangle().top; // Sanity check + if (X < 0) X = 0; + if (Y < 0) Y = 0; if (X > s_backbuffer_width) X = s_backbuffer_width; if (Y > s_backbuffer_height) Y = s_backbuffer_height; + if (Width < 0) Width = 0; + if (Height < 0) Height = 0; if (Width > (s_backbuffer_width - X)) Width = s_backbuffer_width - X; if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y; @@ -1149,10 +1153,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); - u32 SupersampleCoefficient = (s_LastAA % 3) + 1; + int SupersampleCoeficient = (s_LastAA % 3) + 1; s_LastEFBScale = g_ActiveConfig.iEFBScale; - CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoefficient); + CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoeficient); D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface()); D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface()); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp index 08c1ecc64d..0e37c3adb6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp @@ -299,7 +299,7 @@ GLuint FramebufferManager::ResolveAndGetDepthTarget(const EFBRectangle &source_r } void XFBSource::Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const + const MathUtil::Rectangle &drawrc, int width, int height) const { // Texture map xfbSource->texture onto the main buffer diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.h b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.h index d077b2f2ac..ffe3399705 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.h @@ -63,7 +63,7 @@ struct XFBSource : public XFBSourceBase void CopyEFB(float Gamma); void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight); void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const; + const MathUtil::Rectangle &drawrc, int width, int height) const; const GLuint texture; }; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 3f62db8787..e3c35a6511 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -323,8 +323,8 @@ Renderer::Renderer() return; // TODO: fail // Decide frambuffer size - s_backbuffer_width = GLInterface->GetBackBufferWidth(); - s_backbuffer_height = GLInterface->GetBackBufferHeight(); + s_backbuffer_width = (int)GLInterface->GetBackBufferWidth(); + s_backbuffer_height = (int)GLInterface->GetBackBufferHeight(); // Handle VSync on/off #ifdef __APPLE__ @@ -1047,7 +1047,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons // Textured triangles are necessary because of post-processing shaders // Disable all other stages - for (unsigned int i = 1; i < 8; ++i) + for (int i = 1; i < 8; ++i) OGL::TextureCache::DisableStage(i); // Update GLViewPort