From 5818959e543041fdff8965e71e52d55a05ee22de Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Thu, 11 Jul 2019 15:15:21 -0400 Subject: Texture_Cache: Force Framebuffer reset if an active render target is unregistered. --- src/video_core/texture_cache/surface_params.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/video_core/texture_cache/surface_params.cpp') diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index 9c56e2b4f..df9260859 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp @@ -290,12 +290,19 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size, bool uncompressed) const { - const bool tiled{as_host_size ? false : is_tiled}; const u32 width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())}; const u32 height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())}; const u32 depth{is_layered ? 1U : GetMipDepth(level)}; - return Tegra::Texture::CalculateSize(tiled, GetBytesPerPixel(), width, height, depth, - GetMipBlockHeight(level), GetMipBlockDepth(level)); + if (is_tiled) { + return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, depth, + GetMipBlockHeight(level), GetMipBlockDepth(level)); + } else { + if (as_host_size || IsBuffer()) { + return GetBytesPerPixel()*width*height*depth; + } else { + return pitch*height*depth; + } + } } bool SurfaceParams::operator==(const SurfaceParams& rhs) const { -- cgit v1.2.3 From 0f54b541f4877eda87ad968708fa38ce604c3a80 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 14 Jul 2019 08:41:06 -0400 Subject: Texture_Cache: Remove some unprecise fallback case and clang format --- src/video_core/texture_cache/surface_params.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/video_core/texture_cache/surface_params.cpp') diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index df9260859..33c94daa8 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp @@ -294,13 +294,14 @@ std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size const u32 height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())}; const u32 depth{is_layered ? 1U : GetMipDepth(level)}; if (is_tiled) { - return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, depth, - GetMipBlockHeight(level), GetMipBlockDepth(level)); + return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, + depth, GetMipBlockHeight(level), + GetMipBlockDepth(level)); } else { if (as_host_size || IsBuffer()) { - return GetBytesPerPixel()*width*height*depth; + return GetBytesPerPixel() * width * height * depth; } else { - return pitch*height*depth; + return pitch * height * depth; } } } -- cgit v1.2.3 From 2ac7472d3f94f1adb33c0a1d7748e922c515f6a8 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 14 Jul 2019 17:42:39 -0400 Subject: Texture_Cache: Address Feedback --- src/video_core/texture_cache/surface_params.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/video_core/texture_cache/surface_params.cpp') diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index 33c94daa8..fd5472451 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp @@ -297,12 +297,11 @@ std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, depth, GetMipBlockHeight(level), GetMipBlockDepth(level)); + } else if (as_host_size || IsBuffer()) { + return GetBytesPerPixel() * width * height * depth; } else { - if (as_host_size || IsBuffer()) { - return GetBytesPerPixel() * width * height * depth; - } else { - return pitch * height * depth; - } + // Linear Texture Case + return pitch * height * depth; } } -- cgit v1.2.3