Video: stride in bytes rather than pixels

This commit is contained in:
booto 2015-07-25 02:48:56 +08:00
parent c43ae67b3b
commit efd250494d
4 changed files with 9 additions and 9 deletions

View File

@ -288,7 +288,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
D3D::stateman->PushDepthState(m_xfbEncodeDepthState); D3D::stateman->PushDepthState(m_xfbEncodeDepthState);
D3D::stateman->PushRasterizerState(m_xfbEncodeRastState); D3D::stateman->PushRasterizerState(m_xfbEncodeRastState);
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(width/2), FLOAT(height)); D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(width/4), FLOAT(height));
D3D::context->RSSetViewports(1, &vp); D3D::context->RSSetViewports(1, &vp);
D3D::stateman->SetInputLayout(m_quadLayout); D3D::stateman->SetInputLayout(m_quadLayout);
@ -300,7 +300,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
TargetRectangle targetRect = g_renderer->ConvertEFBRectangle(srcRect); TargetRectangle targetRect = g_renderer->ConvertEFBRectangle(srcRect);
XFBEncodeParams params = { 0 }; XFBEncodeParams params = { 0 };
params.Width = FLOAT(width); params.Width = FLOAT(width/2);
params.Height = FLOAT(height); params.Height = FLOAT(height);
params.TexLeft = FLOAT(targetRect.left) / g_renderer->GetTargetWidth(); params.TexLeft = FLOAT(targetRect.left) / g_renderer->GetTargetWidth();
params.TexTop = FLOAT(targetRect.top) / g_renderer->GetTargetHeight(); params.TexTop = FLOAT(targetRect.top) / g_renderer->GetTargetHeight();
@ -325,7 +325,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
// Copy to staging buffer // Copy to staging buffer
D3D11_BOX srcBox = CD3D11_BOX(0, 0, 0, width/2, height, 1); D3D11_BOX srcBox = CD3D11_BOX(0, 0, 0, width/4, height, 1);
D3D::context->CopySubresourceRegion(m_outStage, 0, 0, 0, 0, m_out, 0, &srcBox); D3D::context->CopySubresourceRegion(m_outStage, 0, 0, 0, 0, m_out, 0, &srcBox);
// Clean up state // Clean up state
@ -353,7 +353,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
u8* src = (u8*)map.pData; u8* src = (u8*)map.pData;
for (unsigned int y = 0; y < height; ++y) for (unsigned int y = 0; y < height; ++y)
{ {
memcpy(dst, src, 2*width); memcpy(dst, src, width);
dst += bpmem.copyMipMapStrideChannels*32; dst += bpmem.copyMipMapStrideChannels*32;
src += map.RowPitch; src += map.RowPitch;
} }

View File

@ -335,7 +335,7 @@ void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* des
// We enable linear filtering, because the GameCube does filtering in the vertical direction when // We enable linear filtering, because the GameCube does filtering in the vertical direction when
// yscale is enabled. // yscale is enabled.
// Otherwise we get jaggies when a game uses yscaling (most PAL games) // Otherwise we get jaggies when a game uses yscaling (most PAL games)
EncodeToRamUsingShader(srcTexture, destAddr, dstWidth * 2, dstHeight, dstStride * 2, true); EncodeToRamUsingShader(srcTexture, destAddr, dstWidth * 2, dstHeight, dstStride, true);
FramebufferManager::SetFramebuffer(0); FramebufferManager::SetFramebuffer(0);
TextureCache::DisableStage(0); TextureCache::DisableStage(0);
g_renderer->RestoreAPIState(); g_renderer->RestoreAPIState();

View File

@ -251,7 +251,7 @@ static void BPWritten(const BPCmd& bp)
height = MAX_XFB_HEIGHT; height = MAX_XFB_HEIGHT;
} }
u32 stride = bpmem.copyMipMapStrideChannels << 4; u32 stride = bpmem.copyMipMapStrideChannels << 5;
WARN_LOG(VIDEO, "RenderToXFB: destAddr: %08x | srcRect {%d %d %d %d} | fbWidth: %u | fbStride: %u | fbHeight: %u", WARN_LOG(VIDEO, "RenderToXFB: destAddr: %08x | srcRect {%d %d %d %d} | fbWidth: %u | fbStride: %u | fbHeight: %u",
destAddr, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, bpmem.copyTexSrcWH.x + 1, stride, height); destAddr, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, bpmem.copyTexSrcWH.x + 1, stride, height);
Renderer::RenderToXFB(destAddr, srcRect, stride, height, s_gammaLUT[PE_copy.gamma]); Renderer::RenderToXFB(destAddr, srcRect, stride, height, s_gammaLUT[PE_copy.gamma]);

View File

@ -123,9 +123,9 @@ void FramebufferManagerBase::CopyToXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight,
CopyToVirtualXFB(xfbAddr, fbStride, fbHeight, sourceRc, Gamma); CopyToVirtualXFB(xfbAddr, fbStride, fbHeight, sourceRc, Gamma);
} }
void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma) void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma)
{ {
VirtualXFBListType::iterator vxfb = FindVirtualXFB(xfbAddr, fbWidth, fbHeight); VirtualXFBListType::iterator vxfb = FindVirtualXFB(xfbAddr, sourceRc.GetWidth(), fbHeight);
if (m_virtualXFBList.end() == vxfb) if (m_virtualXFBList.end() == vxfb)
{ {
@ -165,7 +165,7 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHe
} }
vxfb->xfbSource->srcAddr = vxfb->xfbAddr = xfbAddr; vxfb->xfbSource->srcAddr = vxfb->xfbAddr = xfbAddr;
vxfb->xfbSource->srcWidth = vxfb->xfbWidth = fbWidth; vxfb->xfbSource->srcWidth = vxfb->xfbWidth = sourceRc.GetWidth();
vxfb->xfbSource->srcHeight = vxfb->xfbHeight = fbHeight; vxfb->xfbSource->srcHeight = vxfb->xfbHeight = fbHeight;
vxfb->xfbSource->sourceRc = g_renderer->ConvertEFBRectangle(sourceRc); vxfb->xfbSource->sourceRc = g_renderer->ConvertEFBRectangle(sourceRc);