From b18c1fb1bbbcc235e9a1cbbb2704fed2e5895e61 Mon Sep 17 00:00:00 2001 From: Ameer J <52414509+ameerj@users.noreply.github.com> Date: Sun, 6 Aug 2023 14:49:34 -0400 Subject: HACK: Avoid swizzling and reuploading ASTC image every frame --- src/video_core/textures/decoders.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/video_core/textures/decoders.cpp') diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 95bcdd37b..dde4b0904 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp @@ -88,6 +88,7 @@ void SwizzleImpl(std::span output, std::span input, u32 width, u32 } } + template void SwizzleSubrectImpl(std::span output, std::span input, u32 width, u32 height, u32 depth, u32 origin_x, u32 origin_y, u32 extent_x, u32 num_lines, @@ -95,6 +96,14 @@ void SwizzleSubrectImpl(std::span output, std::span input, u32 wid // The origin of the transformation can be configured here, leave it as zero as the current API // doesn't expose it. static constexpr u32 origin_z = 0; + static u32 last_width = 0; + static u32 last_height = 0; + if (last_width == width && last_height == height) { + return; + } + LOG_ERROR(Debug, "Called"); + last_width = width; + last_height = height; // We can configure here a custom pitch // As it's not exposed 'width * BYTES_PER_PIXEL' will be the expected pitch. -- cgit v1.2.3