summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-07-04 18:42:10 -0300
committerGravatar ReinUsesLisp2020-07-10 04:09:32 -0300
commitc574ab5aa1d3ff81b28ddfbba3818b3ce724aa32 (patch)
treebfd4107fc64c09c767be6bfe79c4904075ce0307 /src/video_core/texture_cache
parentmaxwell_dma: Rename registers to match official docs and reorder (diff)
downloadyuzu-c574ab5aa1d3ff81b28ddfbba3818b3ce724aa32.tar.gz
yuzu-c574ab5aa1d3ff81b28ddfbba3818b3ce724aa32.tar.xz
yuzu-c574ab5aa1d3ff81b28ddfbba3818b3ce724aa32.zip
video_core/textures: Add and use SwizzleSliceToVoxel, and minor style changes
Change GOB sizes from free-functions to constexpr constants. Add SwizzleSliceToVoxel, a function that swizzles a 2D array of pixels into a 3D texture and use it for 3D copies.
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/surface_params.cpp5
-rw-r--r--src/video_core/texture_cache/surface_params.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp
index 0b2b2b8c4..921562c1f 100644
--- a/src/video_core/texture_cache/surface_params.cpp
+++ b/src/video_core/texture_cache/surface_params.cpp
@@ -343,8 +343,7 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co
343 size += GetInnerMipmapMemorySize(level, as_host_size, uncompressed); 343 size += GetInnerMipmapMemorySize(level, as_host_size, uncompressed);
344 } 344 }
345 if (is_tiled && is_layered) { 345 if (is_tiled && is_layered) {
346 return Common::AlignBits(size, 346 return Common::AlignBits(size, Tegra::Texture::GOB_SIZE_SHIFT + block_height + block_depth);
347 Tegra::Texture::GetGOBSizeShift() + block_height + block_depth);
348 } 347 }
349 return size; 348 return size;
350} 349}
@@ -418,7 +417,7 @@ std::tuple<u32, u32, u32> SurfaceParams::GetBlockOffsetXYZ(u32 offset) const {
418 const u32 block_size = GetBlockSize(); 417 const u32 block_size = GetBlockSize();
419 const u32 block_index = offset / block_size; 418 const u32 block_index = offset / block_size;
420 const u32 gob_offset = offset % block_size; 419 const u32 gob_offset = offset % block_size;
421 const u32 gob_index = gob_offset / static_cast<u32>(Tegra::Texture::GetGOBSize()); 420 const u32 gob_index = gob_offset / static_cast<u32>(Tegra::Texture::GOB_SIZE);
422 const u32 x_gob_pixels = 64U / GetBytesPerPixel(); 421 const u32 x_gob_pixels = 64U / GetBytesPerPixel();
423 const u32 x_block_pixels = x_gob_pixels << block_width; 422 const u32 x_block_pixels = x_gob_pixels << block_width;
424 const u32 y_block_pixels = 8U << block_height; 423 const u32 y_block_pixels = 8U << block_height;
diff --git a/src/video_core/texture_cache/surface_params.h b/src/video_core/texture_cache/surface_params.h
index 24957df8d..118aa689e 100644
--- a/src/video_core/texture_cache/surface_params.h
+++ b/src/video_core/texture_cache/surface_params.h
@@ -204,7 +204,7 @@ public:
204 static std::size_t AlignLayered(const std::size_t out_size, const u32 block_height, 204 static std::size_t AlignLayered(const std::size_t out_size, const u32 block_height,
205 const u32 block_depth) { 205 const u32 block_depth) {
206 return Common::AlignBits(out_size, 206 return Common::AlignBits(out_size,
207 Tegra::Texture::GetGOBSizeShift() + block_height + block_depth); 207 Tegra::Texture::GOB_SIZE_SHIFT + block_height + block_depth);
208 } 208 }
209 209
210 /// Converts a width from a type of surface into another. This helps represent the 210 /// Converts a width from a type of surface into another. This helps represent the