Fix some other off-by-one errors in DX9/DX11.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6560 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
3b6b8b718c
commit
5d16185cf9
|
@ -658,10 +658,10 @@ void Renderer::UpdateViewport()
|
||||||
ERROR_LOG(VIDEO, "Tried to set a viewport which is too wide to emulate with Direct3D11. Requested EFB size is %dx%d\n", Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight());
|
ERROR_LOG(VIDEO, "Tried to set a viewport which is too wide to emulate with Direct3D11. Requested EFB size is %dx%d\n", Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight());
|
||||||
|
|
||||||
// Fix the viewport to fit to the old EFB size, TODO: Check this for off-by-one errors
|
// Fix the viewport to fit to the old EFB size, TODO: Check this for off-by-one errors
|
||||||
newx *= (float)old_fulltarget_w / (float)Renderer::GetFullTargetWidth();
|
newx *= (float)(old_fulltarget_w-1) / (float)(Renderer::GetFullTargetWidth()-1);
|
||||||
newy *= (float)old_fulltarget_h / (float)Renderer::GetFullTargetHeight();
|
newy *= (float)(old_fulltarget_h-1) / (float)(Renderer::GetFullTargetHeight()-1);
|
||||||
newwidth *= (float)old_fulltarget_w / (float)Renderer::GetFullTargetWidth();
|
newwidth *= (float)(old_fulltarget_w-1) / (float)(Renderer::GetFullTargetWidth()-1);
|
||||||
newheight *= (float)old_fulltarget_h / (float)Renderer::GetFullTargetHeight();
|
newheight *= (float)(old_fulltarget_h-1) / (float)(Renderer::GetFullTargetHeight()-1);
|
||||||
|
|
||||||
s_Fulltarget_width = old_fulltarget_w;
|
s_Fulltarget_width = old_fulltarget_w;
|
||||||
s_Fulltarget_height = old_fulltarget_h;
|
s_Fulltarget_height = old_fulltarget_h;
|
||||||
|
|
|
@ -692,9 +692,6 @@ void Renderer::UpdateViewport()
|
||||||
int scissorXOff = bpmem.scissorOffset.x << 1;
|
int scissorXOff = bpmem.scissorOffset.x << 1;
|
||||||
int scissorYOff = bpmem.scissorOffset.y << 1;
|
int scissorYOff = bpmem.scissorOffset.y << 1;
|
||||||
|
|
||||||
int Xstride = (Renderer::GetFullTargetWidth() - Renderer::GetTargetWidth()) / 2;
|
|
||||||
int Ystride = (Renderer::GetFullTargetHeight() - Renderer::GetTargetHeight()) / 2;
|
|
||||||
|
|
||||||
// TODO: ceil, floor or just cast to int?
|
// TODO: ceil, floor or just cast to int?
|
||||||
int X = EFBToScaledX((int)ceil(xfregs.rawViewport[3] - xfregs.rawViewport[0] - scissorXOff)) + TargetStrideX();
|
int X = EFBToScaledX((int)ceil(xfregs.rawViewport[3] - xfregs.rawViewport[0] - scissorXOff)) + TargetStrideX();
|
||||||
int Y = EFBToScaledY((int)ceil(xfregs.rawViewport[4] + xfregs.rawViewport[1] - scissorYOff)) + TargetStrideY();
|
int Y = EFBToScaledY((int)ceil(xfregs.rawViewport[4] + xfregs.rawViewport[1] - scissorYOff)) + TargetStrideY();
|
||||||
|
@ -740,16 +737,16 @@ void Renderer::UpdateViewport()
|
||||||
{
|
{
|
||||||
D3DCAPS9 caps = D3D::GetCaps();
|
D3DCAPS9 caps = D3D::GetCaps();
|
||||||
// Make sure that the requested size is actually supported by the GFX driver
|
// Make sure that the requested size is actually supported by the GFX driver
|
||||||
if (Renderer::GetFullTargetWidth() > caps.MaxTextureWidth || Renderer::GetFullTargetHeight() > caps.MaxTextureHeight)
|
if (Renderer::GetFullTargetWidth() > (int)caps.MaxTextureWidth || Renderer::GetFullTargetHeight() > (int)caps.MaxTextureHeight)
|
||||||
{
|
{
|
||||||
// Skip EFB recreation and viewport setting. Most likely causes 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 Direct3D9. Requested EFB size is %dx%d, keeping the %dx%d EFB now\n", Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(), old_fulltarget_w, old_fulltarget_h);
|
ERROR_LOG(VIDEO, "Tried to set a viewport which is too wide to emulate with Direct3D9. Requested EFB size is %dx%d, keeping the %dx%d EFB now\n", Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(), old_fulltarget_w, old_fulltarget_h);
|
||||||
|
|
||||||
// Fix the viewport to fit to the old EFB size, TODO: Check this for off-by-one errors
|
// Fix the viewport to fit to the old EFB size
|
||||||
X *= old_fulltarget_w / Renderer::GetFullTargetWidth();
|
X *= (old_fulltarget_w-1) / (Renderer::GetFullTargetWidth()-1);
|
||||||
Y *= old_fulltarget_h / Renderer::GetFullTargetHeight();
|
Y *= (old_fulltarget_h-1) / (Renderer::GetFullTargetHeight()-1);
|
||||||
Width *= old_fulltarget_w / Renderer::GetFullTargetWidth();
|
Width *= (old_fulltarget_w-1) / (Renderer::GetFullTargetWidth()-1);
|
||||||
Height *= old_fulltarget_h / Renderer::GetFullTargetHeight();
|
Height *= (old_fulltarget_h-1) / (Renderer::GetFullTargetHeight()-1);
|
||||||
|
|
||||||
s_Fulltarget_width = old_fulltarget_w;
|
s_Fulltarget_width = old_fulltarget_w;
|
||||||
s_Fulltarget_height = old_fulltarget_h;
|
s_Fulltarget_height = old_fulltarget_h;
|
||||||
|
|
|
@ -781,9 +781,6 @@ void Renderer::UpdateViewport()
|
||||||
int scissorXOff = bpmem.scissorOffset.x << 1;
|
int scissorXOff = bpmem.scissorOffset.x << 1;
|
||||||
int scissorYOff = bpmem.scissorOffset.y << 1;
|
int scissorYOff = bpmem.scissorOffset.y << 1;
|
||||||
|
|
||||||
// int Xstride = (s_Fulltarget_width - s_target_width) / 2;
|
|
||||||
// int Ystride = (s_Fulltarget_height - s_target_height) / 2;
|
|
||||||
|
|
||||||
// TODO: ceil, floor or just cast to int?
|
// TODO: ceil, floor or just cast to int?
|
||||||
int X = EFBToScaledX((int)ceil(xfregs.rawViewport[3] - xfregs.rawViewport[0] - (float)scissorXOff));
|
int X = EFBToScaledX((int)ceil(xfregs.rawViewport[3] - xfregs.rawViewport[0] - (float)scissorXOff));
|
||||||
int Y = EFBToScaledY((int)ceil((float)EFB_HEIGHT - xfregs.rawViewport[4] + xfregs.rawViewport[1] + (float)scissorYOff));
|
int Y = EFBToScaledY((int)ceil((float)EFB_HEIGHT - xfregs.rawViewport[4] + xfregs.rawViewport[1] + (float)scissorYOff));
|
||||||
|
|
Loading…
Reference in New Issue