summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-04-20 20:01:26 -0300
committerGravatar ReinUsesLisp2019-06-20 21:36:11 -0300
commit2787a0c2875c6c686a50a03e446099124824b17f (patch)
treea025917ee353401e5880089e0038a0ea953ffb37 /src/video_core/texture_cache.cpp
parentgl_texture_cache: Minor changes (diff)
downloadyuzu-2787a0c2875c6c686a50a03e446099124824b17f.tar.gz
yuzu-2787a0c2875c6c686a50a03e446099124824b17f.tar.xz
yuzu-2787a0c2875c6c686a50a03e446099124824b17f.zip
texture_cache: Flush 3D textures in the order they are drawn
Diffstat (limited to 'src/video_core/texture_cache.cpp')
-rw-r--r--src/video_core/texture_cache.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/video_core/texture_cache.cpp b/src/video_core/texture_cache.cpp
index b47ce6b98..b78a7d951 100644
--- a/src/video_core/texture_cache.cpp
+++ b/src/video_core/texture_cache.cpp
@@ -154,8 +154,8 @@ bool SurfaceParams::IsLayered() const {
154 switch (target) { 154 switch (target) {
155 case SurfaceTarget::Texture1DArray: 155 case SurfaceTarget::Texture1DArray:
156 case SurfaceTarget::Texture2DArray: 156 case SurfaceTarget::Texture2DArray:
157 case SurfaceTarget::TextureCubeArray:
158 case SurfaceTarget::TextureCubemap: 157 case SurfaceTarget::TextureCubemap:
158 case SurfaceTarget::TextureCubeArray:
159 return true; 159 return true;
160 default: 160 default:
161 return false; 161 return false;
@@ -192,9 +192,11 @@ u32 SurfaceParams::GetMipBlockDepth(u32 level) const {
192 while (block_depth > 1 && depth * 2 <= block_depth) { 192 while (block_depth > 1 && depth * 2 <= block_depth) {
193 block_depth >>= 1; 193 block_depth >>= 1;
194 } 194 }
195
195 if (block_depth == 32 && GetMipBlockHeight(level) >= 4) { 196 if (block_depth == 32 && GetMipBlockHeight(level) >= 4) {
196 return 16; 197 return 16;
197 } 198 }
199
198 return block_depth; 200 return block_depth;
199} 201}
200 202
@@ -227,7 +229,7 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co
227 for (u32 level = 0; level < num_levels; ++level) { 229 for (u32 level = 0; level < num_levels; ++level) {
228 size += GetInnerMipmapMemorySize(level, as_host_size, uncompressed); 230 size += GetInnerMipmapMemorySize(level, as_host_size, uncompressed);
229 } 231 }
230 if (is_tiled && IsLayered()) { 232 if (is_tiled && (IsLayered() || target == SurfaceTarget::Texture3D)) {
231 return Common::AlignUp(size, Tegra::Texture::GetGOBSize() * block_height * block_depth); 233 return Common::AlignUp(size, Tegra::Texture::GetGOBSize() * block_height * block_depth);
232 } 234 }
233 return size; 235 return size;
@@ -312,9 +314,10 @@ void SurfaceParams::CalculateCachedValues() {
312 314
313 guest_size_in_bytes = GetInnerMemorySize(false, false, false); 315 guest_size_in_bytes = GetInnerMemorySize(false, false, false);
314 316
315 // ASTC is uncompressed in software, in emulated as RGBA8
316 if (IsPixelFormatASTC(pixel_format)) { 317 if (IsPixelFormatASTC(pixel_format)) {
317 host_size_in_bytes = static_cast<std::size_t>(width * height * depth * 4U); 318 // ASTC is uncompressed in software, in emulated as RGBA8
319 host_size_in_bytes = static_cast<std::size_t>(width) * static_cast<std::size_t>(height) *
320 static_cast<std::size_t>(depth) * 4ULL;
318 } else { 321 } else {
319 host_size_in_bytes = GetInnerMemorySize(true, false, false); 322 host_size_in_bytes = GetInnerMemorySize(true, false, false);
320 } 323 }