diff options
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 38895c2e9..c77332b46 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -504,17 +504,11 @@ void TextureCache<P>::BlitImage(const Tegra::Engines::Fermi2D::Surface& dst, | |||
| 504 | is_dst_rescaled = True(dst_image.flags & ImageFlagBits::Rescaled); | 504 | is_dst_rescaled = True(dst_image.flags & ImageFlagBits::Rescaled); |
| 505 | } | 505 | } |
| 506 | const auto& resolution = Settings::values.resolution_info; | 506 | const auto& resolution = Settings::values.resolution_info; |
| 507 | const auto scale_up = [&](u32 value) -> u32 { | ||
| 508 | if (value == 0) { | ||
| 509 | return 0U; | ||
| 510 | } | ||
| 511 | return std::max<u32>((value * resolution.up_scale) >> resolution.down_shift, 1U); | ||
| 512 | }; | ||
| 513 | const auto scale_region = [&](Region2D& region) { | 507 | const auto scale_region = [&](Region2D& region) { |
| 514 | region.start.x = scale_up(region.start.x); | 508 | region.start.x = resolution.ScaleUp(region.start.x); |
| 515 | region.start.y = scale_up(region.start.y); | 509 | region.start.y = resolution.ScaleUp(region.start.y); |
| 516 | region.end.x = scale_up(region.end.x); | 510 | region.end.x = resolution.ScaleUp(region.end.x); |
| 517 | region.end.y = scale_up(region.end.y); | 511 | region.end.y = resolution.ScaleUp(region.end.y); |
| 518 | }; | 512 | }; |
| 519 | 513 | ||
| 520 | // TODO: Deduplicate | 514 | // TODO: Deduplicate |
| @@ -1721,20 +1715,14 @@ void TextureCache<P>::CopyImage(ImageId dst_id, ImageId src_id, std::vector<Imag | |||
| 1721 | ASSERT(True(dst.flags & ImageFlagBits::Rescaled)); | 1715 | ASSERT(True(dst.flags & ImageFlagBits::Rescaled)); |
| 1722 | const bool both_2d{src.info.type == ImageType::e2D && dst.info.type == ImageType::e2D}; | 1716 | const bool both_2d{src.info.type == ImageType::e2D && dst.info.type == ImageType::e2D}; |
| 1723 | const auto& resolution = Settings::values.resolution_info; | 1717 | const auto& resolution = Settings::values.resolution_info; |
| 1724 | const auto scale_up = [&](u32 value) -> u32 { | ||
| 1725 | if (value == 0) { | ||
| 1726 | return 0U; | ||
| 1727 | } | ||
| 1728 | return std::max<u32>((value * resolution.up_scale) >> resolution.down_shift, 1U); | ||
| 1729 | }; | ||
| 1730 | for (auto& copy : copies) { | 1718 | for (auto& copy : copies) { |
| 1731 | copy.src_offset.x = scale_up(copy.src_offset.x); | 1719 | copy.src_offset.x = resolution.ScaleUp(copy.src_offset.x); |
| 1732 | copy.dst_offset.x = scale_up(copy.dst_offset.x); | 1720 | copy.dst_offset.x = resolution.ScaleUp(copy.dst_offset.x); |
| 1733 | copy.extent.width = scale_up(copy.extent.width); | 1721 | copy.extent.width = resolution.ScaleUp(copy.extent.width); |
| 1734 | if (both_2d) { | 1722 | if (both_2d) { |
| 1735 | copy.src_offset.y = scale_up(copy.src_offset.y); | 1723 | copy.src_offset.y = resolution.ScaleUp(copy.src_offset.y); |
| 1736 | copy.dst_offset.y = scale_up(copy.dst_offset.y); | 1724 | copy.dst_offset.y = resolution.ScaleUp(copy.dst_offset.y); |
| 1737 | copy.extent.height = scale_up(copy.extent.height); | 1725 | copy.extent.height = resolution.ScaleUp(copy.extent.height); |
| 1738 | } | 1726 | } |
| 1739 | } | 1727 | } |
| 1740 | } | 1728 | } |
| @@ -1812,12 +1800,9 @@ std::pair<FramebufferId, ImageViewId> TextureCache<P>::RenderTargetFromImage( | |||
| 1812 | Extent3D extent = MipSize(image.info.size, view_info.range.base.level); | 1800 | Extent3D extent = MipSize(image.info.size, view_info.range.base.level); |
| 1813 | if (is_rescaled) { | 1801 | if (is_rescaled) { |
| 1814 | const auto& resolution = Settings::values.resolution_info; | 1802 | const auto& resolution = Settings::values.resolution_info; |
| 1815 | const auto scale_up = [&](u32 value) { | 1803 | extent.width = resolution.ScaleUp(extent.width); |
| 1816 | return std::max<u32>((value * resolution.up_scale) >> resolution.down_shift, 1U); | ||
| 1817 | }; | ||
| 1818 | extent.width = scale_up(extent.width); | ||
| 1819 | if (image.info.type == ImageType::e2D) { | 1804 | if (image.info.type == ImageType::e2D) { |
| 1820 | extent.height = scale_up(extent.height); | 1805 | extent.height = resolution.ScaleUp(extent.height); |
| 1821 | } | 1806 | } |
| 1822 | } | 1807 | } |
| 1823 | const u32 num_samples = image.info.num_samples; | 1808 | const u32 num_samples = image.info.num_samples; |