diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 17132ebb8c..7e5c0dc8fe 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -54,7 +54,7 @@ public: virtual void SetColorMask() = 0; virtual void SetBlendMode(bool forceUpdate) = 0; - virtual bool SetScissorRect() = 0; + virtual void SetScissorRect() = 0; virtual void SetGenerationMode() = 0; virtual void SetDepthMode() = 0; virtual void SetLogicOpMode() = 0; diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index d0756bfa98..2c2f3037f6 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -444,51 +444,21 @@ bool Renderer::CheckForResize() return false; } -bool Renderer::SetScissorRect() +void Renderer::SetScissorRect() { - TargetRectangle rc; + EFBRectangle rc; GetScissorRect(rc); if (rc.left < 0) rc.left = 0; - if (rc.right < 0) rc.right = 0; if (rc.top < 0) rc.top = 0; - if (rc.bottom < 0) rc.bottom = 0; - - if (rc.left > EFB_WIDTH) rc.left = EFB_WIDTH; if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH; - if (rc.top > EFB_HEIGHT) rc.top = EFB_HEIGHT; if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT; - rc.left = EFBToScaledX(rc.left); - rc.right = EFBToScaledX(rc.right); - rc.top = EFBToScaledY(rc.top); - rc.bottom = EFBToScaledY(rc.bottom); + if (rc.left > rc.right) rc.right = rc.left; + if (rc.top > rc.bottom) rc.bottom = rc.top; - 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; - } - - if (rc.right >= rc.left && rc.bottom >= rc.top) - { - D3D::context->RSSetScissorRects(1, rc.AsRECT()); - return true; - } - else - { - //WARN_LOG(VIDEO, "Bad scissor rectangle: %i %i %i %i", rc.left, rc.top, rc.right, rc.bottom); - *rc.AsRECT() = CD3D11_RECT(0.f, 0.f, s_target_width, s_target_height); - D3D::context->RSSetScissorRects(1, rc.AsRECT()); - return false; - } + TargetRectangle trc = ConvertEFBRectangle(rc); + D3D::context->RSSetScissorRects(1, trc.AsRECT()); } void Renderer::SetColorMask() diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.h b/Source/Plugins/Plugin_VideoDX11/Src/Render.h index 5d1c24bc23..bc6dcba2bd 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.h @@ -15,7 +15,7 @@ public: void SetColorMask(); void SetBlendMode(bool forceUpdate); - bool SetScissorRect(); + void SetScissorRect(); void SetGenerationMode(); void SetDepthMode(); void SetLogicOpMode(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index e333cbc168..59af978107 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -426,55 +426,21 @@ bool Renderer::CheckForResize() return false; } -bool Renderer::SetScissorRect() +void Renderer::SetScissorRect() { - TargetRectangle rc; + EFBRectangle rc; GetScissorRect(rc); if (rc.left < 0) rc.left = 0; - if (rc.right < 0) rc.right = 0; if (rc.top < 0) rc.top = 0; - if (rc.bottom < 0) rc.bottom = 0; - - if (rc.left > EFB_WIDTH) rc.left = EFB_WIDTH; if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH; - if (rc.top > EFB_HEIGHT) rc.top = EFB_HEIGHT; if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT; - 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; - } + if (rc.left > rc.right) rc.right = rc.left; + if (rc.top > rc.bottom) rc.bottom = rc.top; - rc.left = EFBToScaledX(rc.left); - rc.top = EFBToScaledY(rc.top); - rc.right = EFBToScaledX(rc.right); - rc.bottom = EFBToScaledY(rc.bottom); - - // Check that the coordinates are good - if (rc.right != rc.left && rc.bottom != rc.top) - { - D3D::dev->SetScissorRect(rc.AsRECT()); - return true; - } - else - { - //WARN_LOG(VIDEO, "Bad scissor rectangle: %i %i %i %i", rc.left, rc.top, rc.right, rc.bottom); - rc.left = 0; - rc.top = 0; - rc.right = s_target_width; - rc.bottom = s_target_height; - D3D::dev->SetScissorRect(rc.AsRECT()); - } - return false; + TargetRectangle trc = ConvertEFBRectangle(rc); + D3D::dev->SetScissorRect(trc.AsRECT()); } void Renderer::SetColorMask() diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.h b/Source/Plugins/Plugin_VideoDX9/Src/Render.h index b3c89f82f9..6ba40de063 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.h @@ -15,7 +15,7 @@ public: void SetColorMask(); void SetBlendMode(bool forceUpdate); - bool SetScissorRect(); + void SetScissorRect(); void SetGenerationMode(); void SetDepthMode(); void SetLogicOpMode(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index a54e1dd3f5..1567c9825b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -642,9 +642,9 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc) // Renderer::GetTargetHeight() = the fixed ini file setting // donkopunchstania - it appears scissorBR is the bottom right pixel inside the scissor box // therefore the width and height are (scissorBR + 1) - scissorTL -bool Renderer::SetScissorRect() +void Renderer::SetScissorRect() { - MathUtil::Rectangle rc; + EFBRectangle rc; GetScissorRect(rc); if (rc.left < 0) rc.left = 0; @@ -655,12 +655,8 @@ bool Renderer::SetScissorRect() if (rc.left > rc.right) rc.right = rc.left; if (rc.top > rc.bottom) rc.bottom = rc.top; - glScissor( - EFBToScaledX(rc.left), // x = 0 for example - EFBToScaledY(EFB_HEIGHT - rc.bottom), // y = 0 for example - EFBToScaledX(rc.right - rc.left), // width = 640 for example - EFBToScaledY(rc.bottom - rc.top)); // height = 480 for example - return true; + TargetRectangle trc = ConvertEFBRectangle(rc); + glScissor(trc.left, trc.bottom, trc.GetWidth(), trc.GetHeight()); } void Renderer::SetColorMask() diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index 5805c524ae..b14617bed6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h @@ -15,7 +15,7 @@ public: void SetColorMask(); void SetBlendMode(bool forceUpdate); - bool SetScissorRect(); + void SetScissorRect(); void SetGenerationMode(); void SetDepthMode(); void SetLogicOpMode();