From 79387dddb24ddf035b70cd9379a42368dcd49e93 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 29 May 2017 17:02:09 -0500 Subject: Add support for hybrid XFB --- Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp') diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp index 9b24783f6a..7c05215948 100644 --- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp +++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp @@ -41,8 +41,11 @@ void PSTextureEncoder::Init() HRESULT hr; // Create output texture RGBA format + // TODO: This Texture is overly large and parts of it are unused + // EFB2RAM copies use max (EFB_WIDTH * 4) by (EFB_HEIGHT / 4) + // XFB2RAM copies use max (EFB_WIDTH / 2) by (EFB_HEIGHT) D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, - EFB_HEIGHT / 4, 1, 1, D3D11_BIND_RENDER_TARGET); + EFB_HEIGHT, 1, 1, D3D11_BIND_RENDER_TARGET); hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out); CHECK(SUCCEEDED(hr), "create efb encode output texture"); D3D::SetDebugObjectName(m_out, "efb encoder output texture"); -- cgit v1.2.3 From b285188de1a38565b9718bdac7fe698ee870d914 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sun, 2 Jul 2017 21:24:20 -0500 Subject: Video Backends: Implement vertical scaling for xfb copies. This fixes the display of PAL games that run in 50hz mode. --- Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp') diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp index 7c05215948..2aafb299bf 100644 --- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp +++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp @@ -26,6 +26,8 @@ struct EFBEncodeParams s32 SrcTop; u32 DestWidth; u32 ScaleFactor; + float y_scale; + u32 padding[3]; }; PSTextureEncoder::PSTextureEncoder() @@ -45,7 +47,7 @@ void PSTextureEncoder::Init() // EFB2RAM copies use max (EFB_WIDTH * 4) by (EFB_HEIGHT / 4) // XFB2RAM copies use max (EFB_WIDTH / 2) by (EFB_HEIGHT) D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, - EFB_HEIGHT, 1, 1, D3D11_BIND_RENDER_TARGET); + 1024, 1, 1, D3D11_BIND_RENDER_TARGET); hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out); CHECK(SUCCEEDED(hr), "create efb encode output texture"); D3D::SetDebugObjectName(m_out, "efb encoder output texture"); @@ -127,6 +129,7 @@ void PSTextureEncoder::Encode(u8* dst, const EFBCopyParams& params, u32 native_w encode_params.SrcTop = src_rect.top; encode_params.DestWidth = native_width; encode_params.ScaleFactor = scale_by_half ? 2 : 1; + encode_params.y_scale = params.y_scale; D3D::context->UpdateSubresource(m_encodeParams, 0, nullptr, &encode_params, 0, 0); D3D::stateman->SetPixelConstants(m_encodeParams); @@ -134,7 +137,7 @@ void PSTextureEncoder::Encode(u8* dst, const EFBCopyParams& params, u32 native_w // TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more // complex down filtering to average all pixels and produce the correct result. // Also, box filtering won't be correct for anything other than 1x IR - if (scale_by_half || g_renderer->GetEFBScale() != 1) + if (scale_by_half || g_renderer->GetEFBScale() != 1 || params.y_scale > 1.0f) D3D::SetLinearCopySampler(); else D3D::SetPointCopySampler(); -- cgit v1.2.3 From 53684701fa1f9a787f8d089d864c5c1c97effa8c Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 2 Sep 2017 21:30:34 -0500 Subject: HybridXFB: Fix lint errors --- Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp') diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp index 2aafb299bf..4fcce4ef03 100644 --- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp +++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp @@ -46,8 +46,8 @@ void PSTextureEncoder::Init() // TODO: This Texture is overly large and parts of it are unused // EFB2RAM copies use max (EFB_WIDTH * 4) by (EFB_HEIGHT / 4) // XFB2RAM copies use max (EFB_WIDTH / 2) by (EFB_HEIGHT) - D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, - 1024, 1, 1, D3D11_BIND_RENDER_TARGET); + D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, 1024, + 1, 1, D3D11_BIND_RENDER_TARGET); hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out); CHECK(SUCCEEDED(hr), "create efb encode output texture"); D3D::SetDebugObjectName(m_out, "efb encoder output texture"); -- cgit v1.2.3