summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@googlemail.com>2010-07-12 15:10:27 +0000
committerNeoBrainX <NeoBrainX@googlemail.com>2010-07-12 15:10:27 +0000
commitdcc51e0ef8fece409f093ea4d9124903562aedcd (patch)
tree37791bdb5d4bc131ee0dffb43bba7d82ef25abe3 /Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
parentff917cb0c93354deb08ffa32a37ffdf3b90610ff (diff)
DX9/DX11, improvement to r5870: Instead of skipping SetViewport(), fix the viewport to match the old EFB dimensions.
Should reduce or even fix most graphical glitches caused by huge viewports in HD resolutions. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5873 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoDX11/Src/Render.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/Render.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
index 1ab07b4130..d5a81ee5ec 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
@@ -740,25 +740,39 @@ void UpdateViewport()
Y = 0;
sizeChanged=true;
}
+
+ float newx = (float)X;
+ float newy = (float)Y;
+ float newwidth = (float)Width;
+ float newheight = (float)Height;
if (sizeChanged)
{
// Make sure that the requested size is actually supported by the GFX driver
if (s_Fulltarget_width > (int)D3D::GetMaxTextureSize() || s_Fulltarget_height > (int)D3D::GetMaxTextureSize())
{
- // Skip EFB recreation and viewport setting. Most likely cause glitches in this case, but prevents crashes at least
+ // Skip EFB recreation and viewport setting. Most likely causes glitches in this case, but prevents crashes at least
ERROR_LOG(VIDEO, "Tried to set a viewport which is too wide to emulate with Direct3D11. Requested EFB size is %dx%d\n", s_Fulltarget_width, s_Fulltarget_height);
+
+ // Fix the viewport to fit to the old EFB size, TODO: Check this for off-by-one errors
+ newx *= (float)old_fulltarget_w / (float)s_Fulltarget_width;
+ newy *= (float)old_fulltarget_h / (float)s_Fulltarget_height;
+ newwidth *= (float)old_fulltarget_w / (float)s_Fulltarget_width;
+ newheight *= (float)old_fulltarget_h / (float)s_Fulltarget_height;
+
s_Fulltarget_width = old_fulltarget_w;
s_Fulltarget_height = old_fulltarget_h;
- return;
}
- D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL);
- FBManager.Destroy();
- FBManager.Create();
- D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV());
+ else
+ {
+ D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL);
+ FBManager.Destroy();
+ FBManager.Create();
+ D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV());
+ }
}
// some games set invalids values MinDepth and MaxDepth so fix them to the max an min allowed and let the shaders do this work
- D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height,
+ D3D11_VIEWPORT vp = CD3D11_VIEWPORT(newx, newy, newwidth, newheight,
0.f, // (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f;
1.f); // xfregs.rawViewport[5] / 16777216.0f;
D3D::context->RSSetViewports(1, &vp);