Skip to content

Commit

Permalink
Merge pull request #2778 from booto/im-sorry-d3d
Browse files Browse the repository at this point in the history
Video: Trying to fix D3D/XFB disabled regression
  • Loading branch information
degasus committed Jul 26, 2015
2 parents db42c7c + 9d055ba commit 428e2ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Source/Core/VideoBackends/D3D/FramebufferManager.cpp
Expand Up @@ -162,7 +162,8 @@ FramebufferManager::~FramebufferManager()
void FramebufferManager::CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma)
{
u8* dst = Memory::GetPointer(xfbAddr);
s_xfbEncoder.Encode(dst, fbStride, fbHeight, sourceRc, Gamma);
// below div2 due to dx using pixel width
s_xfbEncoder.Encode(dst, fbStride/2, fbHeight, sourceRc, Gamma);
}

XFBSourceBase* FramebufferManager::CreateXFBSource(unsigned int target_width, unsigned int target_height, unsigned int layers)
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/VideoBackends/D3D/XFBEncoder.cpp
Expand Up @@ -288,7 +288,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
D3D::stateman->PushDepthState(m_xfbEncodeDepthState);
D3D::stateman->PushRasterizerState(m_xfbEncodeRastState);

D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(width/4), FLOAT(height));
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(width/2), FLOAT(height));
D3D::context->RSSetViewports(1, &vp);

D3D::stateman->SetInputLayout(m_quadLayout);
Expand All @@ -300,7 +300,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
TargetRectangle targetRect = g_renderer->ConvertEFBRectangle(srcRect);

XFBEncodeParams params = { 0 };
params.Width = FLOAT(width/2);
params.Width = FLOAT(width);
params.Height = FLOAT(height);
params.TexLeft = FLOAT(targetRect.left) / g_renderer->GetTargetWidth();
params.TexTop = FLOAT(targetRect.top) / g_renderer->GetTargetHeight();
Expand All @@ -325,7 +325,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR

// Copy to staging buffer

D3D11_BOX srcBox = CD3D11_BOX(0, 0, 0, width/4, height, 1);
D3D11_BOX srcBox = CD3D11_BOX(0, 0, 0, width/2, height, 1);
D3D::context->CopySubresourceRegion(m_outStage, 0, 0, 0, 0, m_out, 0, &srcBox);

// Clean up state
Expand Down Expand Up @@ -353,7 +353,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
u8* src = (u8*)map.pData;
for (unsigned int y = 0; y < height; ++y)
{
memcpy(dst, src, width);
memcpy(dst, src, 2*width);
dst += bpmem.copyMipMapStrideChannels*32;
src += map.RowPitch;
}
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/VideoCommon/RenderBase.cpp
Expand Up @@ -127,7 +127,8 @@ void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStri
}
else
{
Swap(xfbAddr, sourceRc.GetWidth(), fbStride, fbHeight, sourceRc, Gamma);
// below div two to convert from bytes to pixels - it expects width, not stride
Swap(xfbAddr, fbStride/2, fbStride/2, fbHeight, sourceRc, Gamma);
}
}

Expand Down

0 comments on commit 428e2ef

Please sign in to comment.