rasterizer_cache: Avoid dumping render targets (#7130)

This commit is contained in:
GPUCode 2023-11-08 04:13:03 +02:00 committed by GitHub
parent 4dd6e12e46
commit 7930e1ea86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 15 deletions

View file

@ -653,7 +653,6 @@ FramebufferHelper<T> RasterizerCache<T>::GetFramebufferSurfaces(bool using_color
static_cast<u32>(std::clamp(viewport_rect.bottom, 0, framebuffer_height)), static_cast<u32>(std::clamp(viewport_rect.bottom, 0, framebuffer_height)),
}; };
// get color and depth surfaces
SurfaceParams color_params; SurfaceParams color_params;
color_params.is_tiled = true; color_params.is_tiled = true;
color_params.res_scale = resolution_scale_factor; color_params.res_scale = resolution_scale_factor;
@ -672,14 +671,6 @@ FramebufferHelper<T> RasterizerCache<T>::GetFramebufferSurfaces(bool using_color
auto color_vp_interval = color_params.GetSubRectInterval(viewport_clamped); auto color_vp_interval = color_params.GetSubRectInterval(viewport_clamped);
auto depth_vp_interval = depth_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<u32> color_rect{}; Common::Rectangle<u32> color_rect{};
SurfaceId color_id{}; SurfaceId color_id{};
u32 color_level{}; u32 color_level{};
@ -713,11 +704,13 @@ FramebufferHelper<T> RasterizerCache<T>::GetFramebufferSurfaces(bool using_color
if (color_id) { if (color_id) {
color_level = color_surface->LevelOf(color_params.addr); color_level = color_surface->LevelOf(color_params.addr);
color_surface->flags |= SurfaceFlagBits::RenderTarget;
ValidateSurface(color_id, boost::icl::first(color_vp_interval), ValidateSurface(color_id, boost::icl::first(color_vp_interval),
boost::icl::length(color_vp_interval)); boost::icl::length(color_vp_interval));
} }
if (depth_id) { if (depth_id) {
depth_level = depth_surface->LevelOf(depth_params.addr); depth_level = depth_surface->LevelOf(depth_params.addr);
depth_surface->flags |= SurfaceFlagBits::RenderTarget;
ValidateSurface(depth_id, boost::icl::first(depth_vp_interval), ValidateSurface(depth_id, boost::icl::first(depth_vp_interval),
boost::icl::length(depth_vp_interval)); boost::icl::length(depth_vp_interval));
} }
@ -991,7 +984,9 @@ void RasterizerCache<T>::UploadSurface(Surface& surface, SurfaceInterval interva
DecodeTexture(load_info, load_info.addr, load_info.end, upload_data, staging.mapped, DecodeTexture(load_info, load_info.addr, load_info.end, upload_data, staging.mapped,
runtime.NeedsConversion(surface.pixel_format)); 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 u64 hash = ComputeHash(load_info, upload_data);
const u32 level = surface.LevelOf(load_info.addr); const u32 level = surface.LevelOf(load_info.addr);
custom_tex_manager.DumpTexture(load_info, level, upload_data, hash); custom_tex_manager.DumpTexture(load_info, level, upload_data, hash);

View file

@ -20,6 +20,7 @@ enum class SurfaceFlagBits : u32 {
Tracked = 1 << 2, ///< Surface is part of a texture cube and should be tracked. Tracked = 1 << 2, ///< Surface is part of a texture cube and should be tracked.
Custom = 1 << 3, ///< Surface texture has been replaced with a custom texture. Custom = 1 << 3, ///< Surface texture has been replaced with a custom texture.
ShadowMap = 1 << 4, ///< Surface is used during shadow rendering. ShadowMap = 1 << 4, ///< Surface is used during shadow rendering.
RenderTarget = 1 << 5, ///< Surface was a render target.
}; };
DECLARE_ENUM_FLAG_OPERATORS(SurfaceFlagBits); DECLARE_ENUM_FLAG_OPERATORS(SurfaceFlagBits);