From 7930e1ea861ccb1021e4547e183bf2e8864d2a29 Mon Sep 17 00:00:00 2001 From: GPUCode <47210458+GPUCode@users.noreply.github.com> Date: Wed, 8 Nov 2023 04:13:03 +0200 Subject: [PATCH] rasterizer_cache: Avoid dumping render targets (#7130) --- .../rasterizer_cache/rasterizer_cache.h | 15 +++++---------- src/video_core/rasterizer_cache/surface_base.h | 11 ++++++----- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/video_core/rasterizer_cache/rasterizer_cache.h b/src/video_core/rasterizer_cache/rasterizer_cache.h index 648d5e4f0a..efb3eeb58b 100644 --- a/src/video_core/rasterizer_cache/rasterizer_cache.h +++ b/src/video_core/rasterizer_cache/rasterizer_cache.h @@ -653,7 +653,6 @@ FramebufferHelper RasterizerCache::GetFramebufferSurfaces(bool using_color static_cast(std::clamp(viewport_rect.bottom, 0, framebuffer_height)), }; - // get color and depth surfaces SurfaceParams color_params; color_params.is_tiled = true; color_params.res_scale = resolution_scale_factor; @@ -672,14 +671,6 @@ FramebufferHelper RasterizerCache::GetFramebufferSurfaces(bool using_color auto color_vp_interval = color_params.GetSubRectInterval(viewport_clamped); auto depth_vp_interval = depth_params.GetSubRectInterval(viewport_clamped); - // Make sure that framebuffers don't overlap if both color and depth are being used - if (using_color_fb && using_depth_fb && - boost::icl::length(color_vp_interval & depth_vp_interval)) { - LOG_CRITICAL(HW_GPU, "Color and depth framebuffer memory regions overlap; " - "overlapping framebuffers not supported!"); - using_depth_fb = false; - } - Common::Rectangle color_rect{}; SurfaceId color_id{}; u32 color_level{}; @@ -713,11 +704,13 @@ FramebufferHelper RasterizerCache::GetFramebufferSurfaces(bool using_color if (color_id) { color_level = color_surface->LevelOf(color_params.addr); + color_surface->flags |= SurfaceFlagBits::RenderTarget; ValidateSurface(color_id, boost::icl::first(color_vp_interval), boost::icl::length(color_vp_interval)); } if (depth_id) { depth_level = depth_surface->LevelOf(depth_params.addr); + depth_surface->flags |= SurfaceFlagBits::RenderTarget; ValidateSurface(depth_id, boost::icl::first(depth_vp_interval), boost::icl::length(depth_vp_interval)); } @@ -991,7 +984,9 @@ void RasterizerCache::UploadSurface(Surface& surface, SurfaceInterval interva DecodeTexture(load_info, load_info.addr, load_info.end, upload_data, staging.mapped, runtime.NeedsConversion(surface.pixel_format)); - if (dump_textures && False(surface.flags & SurfaceFlagBits::Custom)) { + const bool should_dump = False(surface.flags & SurfaceFlagBits::Custom) && + False(surface.flags & SurfaceFlagBits::RenderTarget); + if (dump_textures && should_dump) { const u64 hash = ComputeHash(load_info, upload_data); const u32 level = surface.LevelOf(load_info.addr); custom_tex_manager.DumpTexture(load_info, level, upload_data, hash); diff --git a/src/video_core/rasterizer_cache/surface_base.h b/src/video_core/rasterizer_cache/surface_base.h index 19c0959dab..e786a82b04 100644 --- a/src/video_core/rasterizer_cache/surface_base.h +++ b/src/video_core/rasterizer_cache/surface_base.h @@ -15,11 +15,12 @@ using SurfaceRegions = boost::icl::interval_set