From 087cb8b5e03714b6821bd8ffbd6fb54b07a7905e Mon Sep 17 00:00:00 2001 From: raven02 Date: Sat, 27 Jul 2013 06:24:59 +0800 Subject: [PATCH] Clamp vpX0/vpY0 to zero when negative value retured --- GPU/GLES/StateMapping.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 6b7a53cc93..501c31bd33 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -364,6 +364,11 @@ void TransformDrawEngine::ApplyDrawState(int prim) { // Flip vpY0 to match the OpenGL coordinate system. vpY0 = renderHeight - (vpY0 + vpHeight); + + // Clamp vpX0/vpY0 to zero when negative value retured. + vpY0 = vpY0 < 0 ? 0 : vpY0; + vpX0 = vpX0 < 0 ? 0 : vpX0; + glstate.viewport.set(vpX0 + renderX, vpY0 + renderY, vpWidth, vpHeight); // Sadly, as glViewport takes integers, we will not be able to support sub pixel offsets this way. But meh. // shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);