Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BBox: Changed the rounding again, the old one fixed Paper Mario but h…
…ad bugs in Mickey's Magical Mirror. This change fixes the glitches in both games.

Also fixed some compiler warnings.
  • Loading branch information
crudelios committed Jan 26, 2014
1 parent d3fd0ed commit 9b6c6fa
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/D3D/D3DUtil.cpp
Expand Up @@ -556,7 +556,7 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture,
}

void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
const MathUtil::Rectangle<float>* rSource,
const MathUtil::Rectangle<int>* rSource,
int SourceWidth,
int SourceHeight,
const MathUtil::Rectangle<float>* rDest,
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/D3D/D3DUtil.h
Expand Up @@ -62,7 +62,7 @@ namespace D3D
ID3D11InputLayout* layout,
float Gamma = 1.0f);
void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
const MathUtil::Rectangle<float>* rSource,
const MathUtil::Rectangle<int>* rSource,
int SourceWidth,
int SourceHeight,
const MathUtil::Rectangle<float>* rDest,
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/D3D/FramebufferManager.cpp
Expand Up @@ -179,7 +179,7 @@ void FramebufferManager::GetTargetSize(unsigned int *width, unsigned int *height
*height = targetSource.bottom - targetSource.top;
}

void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
void XFBSource::Draw(const MathUtil::Rectangle<int> &sourcerc,
const MathUtil::Rectangle<float> &drawrc) const
{
D3D::drawShadedTexSubQuad(tex->GetSRV(), &sourcerc,
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/D3D/FramebufferManager.h
Expand Up @@ -50,7 +50,7 @@ struct XFBSource : public XFBSourceBase
XFBSource(D3DTexture2D *_tex) : tex(_tex) {}
~XFBSource() { tex->Release(); }

void Draw(const MathUtil::Rectangle<float> &sourcerc,
void Draw(const MathUtil::Rectangle<int> &sourcerc,
const MathUtil::Rectangle<float> &drawrc) const;
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
void CopyEFB(float Gamma);
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/VideoBackends/D3D/Render.cpp
Expand Up @@ -791,12 +791,12 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
for (u32 i = 0; i < xfbCount; ++i)
{
xfbSource = xfbSourceList[i];
MathUtil::Rectangle<float> sourceRc;
MathUtil::Rectangle<int> sourceRc;

sourceRc.left = 0;
sourceRc.top = 0;
sourceRc.right = (float)xfbSource->texWidth;
sourceRc.bottom = (float)xfbSource->texHeight;
sourceRc.right = (int)xfbSource->texWidth;
sourceRc.bottom = (int)xfbSource->texHeight;

MathUtil::Rectangle<float> drawRc;

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/D3D/Television.cpp
Expand Up @@ -147,7 +147,7 @@ void Television::Render()
// line down. We could even consider implementing a deinterlacing
// algorithm.

MathUtil::Rectangle<float> sourceRc(0.f, 0.f, float(m_curWidth), float(m_curHeight));
MathUtil::Rectangle<int> sourceRc(0, 0, int(m_curWidth), int(m_curHeight));
MathUtil::Rectangle<float> destRc(-1.f, 1.f, 1.f, -1.f);

D3D::context->PSSetSamplers(0, 1, &m_samplerState);
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoBackends/OGL/FramebufferManager.cpp
Expand Up @@ -394,13 +394,13 @@ XFBSource::~XFBSource()
}


void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
void XFBSource::Draw(const MathUtil::Rectangle<int> &sourcerc,
const MathUtil::Rectangle<float> &drawrc) const
{
// Texture map xfbSource->texture onto the main buffer
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
glBlitFramebuffer(sourcerc.left, sourcerc.bottom, sourcerc.right, sourcerc.top,
drawrc.left, drawrc.bottom, drawrc.right, drawrc.top,
(int)drawrc.left, (int)drawrc.bottom, (int)drawrc.right, (int)drawrc.top,
GL_COLOR_BUFFER_BIT, GL_LINEAR);

GL_REPORT_ERRORD();
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/OGL/FramebufferManager.h
Expand Up @@ -51,7 +51,7 @@ struct XFBSource : public XFBSourceBase

void CopyEFB(float Gamma) override;
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) override;
void Draw(const MathUtil::Rectangle<float> &sourcerc,
void Draw(const MathUtil::Rectangle<int> &sourcerc,
const MathUtil::Rectangle<float> &drawrc) const override;

const GLuint texture;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/OGL/Render.cpp
Expand Up @@ -1352,7 +1352,7 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
// Tell the OSD Menu about the current internal resolution
OSDInternalW = xfbSource->sourceRc.GetWidth(); OSDInternalH = xfbSource->sourceRc.GetHeight();

MathUtil::Rectangle<float> sourceRc;
MathUtil::Rectangle<int> sourceRc;
sourceRc.left = xfbSource->sourceRc.left;
sourceRc.right = xfbSource->sourceRc.right;
sourceRc.top = xfbSource->sourceRc.top;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/DriverDetails.cpp
Expand Up @@ -34,7 +34,7 @@ namespace DriverDetails

Vendor m_vendor = VENDOR_UNKNOWN;
Driver m_driver = DRIVER_UNKNOWN;
s32 m_family = 0.0;
s32 m_family = 0;
double m_version = 0.0;

// This is a list of all known bugs for each vendor
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/FramebufferManagerBase.h
Expand Up @@ -15,7 +15,7 @@ struct XFBSourceBase
{
virtual ~XFBSourceBase() {}

virtual void Draw(const MathUtil::Rectangle<float> &sourcerc,
virtual void Draw(const MathUtil::Rectangle<int> &sourcerc,
const MathUtil::Rectangle<float> &drawrc) const = 0;

virtual void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) = 0;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/VertexLoader.cpp
Expand Up @@ -254,8 +254,8 @@ void LOADERDECL UpdateBoundingBox()
}

// Convert to screen space and add the point to the list - round like the real hardware
s_bbox_points[s_bbox_currPoint].x = (((s32) (0.5f + (16.0f * (screenPoint[0] * xfregs.viewport.wd + (xfregs.viewport.xOrig - 342.0f))))) - 9) >> 4;
s_bbox_points[s_bbox_currPoint].y = (((s32) (0.5f + (16.0f * (screenPoint[1] * xfregs.viewport.ht + (xfregs.viewport.yOrig - 342.0f))))) - 9) >> 4;
s_bbox_points[s_bbox_currPoint].x = (((s32) (0.5f + (16.0f * (screenPoint[0] * xfregs.viewport.wd + (xfregs.viewport.xOrig - 342.0f))))) + 3) >> 4;
s_bbox_points[s_bbox_currPoint].y = (((s32) (0.5f + (16.0f * (screenPoint[1] * xfregs.viewport.ht + (xfregs.viewport.yOrig - 342.0f))))) + 3) >> 4;
s_bbox_points[s_bbox_currPoint].z = screenPoint[2];

// Update point list for primitive
Expand Down

0 comments on commit 9b6c6fa

Please sign in to comment.