summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-06-29 19:52:37 -0300
committerGravatar ReinUsesLisp2019-06-29 19:52:37 -0300
commitf6f1a8f26a302dc33df635625c490f0d65880059 (patch)
tree4b0f73bcd53ef8ddc3e57520d82d32937cb21b5c /src
parenttexture_cache: Use std::array for siblings_table (diff)
downloadyuzu-f6f1a8f26a302dc33df635625c490f0d65880059.tar.gz
yuzu-f6f1a8f26a302dc33df635625c490f0d65880059.tar.xz
yuzu-f6f1a8f26a302dc33df635625c490f0d65880059.zip
texture_cache: Style changes
Diffstat (limited to 'src')
-rw-r--r--src/video_core/surface.h18
-rw-r--r--src/video_core/texture_cache/surface_params.h9
-rw-r--r--src/video_core/texture_cache/texture_cache.h3
3 files changed, 13 insertions, 17 deletions
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index bfdbc3b81..83f31c12c 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -439,11 +439,11 @@ static constexpr u32 GetBytesPerPixel(PixelFormat pixel_format) {
439 return GetFormatBpp(pixel_format) / CHAR_BIT; 439 return GetFormatBpp(pixel_format) / CHAR_BIT;
440} 440}
441 441
442enum class SurfaceCompression : u8 { 442enum class SurfaceCompression {
443 None = 0, 443 None, // Not compressed
444 Compressed = 1, 444 Compressed, // Texture is compressed
445 Converted = 2, 445 Converted, // Texture is converted before upload or after download
446 Rearranged = 3, 446 Rearranged, // Texture is swizzled before upload or after download
447}; 447};
448 448
449constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table = {{ 449constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table = {{
@@ -513,11 +513,11 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
513 SurfaceCompression::None, // Z32FS8 513 SurfaceCompression::None, // Z32FS8
514}}; 514}};
515 515
516static constexpr SurfaceCompression GetFormatCompressionType(PixelFormat format) { 516constexpr SurfaceCompression GetFormatCompressionType(PixelFormat format) {
517 if (format == PixelFormat::Invalid) 517 if (format == PixelFormat::Invalid) {
518 return SurfaceCompression::None; 518 return SurfaceCompression::None;
519 519 }
520 ASSERT(static_cast<std::size_t>(format) < compression_type_table.size()); 520 DEBUG_ASSERT(static_cast<std::size_t>(format) < compression_type_table.size());
521 return compression_type_table[static_cast<std::size_t>(format)]; 521 return compression_type_table[static_cast<std::size_t>(format)];
522} 522}
523 523
diff --git a/src/video_core/texture_cache/surface_params.h b/src/video_core/texture_cache/surface_params.h
index 4dfb882f0..358d6757c 100644
--- a/src/video_core/texture_cache/surface_params.h
+++ b/src/video_core/texture_cache/surface_params.h
@@ -95,7 +95,7 @@ public:
95 /// Returns the block depth of a given mipmap level. 95 /// Returns the block depth of a given mipmap level.
96 u32 GetMipBlockDepth(u32 level) const; 96 u32 GetMipBlockDepth(u32 level) const;
97 97
98 /// returns the best possible row/pitch alignment for the surface. 98 /// Returns the best possible row/pitch alignment for the surface.
99 u32 GetRowAlignment(u32 level) const { 99 u32 GetRowAlignment(u32 level) const {
100 const u32 bpp = 100 const u32 bpp =
101 GetCompressionType() == SurfaceCompression::Converted ? 4 : GetBytesPerPixel(); 101 GetCompressionType() == SurfaceCompression::Converted ? 4 : GetBytesPerPixel();
@@ -109,7 +109,7 @@ public:
109 std::size_t GetHostMipmapLevelOffset(u32 level) const; 109 std::size_t GetHostMipmapLevelOffset(u32 level) const;
110 110
111 /// Returns the offset in bytes in host memory (linear) of a given mipmap level 111 /// Returns the offset in bytes in host memory (linear) of a given mipmap level
112 // for a texture that is converted in host gpu. 112 /// for a texture that is converted in host gpu.
113 std::size_t GetConvertedMipmapOffset(u32 level) const; 113 std::size_t GetConvertedMipmapOffset(u32 level) const;
114 114
115 /// Returns the size in bytes in guest memory of a given mipmap level. 115 /// Returns the size in bytes in guest memory of a given mipmap level.
@@ -176,10 +176,7 @@ public:
176 pixel_format < VideoCore::Surface::PixelFormat::MaxDepthStencilFormat; 176 pixel_format < VideoCore::Surface::PixelFormat::MaxDepthStencilFormat;
177 } 177 }
178 178
179 /// Returns how the compression should be handled for this texture. Values 179 /// Returns how the compression should be handled for this texture.
180 /// are: None(no compression), Compressed(texture is compressed),
181 /// Converted(texture is converted before upload/ after download),
182 /// Rearranged(texture is swizzled before upload/after download).
183 SurfaceCompression GetCompressionType() const { 180 SurfaceCompression GetCompressionType() const {
184 return VideoCore::Surface::GetFormatCompressionType(pixel_format); 181 return VideoCore::Surface::GetFormatCompressionType(pixel_format);
185 } 182 }
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 9fcf87744..3df3e17dd 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -571,8 +571,7 @@ private:
571 // Step 1 571 // Step 1
572 // Check Level 1 Cache for a fast structural match. If candidate surface 572 // Check Level 1 Cache for a fast structural match. If candidate surface
573 // matches at certain level we are pretty much done. 573 // matches at certain level we are pretty much done.
574 auto iter = l1_cache.find(cache_addr); 574 if (const auto iter = l1_cache.find(cache_addr); iter != l1_cache.end()) {
575 if (iter != l1_cache.end()) {
576 TSurface& current_surface = iter->second; 575 TSurface& current_surface = iter->second;
577 const auto topological_result = current_surface->MatchesTopology(params); 576 const auto topological_result = current_surface->MatchesTopology(params);
578 if (topological_result != MatchTopologyResult::FullMatch) { 577 if (topological_result != MatchTopologyResult::FullMatch) {