diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-05-18 10:57:49 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-21 02:38:33 +0200 |
commit | 175aa343ff1c9f931b266caf2d19b8df943dab0d (patch) | |
tree | c9cdf1f449232c7fc0728be6bbc86d8537ff44aa /src/video_core/texture_cache/surface_params.h | |
parent | gl_shader_decompiler: Implement image binding settings (diff) | |
download | yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.tar yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.tar.gz yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.tar.bz2 yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.tar.lz yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.tar.xz yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.tar.zst yuzu-175aa343ff1c9f931b266caf2d19b8df943dab0d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/texture_cache/surface_params.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/surface_params.h b/src/video_core/texture_cache/surface_params.h index b3082173f..13a08a60f 100644 --- a/src/video_core/texture_cache/surface_params.h +++ b/src/video_core/texture_cache/surface_params.h @@ -126,6 +126,20 @@ public: /// Returns the size of a layer in bytes in host memory for a given mipmap level. std::size_t GetHostLayerSize(u32 level) const; + static u32 ConvertWidth(u32 width, VideoCore::Surface::PixelFormat pixel_format_from, + VideoCore::Surface::PixelFormat pixel_format_to) { + const u32 bw1 = VideoCore::Surface::GetDefaultBlockWidth(pixel_format_from); + const u32 bw2 = VideoCore::Surface::GetDefaultBlockWidth(pixel_format_to); + return (width * bw2 + bw1 - 1) / bw1; + } + + static u32 ConvertHeight(u32 height, VideoCore::Surface::PixelFormat pixel_format_from, + VideoCore::Surface::PixelFormat pixel_format_to) { + const u32 bh1 = VideoCore::Surface::GetDefaultBlockHeight(pixel_format_from); + const u32 bh2 = VideoCore::Surface::GetDefaultBlockHeight(pixel_format_to); + return (height * bh2 + bh1 - 1) / bh1; + } + /// Returns the default block width. u32 GetDefaultBlockWidth() const { return VideoCore::Surface::GetDefaultBlockWidth(pixel_format); |