From 7037504dcf983a1292590b31f528ff12439b8bfa Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 2 Nov 2017 15:10:07 +0300 Subject: [PATCH] rsx: Workaround for missing AA flags on some surfaces - This just doesnt work right yet. It looks like AA is being used dynamically? (RDR) - TODO: Try to locate flags to set AA if AA mode is not changed --- rpcs3/Emu/RSX/Common/texture_cache.h | 54 ++++++++++++++++++++++++++-- rpcs3/Emu/RSX/RSXThread.h | 2 +- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index dbed8d245..03ae68022 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -1001,11 +1001,36 @@ namespace rsx if (extended_dimension != rsx::texture_dimension_extended::texture_dimension_2d) LOG_ERROR(RSX, "Texture resides in render target memory, but requested type is not 2D (%d)", (u32)extended_dimension); + const auto surface_width = texptr->get_surface_width(); + const auto surface_height = texptr->get_surface_height(); + u32 internal_width = tex_width; u32 internal_height = tex_height; get_native_dimensions(internal_width, internal_height, (u32)tex_pitch, texptr); - bool requires_processing = texptr->get_surface_width() != internal_width || texptr->get_surface_height() != internal_height; + if (internal_width > surface_width || internal_height > surface_height) + { + //An AA flag is likely missing + //HACK + auto aa_mode = texptr->aa_mode; + if ((internal_width >> 1) == surface_width) + { + if (internal_height > surface_height) + texptr->aa_mode = rsx::surface_antialiasing::square_centered_4_samples; + else + texptr->aa_mode = rsx::surface_antialiasing::diagonal_centered_2_samples; + + internal_width = tex_width; + internal_height = tex_height; + get_native_dimensions(internal_width, internal_height, (u32)tex_pitch, texptr); + } + + internal_width = std::min(internal_width, (u32)surface_width); + internal_height = std::min(internal_height, (u32)surface_height); + texptr->aa_mode = aa_mode; + } + + bool requires_processing = surface_width != internal_width || surface_height != internal_height; if (!requires_processing) { for (const auto& tex : m_rtts.m_bound_render_targets) @@ -1052,11 +1077,36 @@ namespace rsx if (extended_dimension != rsx::texture_dimension_extended::texture_dimension_2d) LOG_ERROR(RSX, "Texture resides in depth buffer memory, but requested type is not 2D (%d)", (u32)extended_dimension); + const auto surface_width = texptr->get_surface_width(); + const auto surface_height = texptr->get_surface_height(); + u32 internal_width = tex_width; u32 internal_height = tex_height; get_native_dimensions(internal_width, internal_height, (u32)tex_pitch, texptr); - bool requires_processing = texptr->get_surface_width() != internal_width || texptr->get_surface_height() != internal_height; + if (internal_width > surface_width || internal_height > surface_height) + { + //An AA flag is likely missing + //HACK + auto aa_mode = texptr->aa_mode; + if ((internal_width >> 1) == surface_width) + { + if (internal_height > surface_height) + texptr->aa_mode = rsx::surface_antialiasing::square_centered_4_samples; + else + texptr->aa_mode = rsx::surface_antialiasing::diagonal_centered_2_samples; + + internal_width = tex_width; + internal_height = tex_height; + get_native_dimensions(internal_width, internal_height, (u32)tex_pitch, texptr); + } + + internal_width = std::min(internal_width, (u32)surface_width); + internal_height = std::min(internal_height, (u32)surface_height); + texptr->aa_mode = aa_mode; + } + + bool requires_processing = surface_width != internal_width || surface_height != internal_height; if (!requires_processing && texaddr == std::get<0>(m_rtts.m_bound_depth_stencil)) { if (g_cfg.video.strict_rendering_mode) diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index ecbda23b7..25025efbd 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -263,7 +263,7 @@ namespace rsx virtual u64 timestamp() const; virtual bool on_access_violation(u32 /*address*/, bool /*is_writing*/) { return false; } virtual void on_notify_memory_unmapped(u32 /*address_base*/, u32 /*size*/) {} - virtual void notify_tile_unbound(u32 tile) {} + virtual void notify_tile_unbound(u32 /*tile*/) {} //zcull virtual void notify_zcull_info_changed() {}