summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/TextureCache.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2015-11-28 21:33:47 +1000
committerStenzek <stenzek@gmail.com>2015-12-08 20:29:21 +1000
commit63264ac23f3b9cfaa725cf90d995497ba1601449 (patch)
tree2e3934b26e064f9e794006223ed4a2d3ee3c657c /Source/Core/VideoBackends/D3D/TextureCache.cpp
parent5e803c3db3fa27b943d3d7789086789946eed6a7 (diff)
D3D: Fix EFB depth buffer copies, filtering on scaled EFB copies when MSAA is enabled, real XFB filtering
Since ResolveSubresource cannot be used with depth textures (and throws an error with the debug layer enabled), use a shader which selects the minimum depth value from all samples. Changes the sampler by XFBEncoder to use a linear filter, rather than point, to match GL behavior.
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 0de91068c7..49f60feeb5 100644
--- a/Source/Core/VideoBackends/D3D/TextureCache.cpp
+++ b/Source/Core/VideoBackends/D3D/TextureCache.cpp
@@ -188,6 +188,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
@@ -224,10 +239,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());