diff options
| author | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2009-11-23 14:08:08 +0000 |
|---|---|---|
| committer | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2009-11-23 14:08:08 +0000 |
| commit | 55dc7efaa427f442bec4fa5cdbb7ad0ecba19082 (patch) | |
| tree | a91c84ba52cfdd127b7cbb69e1c6617ef4475146 /Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | |
| parent | 37f1e1ca73596b2f12efba53ef107263bd0eee8c (diff) | |
corrected viewport and scissor test behavior in both plugins.
some code cleanup in d3d.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4605 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/Render.cpp')
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 3fe212055a..6fd6aaa9d4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -700,11 +700,18 @@ bool Renderer::SetScissorRect() rc_bottom *= MValueY; if (rc_bottom > EFB_HEIGHT * MValueY) rc_bottom = EFB_HEIGHT * MValueY; - /*LOG(VIDEO, "Scissor: lt=(%d,%d), rb=(%d,%d,%i), off=(%d,%d)\n", - rc_left, rc_top, - rc_right, rc_bottom, Renderer::GetTargetHeight(), - xoff, yoff - );*/ + if(rc_left > rc_right) + { + int temp = rc_right; + rc_right = rc_left; + rc_left = temp; + } + if(rc_top > rc_bottom) + { + int temp = rc_bottom; + rc_bottom = rc_top; + rc_top = temp; + } // Check that the coordinates are good if (rc_right >= rc_left && rc_bottom >= rc_top) @@ -1333,6 +1340,13 @@ void Renderer::FlipImageData(u8 *data, int w, int h) // Called from VertexShaderManager void UpdateViewport() { + // reversed gxsetviewport(xorig, yorig, width, height, nearz, farz) + // [0] = width/2 + // [1] = height/2 + // [2] = 16777215 * (farz - nearz) + // [3] = xorig + width/2 + 342 + // [4] = yorig + height/2 + 342 + // [5] = 16777215 * farz int scissorXOff = bpmem.scissorOffset.x * 2; // 342 int scissorYOff = bpmem.scissorOffset.y * 2; // 342 @@ -1342,10 +1356,20 @@ void UpdateViewport() // Stretch picture with increased internal resolution int GLx = (int)ceil((xfregs.rawViewport[3] - xfregs.rawViewport[0] - scissorXOff) * MValueX); int GLy = (int)ceil(Renderer::GetTargetHeight() - ((int)(xfregs.rawViewport[4] - xfregs.rawViewport[1] - scissorYOff)) * MValueY); - int GLWidth = (int)ceil(abs((int)(2 * xfregs.rawViewport[0])) * MValueX); - int GLHeight = (int)ceil(abs((int)(2 * xfregs.rawViewport[1])) * MValueY); + int GLWidth = (int)ceil((int)(2 * xfregs.rawViewport[0]) * MValueX); + int GLHeight = (int)ceil((int)(-2 * xfregs.rawViewport[1]) * MValueY); double GLNear = (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f; - double GLFar = xfregs.rawViewport[5] / 16777216.0f; + double GLFar = xfregs.rawViewport[5] / 16777216.0f; + if(GLWidth < 0) + { + GLx += GLWidth; + GLWidth*=-1; + } + if(GLHeight < 0) + { + GLy += GLHeight; + GLHeight *= -1; + } // Update the view port glViewport(GLx, GLy, GLWidth, GLHeight); glDepthRange(GLNear, GLFar); |
