mirror of https://github.com/PCSX2/pcsx2.git
GSdx:
- Converted an upscale hack to the format I plan to use from now on. (Also makes this hack work better :p) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2422 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
b23499887a
commit
ff30e8148b
|
@ -29,8 +29,7 @@ class GSRendererDX : public GSRendererHW<Vertex>
|
|||
GSVector2 m_pixelcenter;
|
||||
bool m_logz;
|
||||
bool m_fba;
|
||||
int m_pixoff_x;
|
||||
int m_pixoff_y;
|
||||
bool UserHacks_HalfPixelOffset;
|
||||
|
||||
protected:
|
||||
int m_topology;
|
||||
|
@ -45,8 +44,7 @@ public:
|
|||
{
|
||||
m_logz = !!theApp.GetConfig("logz", 0);
|
||||
m_fba = !!theApp.GetConfig("fba", 1);
|
||||
m_pixoff_x = theApp.GetConfig("pixoff_x", 0);
|
||||
m_pixoff_y = theApp.GetConfig("pixoff_y", 0);
|
||||
UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0);
|
||||
}
|
||||
|
||||
virtual ~GSRendererDX()
|
||||
|
@ -192,11 +190,25 @@ public:
|
|||
|
||||
float sx = 2.0f * rt->GetScale().x / (rt->GetWidth() << 4);
|
||||
float sy = 2.0f * rt->GetScale().y / (rt->GetHeight() << 4);
|
||||
float ox = (float)(int)context->XYOFFSET.OFX + m_pixoff_x;
|
||||
float oy = (float)(int)context->XYOFFSET.OFY + m_pixoff_y;
|
||||
float ox = (float)(int)context->XYOFFSET.OFX;
|
||||
float oy = (float)(int)context->XYOFFSET.OFY;
|
||||
float ox2 = 2.0f * m_pixelcenter.x / rt->GetWidth();
|
||||
float oy2 = 2.0f * m_pixelcenter.y / rt->GetHeight();
|
||||
|
||||
//This hack subtracts around half a pixel from OFX and OFY. (Cannot do this directly,
|
||||
//because DX10 and DX9 have a different pixel center.)
|
||||
//
|
||||
//The resulting shifted output aligns better with common blending / corona / blurring effects,
|
||||
//but introduces a few bad pixels on the edges.
|
||||
if (UserHacks_HalfPixelOffset == true)
|
||||
{
|
||||
//DX9 has pixelcenter set to 0.0, so give it some value here
|
||||
if (m_pixelcenter.x == 0 && m_pixelcenter.y == 0) { ox2 = oy2 = -0.00035f; }
|
||||
|
||||
if (ox != 0) { ox2 *= upscale_Multiplier(); }
|
||||
if (oy != 0) { oy2 *= upscale_Multiplier(); }
|
||||
}
|
||||
|
||||
vs_cb.VertexScale = GSVector4(sx, -sy, 1.0f / UINT_MAX, 0.0f);
|
||||
vs_cb.VertexOffset = GSVector4(ox * sx + ox2 + 1, -(oy * sy + oy2 + 1), 0.0f, -1.0f);
|
||||
// gs
|
||||
|
|
|
@ -638,27 +638,6 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
|
||||
GSVector4 dr(0, 0, w, h);
|
||||
|
||||
#ifdef USE_UPSCALE_HACKS
|
||||
float multiplier = (float) m_renderer->upscale_Multiplier()-1;
|
||||
//dr += a few pixels, to fight blur/brightness layers beeing more offset the more we upscale
|
||||
if(w > dstsize.x)
|
||||
{
|
||||
scale.x = (float)dstsize.x / tw;
|
||||
dr.z = (float)dstsize.x * scale.x / dst->m_texture->GetScale().x;
|
||||
w = dstsize.x;
|
||||
dr += GSVector4 (0.25f*multiplier, 0.0f, 0.25f*multiplier, 0.0f);
|
||||
}
|
||||
else dr += GSVector4 (0.500f*multiplier, 0.0f, 0.500f*multiplier, 0.0f);
|
||||
|
||||
if(h > dstsize.y)
|
||||
{
|
||||
scale.y = (float)dstsize.y / th;
|
||||
dr.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y;
|
||||
h = dstsize.y;
|
||||
dr += GSVector4 (0.0f, 0.25f*multiplier, 0.0f, 0.25f*multiplier);
|
||||
}
|
||||
else dr += GSVector4 (0.0f, 0.5f*multiplier, 0.0f, 0.5f*multiplier);
|
||||
#else
|
||||
if(w > dstsize.x)
|
||||
{
|
||||
scale.x = (float)dstsize.x / tw;
|
||||
|
@ -672,7 +651,6 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
dr.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y;
|
||||
h = dstsize.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
GSVector4 sr(0, 0, w, h);
|
||||
|
||||
|
|
Loading…
Reference in New Issue