Skip to content

Commit

Permalink
rsx: Workaround for broken rtt resampling
Browse files Browse the repository at this point in the history
- Avoids WCB requirement for now to keep res scaling working correctly.
- TODO: Fix this properly
  • Loading branch information
kd-11 committed Jan 25, 2020
1 parent c7afc00 commit 7d549f8
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions rpcs3/Emu/RSX/Common/texture_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -1656,31 +1656,36 @@ namespace rsx
}

if (const auto section_count = result.external_subresource_desc.sections_to_copy.size();
section_count > 0 && result.atlas_covers_target_area(section_count == 1? 99 : 90))
section_count > 0)
{
// TODO: Overlapped section persistance is required for framebuffer resources to work with this!
// Yellow filter in SCV is because of a 384x384 surface being reused as 160x90 (and likely not getting written to)
// Its then sampled again here as 384x384 and this does not work! (obviously)
// TODO: Some games may render a small region (e.g 1024x256x2) and sample a huge texture (e.g 1024x1024).
// Seen in APF2k8 - this causes missing bits to be reuploaded from CPU which can cause WCB requirement.
// Properly fix this by introducing partial data upload into the surface cache in such cases and making RCB/RDB
// enabled by default. Blit engine already handles this correctly.

// Optionally disallow caching if resource is being written to as it is being read from
for (const auto& section : overlapping_fbos)
if (_pool == 0 || /* Hack to avoid WCB requirement for some games with wrongly declared sampler dimensions */
result.atlas_covers_target_area(section_count == 1? 99 : 90))
{
if (m_rtts.address_is_bound(section.base_address))
// Optionally disallow caching if resource is being written to as it is being read from
for (const auto& section : overlapping_fbos)
{
if (result.external_subresource_desc.op == deferred_request_command::copy_image_static)
if (m_rtts.address_is_bound(section.base_address))
{
result.external_subresource_desc.op = deferred_request_command::copy_image_dynamic;
if (result.external_subresource_desc.op == deferred_request_command::copy_image_static)
{
result.external_subresource_desc.op = deferred_request_command::copy_image_dynamic;
}
else
{
result.external_subresource_desc.do_not_cache = true;
}

break;
}
else
{
result.external_subresource_desc.do_not_cache = true;
}

break;
}
}

return result;
return result;
}
}
}
}
Expand Down

0 comments on commit 7d549f8

Please sign in to comment.