diff options
| author | NeoBrainX <NeoBrainX@googlemail.com> | 2011-09-05 22:04:28 +0200 |
|---|---|---|
| committer | NeoBrainX <NeoBrainX@googlemail.com> | 2011-09-05 22:04:28 +0200 |
| commit | 17fcd406fcf68059ee5c0e940d42e9bcdcd32842 (patch) | |
| tree | b1e7515857ebe5843e525188d97a5d5895272385 /Source/Plugins | |
| parent | b867c21fea6401c0f9886129621bb0dbae962a4a (diff) | |
Merge some scissor rect related code to VideoCommon.
Diffstat (limited to 'Source/Plugins')
| -rw-r--r-- | Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 19 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoDX11/Src/Render.h | 2 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 19 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoDX9/Src/Render.h | 2 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 19 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/Render.h | 2 |
6 files changed, 15 insertions, 48 deletions
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 2c2f3037f6..bbf2a966dd 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -42,6 +42,7 @@ #include "Movie.h" #include "Television.h" #include "Host.h" +#include "BPFunctions.h" namespace DX11 { @@ -444,21 +445,9 @@ bool Renderer::CheckForResize() return false; } -void Renderer::SetScissorRect() +void Renderer::SetScissorRect(const TargetRectangle& rc) { - EFBRectangle rc; - GetScissorRect(rc); - - if (rc.left < 0) rc.left = 0; - if (rc.top < 0) rc.top = 0; - if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH; - if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT; - - if (rc.left > rc.right) rc.right = rc.left; - if (rc.top > rc.bottom) rc.bottom = rc.top; - - TargetRectangle trc = ConvertEFBRectangle(rc); - D3D::context->RSSetScissorRects(1, trc.AsRECT()); + D3D::context->RSSetScissorRects(1, rc.AsRECT()); } void Renderer::SetColorMask() @@ -1133,7 +1122,7 @@ void Renderer::RestoreAPIState() D3D::stateman->PopDepthState(); D3D::stateman->PopRasterizerState(); VertexShaderManager::SetViewportChanged(); - SetScissorRect(); + BPFunctions::SetScissor(); } void Renderer::ApplyState(bool bUseDstAlpha) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.h b/Source/Plugins/Plugin_VideoDX11/Src/Render.h index bc6dcba2bd..8f6c78fae1 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); - void SetScissorRect(); + void SetScissorRect(const TargetRectangle& rc); 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 59af978107..15b592e800 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -53,6 +53,7 @@ #include "Debugger.h" #include "Core.h" #include "Movie.h" +#include "BPFunctions.h" namespace DX9 { @@ -426,21 +427,9 @@ bool Renderer::CheckForResize() return false; } -void Renderer::SetScissorRect() +void Renderer::SetScissorRect(const TargetRectangle& rc) { - EFBRectangle rc; - GetScissorRect(rc); - - if (rc.left < 0) rc.left = 0; - if (rc.top < 0) rc.top = 0; - if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH; - if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT; - - if (rc.left > rc.right) rc.right = rc.left; - if (rc.top > rc.bottom) rc.bottom = rc.top; - - TargetRectangle trc = ConvertEFBRectangle(rc); - D3D::dev->SetScissorRect(trc.AsRECT()); + D3D::dev->SetScissorRect(rc.AsRECT()); } void Renderer::SetColorMask() @@ -1259,7 +1248,7 @@ void Renderer::RestoreAPIState() D3D::SetRenderState(D3DRS_FILLMODE, g_ActiveConfig.bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID); D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); VertexShaderManager::SetViewportChanged(); - SetScissorRect(); + BPFunctions::SetScissor(); if (bpmem.zmode.testenable) { D3D::SetRenderState(D3DRS_ZENABLE, TRUE); if (bpmem.zmode.updateenable) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.h b/Source/Plugins/Plugin_VideoDX9/Src/Render.h index 6ba40de063..6e5198b3cd 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); - void SetScissorRect(); + void SetScissorRect(const TargetRectangle& rc); 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 1567c9825b..ca3280673e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -60,6 +60,7 @@ #include "Core.h" #include "Movie.h" #include "Host.h" +#include "BPFunctions.h" #include "main.h" // Local #ifdef _WIN32 @@ -642,21 +643,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 -void Renderer::SetScissorRect() +void Renderer::SetScissorRect(const TargetRectangle& rc) { - EFBRectangle rc; - GetScissorRect(rc); - - if (rc.left < 0) rc.left = 0; - if (rc.top < 0) rc.top = 0; - if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH; - if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT; - - if (rc.left > rc.right) rc.right = rc.left; - if (rc.top > rc.bottom) rc.bottom = rc.top; - - TargetRectangle trc = ConvertEFBRectangle(rc); - glScissor(trc.left, trc.bottom, trc.GetWidth(), trc.GetHeight()); + glScissor(rc.left, rc.bottom, rc.GetWidth(), rc.GetHeight()); } void Renderer::SetColorMask() @@ -1404,7 +1393,7 @@ void Renderer::RestoreAPIState() // Gets us back into a more game-like state. glEnable(GL_SCISSOR_TEST); SetGenerationMode(); - SetScissorRect(); + BPFunctions::SetScissor(); SetColorMask(); SetDepthMode(); SetBlendMode(true); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index b14617bed6..032a9a222c 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); - void SetScissorRect(); + void SetScissorRect(const TargetRectangle& rc); void SetGenerationMode(); void SetDepthMode(); void SetLogicOpMode(); |
