TextureCache: Extract BP enum check to VideoCommon.

We have TOO many video backends.
This commit is contained in:
degasus
2016-12-26 20:54:37 +01:00
parent d07d9ba499
commit 04f319066d
23 changed files with 112 additions and 135 deletions

View File

@ -179,7 +179,7 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry
}
}
void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat srcFormat,
void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, bool is_depth_copy,
const EFBRectangle& srcRect, bool scaleByHalf,
unsigned int cbufid, const float* colmat)
{
@ -187,15 +187,14 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat
// This is because multisampled texture reads go through Load, not Sample, and the linear
// filter is ignored.
bool multisampled = (g_ActiveConfig.iMultisamples > 1);
ID3D11ShaderResourceView* efbTexSRV = (srcFormat == PEControl::Z24) ?
ID3D11ShaderResourceView* efbTexSRV = is_depth_copy ?
FramebufferManager::GetEFBDepthTexture()->GetSRV() :
FramebufferManager::GetEFBColorTexture()->GetSRV();
if (multisampled && scaleByHalf)
{
multisampled = false;
efbTexSRV = (srcFormat == PEControl::Z24) ?
FramebufferManager::GetResolvedEFBDepthTexture()->GetSRV() :
FramebufferManager::GetResolvedEFBColorTexture()->GetSRV();
efbTexSRV = is_depth_copy ? FramebufferManager::GetResolvedEFBDepthTexture()->GetSRV() :
FramebufferManager::GetResolvedEFBColorTexture()->GetSRV();
}
g_renderer->ResetAPIState();
@ -239,8 +238,8 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat
// Create texture copy
D3D::drawShadedTexQuad(
efbTexSRV, &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
srcFormat == PEControl::Z24 ? PixelShaderCache::GetDepthMatrixProgram(multisampled) :
PixelShaderCache::GetColorMatrixProgram(multisampled),
is_depth_copy ? PixelShaderCache::GetDepthMatrixProgram(multisampled) :
PixelShaderCache::GetColorMatrixProgram(multisampled),
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(),
GeometryShaderCache::GetCopyGeometryShader());
@ -251,11 +250,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat
}
void TextureCache::CopyEFB(u8* dst, u32 format, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, PEControl::PixelFormat srcFormat,
u32 num_blocks_y, u32 memory_stride, bool is_depth_copy,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
{
g_encoder->Encode(dst, format, native_width, bytes_per_row, num_blocks_y, memory_stride,
srcFormat, srcRect, isIntensity, scaleByHalf);
is_depth_copy, srcRect, isIntensity, scaleByHalf);
}
const char palette_shader[] =