Merge pull request #9717 from unknownbrackets/d3d9-halfpixel

D3D9: Correct half-pixel offset
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2017-05-24 08:59:29 +02:00
commit da8ac556e4
1 file changed
+4 -4
+4 -4
View File
@@ -249,9 +249,9 @@ void ShaderManagerDX9::VSSetMatrix(int creg, const float* pMatrix) {
// Depth in ogl is between -1;1 we need between 0;1 and optionally reverse it
static void ConvertProjMatrixToD3D(Matrix4x4 &in, bool invertedX, bool invertedY) {
// Half pixel offset hack
float xoff = 0.5f / gstate_c.curRTRenderWidth;
float xoff = 1.0f / gstate_c.curRTRenderWidth;
xoff = gstate_c.vpXOffset + (invertedX ? xoff : -xoff);
float yoff = -0.5f / gstate_c.curRTRenderHeight;
float yoff = -1.0f / gstate_c.curRTRenderHeight;
yoff = gstate_c.vpYOffset + (invertedY ? yoff : -yoff);
if (invertedX)
@@ -265,8 +265,8 @@ static void ConvertProjMatrixToD3D(Matrix4x4 &in, bool invertedX, bool invertedY
}
static void ConvertProjMatrixToD3DThrough(Matrix4x4 &in) {
float xoff = -0.5f / gstate_c.curRTRenderWidth;
float yoff = 0.5f / gstate_c.curRTRenderHeight;
float xoff = -1.0f / gstate_c.curRTRenderWidth;
float yoff = 1.0f / gstate_c.curRTRenderHeight;
in.translateAndScale(Vec3(xoff, yoff, 0.5f), Vec3(1.0f, 1.0f, 0.5f));
}