Merge pull request #11869 from dvessel/texdump-compression
Add compression option for texture dumps.
This commit is contained in:
commit
fee28e26a1
|
@ -44,6 +44,8 @@ const Info<bool> GFX_OVERLAY_SCISSOR_STATS{{System::GFX, "Settings", "OverlaySci
|
||||||
const Info<bool> GFX_DUMP_TEXTURES{{System::GFX, "Settings", "DumpTextures"}, false};
|
const Info<bool> GFX_DUMP_TEXTURES{{System::GFX, "Settings", "DumpTextures"}, false};
|
||||||
const Info<bool> GFX_DUMP_MIP_TEXTURES{{System::GFX, "Settings", "DumpMipTextures"}, true};
|
const Info<bool> GFX_DUMP_MIP_TEXTURES{{System::GFX, "Settings", "DumpMipTextures"}, true};
|
||||||
const Info<bool> GFX_DUMP_BASE_TEXTURES{{System::GFX, "Settings", "DumpBaseTextures"}, true};
|
const Info<bool> GFX_DUMP_BASE_TEXTURES{{System::GFX, "Settings", "DumpBaseTextures"}, true};
|
||||||
|
const Info<int> GFX_TEXTURE_PNG_COMPRESSION_LEVEL{
|
||||||
|
{System::GFX, "Settings", "TexturePNGCompressionLevel"}, 6};
|
||||||
const Info<bool> GFX_HIRES_TEXTURES{{System::GFX, "Settings", "HiresTextures"}, false};
|
const Info<bool> GFX_HIRES_TEXTURES{{System::GFX, "Settings", "HiresTextures"}, false};
|
||||||
const Info<bool> GFX_CACHE_HIRES_TEXTURES{{System::GFX, "Settings", "CacheHiresTextures"}, false};
|
const Info<bool> GFX_CACHE_HIRES_TEXTURES{{System::GFX, "Settings", "CacheHiresTextures"}, false};
|
||||||
const Info<bool> GFX_DUMP_EFB_TARGET{{System::GFX, "Settings", "DumpEFBTarget"}, false};
|
const Info<bool> GFX_DUMP_EFB_TARGET{{System::GFX, "Settings", "DumpEFBTarget"}, false};
|
||||||
|
|
|
@ -46,6 +46,7 @@ extern const Info<bool> GFX_OVERLAY_SCISSOR_STATS;
|
||||||
extern const Info<bool> GFX_DUMP_TEXTURES;
|
extern const Info<bool> GFX_DUMP_TEXTURES;
|
||||||
extern const Info<bool> GFX_DUMP_MIP_TEXTURES;
|
extern const Info<bool> GFX_DUMP_MIP_TEXTURES;
|
||||||
extern const Info<bool> GFX_DUMP_BASE_TEXTURES;
|
extern const Info<bool> GFX_DUMP_BASE_TEXTURES;
|
||||||
|
extern const Info<int> GFX_TEXTURE_PNG_COMPRESSION_LEVEL;
|
||||||
extern const Info<bool> GFX_HIRES_TEXTURES;
|
extern const Info<bool> GFX_HIRES_TEXTURES;
|
||||||
extern const Info<bool> GFX_CACHE_HIRES_TEXTURES;
|
extern const Info<bool> GFX_CACHE_HIRES_TEXTURES;
|
||||||
extern const Info<bool> GFX_DUMP_EFB_TARGET;
|
extern const Info<bool> GFX_DUMP_EFB_TARGET;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void AbstractTexture::FinishedRendering()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractTexture::Save(const std::string& filename, unsigned int level)
|
bool AbstractTexture::Save(const std::string& filename, unsigned int level, int compression)
|
||||||
{
|
{
|
||||||
// We can't dump compressed textures currently (it would mean drawing them to a RGBA8
|
// We can't dump compressed textures currently (it would mean drawing them to a RGBA8
|
||||||
// framebuffer, and saving that). TextureCache does not call Save for custom textures
|
// framebuffer, and saving that). TextureCache does not call Save for custom textures
|
||||||
|
@ -51,7 +51,7 @@ bool AbstractTexture::Save(const std::string& filename, unsigned int level)
|
||||||
return Common::SavePNG(filename,
|
return Common::SavePNG(filename,
|
||||||
reinterpret_cast<const u8*>(readback_texture->GetMappedPointer()),
|
reinterpret_cast<const u8*>(readback_texture->GetMappedPointer()),
|
||||||
Common::ImageByteFormat::RGBA, level_width, level_height,
|
Common::ImageByteFormat::RGBA, level_width, level_height,
|
||||||
static_cast<int>(readback_texture->GetMappedStride()));
|
static_cast<int>(readback_texture->GetMappedStride()), compression);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractTexture::IsCompressedFormat(AbstractTextureFormat format)
|
bool AbstractTexture::IsCompressedFormat(AbstractTextureFormat format)
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
MathUtil::Rectangle<int> GetRect() const { return m_config.GetRect(); }
|
MathUtil::Rectangle<int> GetRect() const { return m_config.GetRect(); }
|
||||||
MathUtil::Rectangle<int> GetMipRect(u32 level) const { return m_config.GetMipRect(level); }
|
MathUtil::Rectangle<int> GetMipRect(u32 level) const { return m_config.GetMipRect(level); }
|
||||||
bool IsMultisampled() const { return m_config.IsMultisampled(); }
|
bool IsMultisampled() const { return m_config.IsMultisampled(); }
|
||||||
bool Save(const std::string& filename, unsigned int level);
|
bool Save(const std::string& filename, unsigned int level, int compression = 6);
|
||||||
|
|
||||||
static bool IsCompressedFormat(AbstractTextureFormat format);
|
static bool IsCompressedFormat(AbstractTextureFormat format);
|
||||||
static bool IsDepthFormat(AbstractTextureFormat format);
|
static bool IsDepthFormat(AbstractTextureFormat format);
|
||||||
|
|
|
@ -1023,7 +1023,7 @@ void TextureCacheBase::DumpTexture(RcTcacheEntry& entry, std::string basename, u
|
||||||
if (File::Exists(filename))
|
if (File::Exists(filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry->texture->Save(filename, level);
|
entry->texture->Save(filename, level, Config::Get(Config::GFX_TEXTURE_PNG_COMPRESSION_LEVEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for checking if a BPMemory TexMode0 register is set to Point
|
// Helper for checking if a BPMemory TexMode0 register is set to Point
|
||||||
|
|
Loading…
Reference in New Issue