summaryrefslogtreecommitdiffstats
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-12-05 10:51:14 +0100
committerLioncash <mathew1800@gmail.com>2020-12-05 12:39:35 +0100
commit414a87a4f4570344140d77a7985b4d118b754341 (patch)
tree6eac8e13f3333c89d8c0f3428b8664cab63a484a /src/video_core/texture_cache
parentMerge pull request #5124 from lioncash/video-shadow (diff)
downloadyuzu-414a87a4f4570344140d77a7985b4d118b754341.tar
yuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.gz
yuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.bz2
yuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.lz
yuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.xz
yuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.zst
yuzu-414a87a4f4570344140d77a7985b4d118b754341.zip
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/surface_base.cpp27
-rw-r--r--src/video_core/texture_cache/surface_base.h4
-rw-r--r--src/video_core/texture_cache/surface_params.cpp14
3 files changed, 23 insertions, 22 deletions
diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp
index b44c09d71..42a1c0c6f 100644
--- a/src/video_core/texture_cache/surface_base.cpp
+++ b/src/video_core/texture_cache/surface_base.cpp
@@ -167,27 +167,28 @@ std::vector<CopyParams> SurfaceBaseImpl::BreakDownNonLayered(const SurfaceParams
return result;
}
-void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params,
- u8* buffer, u32 level) {
- const u32 width{params.GetMipWidth(level)};
- const u32 height{params.GetMipHeight(level)};
- const u32 block_height{params.GetMipBlockHeight(level)};
- const u32 block_depth{params.GetMipBlockDepth(level)};
+void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory,
+ const SurfaceParams& surface_params, u8* buffer, u32 level) {
+ const u32 width{surface_params.GetMipWidth(level)};
+ const u32 height{surface_params.GetMipHeight(level)};
+ const u32 block_height{surface_params.GetMipBlockHeight(level)};
+ const u32 block_depth{surface_params.GetMipBlockDepth(level)};
std::size_t guest_offset{mipmap_offsets[level]};
- if (params.is_layered) {
+ if (surface_params.is_layered) {
std::size_t host_offset = 0;
const std::size_t guest_stride = layer_size;
- const std::size_t host_stride = params.GetHostLayerSize(level);
- for (u32 layer = 0; layer < params.depth; ++layer) {
- MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth, 1,
- params.tile_width_spacing, buffer + host_offset, memory + guest_offset);
+ const std::size_t host_stride = surface_params.GetHostLayerSize(level);
+ for (u32 layer = 0; layer < surface_params.depth; ++layer) {
+ MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height,
+ block_depth, 1, surface_params.tile_width_spacing, buffer + host_offset,
+ memory + guest_offset);
guest_offset += guest_stride;
host_offset += host_stride;
}
} else {
- MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth,
- params.GetMipDepth(level), params.tile_width_spacing, buffer,
+ MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height, block_depth,
+ surface_params.GetMipDepth(level), surface_params.tile_width_spacing, buffer,
memory + guest_offset);
}
}
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h
index 173f2edba..cfcfa5b3a 100644
--- a/src/video_core/texture_cache/surface_base.h
+++ b/src/video_core/texture_cache/surface_base.h
@@ -167,8 +167,8 @@ protected:
std::vector<std::size_t> mipmap_offsets;
private:
- void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, u8* buffer,
- u32 level);
+ void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& surface_params,
+ u8* buffer, u32 level);
std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const;
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp
index 13dd16356..305297719 100644
--- a/src/video_core/texture_cache/surface_params.cpp
+++ b/src/video_core/texture_cache/surface_params.cpp
@@ -356,18 +356,18 @@ 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 u32 width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())};
- const u32 height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())};
- const u32 depth{is_layered ? 1U : GetMipDepth(level)};
+ const u32 mip_width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())};
+ const u32 mip_height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())};
+ const u32 mip_depth{is_layered ? 1U : GetMipDepth(level)};
if (is_tiled) {
- return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height,
- depth, GetMipBlockHeight(level),
+ return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), mip_width,
+ mip_height, mip_depth, GetMipBlockHeight(level),
GetMipBlockDepth(level));
} else if (as_host_size || IsBuffer()) {
- return GetBytesPerPixel() * width * height * depth;
+ return GetBytesPerPixel() * mip_width * mip_height * mip_depth;
} else {
// Linear Texture Case
- return pitch * height * depth;
+ return pitch * mip_height * mip_depth;
}
}