Merge pull request #8828 from stenzek/gles-readpixels

FramebufferManager: Copy to color format for depth readbacks on GLES
This commit is contained in:
Markus Wick 2020-05-25 08:57:20 +02:00 committed by GitHub
commit 68706973d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 2 deletions

View File

@ -92,6 +92,7 @@ void VideoBackend::FillBackendInfo()
g_Config.backend_info.bSupportsGPUTextureDecoding = true;
g_Config.backend_info.bSupportsCopyToVram = true;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = true;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.bSupportsBitfield = false;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = false;

View File

@ -77,6 +77,7 @@ void VideoBackend::FillBackendInfo()
g_Config.backend_info.bSupportsFramebufferFetch = false;
g_Config.backend_info.bSupportsBackgroundCompiling = true;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = true;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.Adapters = D3DCommon::GetAdapterNames();
g_Config.backend_info.AAModes = DXContext::GetAAModes(g_Config.iAdapter);

View File

@ -52,6 +52,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsBackgroundCompiling = false;
g_Config.backend_info.bSupportsLogicOp = false;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = false;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.bSupportsShaderBinaries = false;
g_Config.backend_info.bSupportsPipelineCacheData = false;

View File

@ -521,6 +521,10 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
// GLES does not support logic op.
g_Config.backend_info.bSupportsLogicOp = false;
// glReadPixels() can't be used with non-color formats. But, if we support
// ARB_get_texture_sub_image (unlikely, except maybe on NVIDIA), we can use that instead.
g_Config.backend_info.bSupportsDepthReadback = g_ogl_config.bSupportsTextureSubImage;
if (GLExtensions::Supports("GL_EXT_shader_framebuffer_fetch"))
{
g_ogl_config.SupportedFramebufferFetch = EsFbFetchType::FbFetchExt;

View File

@ -89,6 +89,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsMultithreading = false;
g_Config.backend_info.bSupportsCopyToVram = true;
g_Config.backend_info.bSupportsLargePoints = true;
g_Config.backend_info.bSupportsDepthReadback = true;
g_Config.backend_info.bSupportsPartialDepthCopies = true;
g_Config.backend_info.bSupportsShaderBinaries = false;
g_Config.backend_info.bSupportsPipelineCacheData = false;

View File

@ -77,6 +77,7 @@ void VideoSoftware::InitBackendInfo()
g_Config.backend_info.bSupportsBPTCTextures = false;
g_Config.backend_info.bSupportsCopyToVram = false;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = false;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.bSupportsFramebufferFetch = false;
g_Config.backend_info.bSupportsBackgroundCompiling = false;

View File

@ -513,7 +513,8 @@ bool FramebufferManager::CreateReadbackFramebuffer()
// Since we can't partially copy from a depth buffer directly to the staging texture in D3D, we
// use an intermediate buffer to avoid copying the whole texture.
if ((IsUsingTiledEFBCache() && !g_ActiveConfig.backend_info.bSupportsPartialDepthCopies) ||
if (!g_ActiveConfig.backend_info.bSupportsDepthReadback ||
(IsUsingTiledEFBCache() && !g_ActiveConfig.backend_info.bSupportsPartialDepthCopies) ||
!AbstractTexture::IsCompatibleDepthAndColorFormats(m_efb_depth_texture->GetFormat(),
GetEFBDepthCopyFormat()) ||
g_renderer->GetEFBScale() != 1)
@ -577,7 +578,8 @@ void FramebufferManager::PopulateEFBCache(bool depth, u32 tile_index)
// buffer directly to a staging texture (must be the whole resource).
const bool force_intermediate_copy =
depth &&
((!g_ActiveConfig.backend_info.bSupportsPartialDepthCopies && IsUsingTiledEFBCache()) ||
(!g_ActiveConfig.backend_info.bSupportsDepthReadback ||
(!g_ActiveConfig.backend_info.bSupportsPartialDepthCopies && IsUsingTiledEFBCache()) ||
!AbstractTexture::IsCompatibleDepthAndColorFormats(m_efb_depth_texture->GetFormat(),
GetEFBDepthCopyFormat()));

View File

@ -229,6 +229,7 @@ struct VideoConfig final
bool bSupportsBackgroundCompiling;
bool bSupportsLargePoints;
bool bSupportsPartialDepthCopies;
bool bSupportsDepthReadback;
bool bSupportsShaderBinaries;
bool bSupportsPipelineCacheData;
} backend_info;