texture_cache: Style changes
This commit is contained in:
parent
dd9ace502b
commit
f6f1a8f26a
|
@ -439,11 +439,11 @@ static constexpr u32 GetBytesPerPixel(PixelFormat pixel_format) {
|
||||||
return GetFormatBpp(pixel_format) / CHAR_BIT;
|
return GetFormatBpp(pixel_format) / CHAR_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class SurfaceCompression : u8 {
|
enum class SurfaceCompression {
|
||||||
None = 0,
|
None, // Not compressed
|
||||||
Compressed = 1,
|
Compressed, // Texture is compressed
|
||||||
Converted = 2,
|
Converted, // Texture is converted before upload or after download
|
||||||
Rearranged = 3,
|
Rearranged, // Texture is swizzled before upload or after download
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table = {{
|
constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table = {{
|
||||||
|
@ -513,11 +513,11 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
|
||||||
SurfaceCompression::None, // Z32FS8
|
SurfaceCompression::None, // Z32FS8
|
||||||
}};
|
}};
|
||||||
|
|
||||||
static constexpr SurfaceCompression GetFormatCompressionType(PixelFormat format) {
|
constexpr SurfaceCompression GetFormatCompressionType(PixelFormat format) {
|
||||||
if (format == PixelFormat::Invalid)
|
if (format == PixelFormat::Invalid) {
|
||||||
return SurfaceCompression::None;
|
return SurfaceCompression::None;
|
||||||
|
}
|
||||||
ASSERT(static_cast<std::size_t>(format) < compression_type_table.size());
|
DEBUG_ASSERT(static_cast<std::size_t>(format) < compression_type_table.size());
|
||||||
return compression_type_table[static_cast<std::size_t>(format)];
|
return compression_type_table[static_cast<std::size_t>(format)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
/// Returns the block depth of a given mipmap level.
|
/// Returns the block depth of a given mipmap level.
|
||||||
u32 GetMipBlockDepth(u32 level) const;
|
u32 GetMipBlockDepth(u32 level) const;
|
||||||
|
|
||||||
/// returns the best possible row/pitch alignment for the surface.
|
/// Returns the best possible row/pitch alignment for the surface.
|
||||||
u32 GetRowAlignment(u32 level) const {
|
u32 GetRowAlignment(u32 level) const {
|
||||||
const u32 bpp =
|
const u32 bpp =
|
||||||
GetCompressionType() == SurfaceCompression::Converted ? 4 : GetBytesPerPixel();
|
GetCompressionType() == SurfaceCompression::Converted ? 4 : GetBytesPerPixel();
|
||||||
|
@ -109,7 +109,7 @@ public:
|
||||||
std::size_t GetHostMipmapLevelOffset(u32 level) const;
|
std::size_t GetHostMipmapLevelOffset(u32 level) const;
|
||||||
|
|
||||||
/// Returns the offset in bytes in host memory (linear) of a given mipmap level
|
/// Returns the offset in bytes in host memory (linear) of a given mipmap level
|
||||||
// for a texture that is converted in host gpu.
|
/// for a texture that is converted in host gpu.
|
||||||
std::size_t GetConvertedMipmapOffset(u32 level) const;
|
std::size_t GetConvertedMipmapOffset(u32 level) const;
|
||||||
|
|
||||||
/// Returns the size in bytes in guest memory of a given mipmap level.
|
/// Returns the size in bytes in guest memory of a given mipmap level.
|
||||||
|
@ -176,10 +176,7 @@ public:
|
||||||
pixel_format < VideoCore::Surface::PixelFormat::MaxDepthStencilFormat;
|
pixel_format < VideoCore::Surface::PixelFormat::MaxDepthStencilFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns how the compression should be handled for this texture. Values
|
/// Returns how the compression should be handled for this texture.
|
||||||
/// are: None(no compression), Compressed(texture is compressed),
|
|
||||||
/// Converted(texture is converted before upload/ after download),
|
|
||||||
/// Rearranged(texture is swizzled before upload/after download).
|
|
||||||
SurfaceCompression GetCompressionType() const {
|
SurfaceCompression GetCompressionType() const {
|
||||||
return VideoCore::Surface::GetFormatCompressionType(pixel_format);
|
return VideoCore::Surface::GetFormatCompressionType(pixel_format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,8 +571,7 @@ private:
|
||||||
// Step 1
|
// Step 1
|
||||||
// Check Level 1 Cache for a fast structural match. If candidate surface
|
// Check Level 1 Cache for a fast structural match. If candidate surface
|
||||||
// matches at certain level we are pretty much done.
|
// matches at certain level we are pretty much done.
|
||||||
auto iter = l1_cache.find(cache_addr);
|
if (const auto iter = l1_cache.find(cache_addr); iter != l1_cache.end()) {
|
||||||
if (iter != l1_cache.end()) {
|
|
||||||
TSurface& current_surface = iter->second;
|
TSurface& current_surface = iter->second;
|
||||||
const auto topological_result = current_surface->MatchesTopology(params);
|
const auto topological_result = current_surface->MatchesTopology(params);
|
||||||
if (topological_result != MatchTopologyResult::FullMatch) {
|
if (topological_result != MatchTopologyResult::FullMatch) {
|
||||||
|
|
Loading…
Reference in New Issue