summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/TextureCache.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2015-12-28 01:13:42 +0100
committerMarkus Wick <degasus@users.noreply.github.com>2015-12-28 01:13:42 +0100
commit294bb753164b58eb0a1e9317eaf05ce3d5bb0209 (patch)
treeb8d7599b04718d94288fd2a7220ee4e8df296cc1 /Source/Core/VideoBackends/D3D/TextureCache.cpp
parent52d6a7505a3dc5c1a89d0795dcdcb20d7d01aff4 (diff)
parent63264ac23f3b9cfaa725cf90d995497ba1601449 (diff)
Merge pull request #3295 from stenzek/d3d-xfb-msaa
D3D: Fix multiple issues relating to MSAA
Diffstat (limited to 'Source/Core/VideoBackends/D3D/TextureCache.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/TextureCache.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/D3D/TextureCache.cpp b/Source/Core/VideoBackends/D3D/TextureCache.cpp
index ff2bd39cc5..d6233f9203 100644
--- a/Source/Core/VideoBackends/D3D/TextureCache.cpp
+++ b/Source/Core/VideoBackends/D3D/TextureCache.cpp
@@ -190,6 +190,21 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry
void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool scaleByHalf, unsigned int cbufid, const float *colmat)
{
+ // When copying at half size, in multisampled mode, resolve the color/depth buffer first.
+ // This is because multisampled texture reads go through Load, not Sample, and the linear
+ // filter is ignored.
+ bool multisampled = (g_ActiveConfig.iMultisampleMode != 0);
+ ID3D11ShaderResourceView* efbTexSRV = (srcFormat == PEControl::Z24) ?
+ FramebufferManager::GetEFBDepthTexture()->GetSRV() :
+ FramebufferManager::GetEFBColorTexture()->GetSRV();
+ if (multisampled && scaleByHalf)
+ {
+ multisampled = false;
+ efbTexSRV = (srcFormat == PEControl::Z24) ?
+ FramebufferManager::GetResolvedEFBDepthTexture()->GetSRV() :
+ FramebufferManager::GetResolvedEFBColorTexture()->GetSRV();
+ }
+
g_renderer->ResetAPIState();
// stretch picture with increased internal resolution
@@ -226,10 +241,10 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat
// Create texture copy
D3D::drawShadedTexQuad(
- (srcFormat == PEControl::Z24 ? FramebufferManager::GetEFBDepthTexture() : FramebufferManager::GetEFBColorTexture())->GetSRV(),
+ efbTexSRV,
&sourcerect, Renderer::GetTargetWidth(),
Renderer::GetTargetHeight(),
- srcFormat == PEControl::Z24 ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
+ srcFormat == PEControl::Z24 ? PixelShaderCache::GetDepthMatrixProgram(multisampled) : PixelShaderCache::GetColorMatrixProgram(multisampled),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(),
GeometryShaderCache::GetCopyGeometryShader());