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

@ -229,7 +229,7 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry
}
}
void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat src_format,
void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, bool is_depth_copy,
const EFBRectangle& srcRect, bool scale_by_half,
unsigned int cbuf_id, const float* colmat)
{
@ -237,14 +237,13 @@ 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);
D3DTexture2D* efb_tex = (src_format == PEControl::Z24) ?
FramebufferManager::GetEFBDepthTexture() :
FramebufferManager::GetEFBColorTexture();
D3DTexture2D* efb_tex = is_depth_copy ? FramebufferManager::GetEFBDepthTexture() :
FramebufferManager::GetEFBColorTexture();
if (multisampled && scale_by_half)
{
multisampled = false;
efb_tex = (src_format == PEControl::Z24) ? FramebufferManager::GetResolvedEFBDepthTexture() :
FramebufferManager::GetResolvedEFBColorTexture();
efb_tex = is_depth_copy ? FramebufferManager::GetResolvedEFBDepthTexture() :
FramebufferManager::GetResolvedEFBColorTexture();
}
// set transformation
@ -286,8 +285,8 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, PEControl::PixelFormat
// Create texture copy
D3D::DrawShadedTexQuad(
efb_tex, &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
(src_format == PEControl::Z24) ? StaticShaderCache::GetDepthMatrixPixelShader(multisampled) :
StaticShaderCache::GetColorMatrixPixelShader(multisampled),
is_depth_copy ? StaticShaderCache::GetDepthMatrixPixelShader(multisampled) :
StaticShaderCache::GetColorMatrixPixelShader(multisampled),
StaticShaderCache::GetSimpleVertexShader(),
StaticShaderCache::GetSimpleVertexShaderInputLayout(),
StaticShaderCache::GetCopyGeometryShader(), 1.0f, 0, DXGI_FORMAT_R8G8B8A8_UNORM, false,
@ -305,11 +304,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)
{
s_encoder->Encode(dst, format, native_width, bytes_per_row, num_blocks_y, memory_stride,
srcFormat, srcRect, isIntensity, scaleByHalf);
is_depth_copy, srcRect, isIntensity, scaleByHalf);
}
static const constexpr char s_palette_shader_hlsl[] =