MonoGame/MonoGame

Support ContentTypeWriter.ShouldCompressContent Correctly

Open

#6,194 opened on Feb 16, 2018

View on GitHub
 (4 comments) (0 reactions) (1 assignee)C# (3,071 forks)batch import
ContentPipelineHelp Wantedbughelp wantedscope: apiscope: content-pipeline

Repository metrics

Stars
 (13,886 stars)
PR merge metrics
 (Avg merge 25d 3h) (22 merged PRs in 30d)

Description

We're not correctly supporting ContentTypeWriter.ShouldCompressContent on:

I know that XNA skips compression on sound effects compressed with MSADPCM... not sure about texture content.

The idea behind this API is to avoid extra overhead of generic compression formats (XNA used LZX and MonoGame uses LZ4) on content that is already significantly compressed. Otherwise at content loading time you do alot of extra CPU work to decompress it to only gain a tiny percentage of space.

Ideally we would test different sound effect and texture XNBs with and without compression to decide if compression is worth it in those cases. Like i don't remember if a texture already in a DXT format gains all that much when LZ4 compressed as well. If we gain less than 10% or 20% disk space it is arguable that we shouldn't compress those XNBs.

Also we need to fix ContentWriter to correctly obey ShouldCompressContent which it does not:

https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework.Content.Pipeline/Serialization/Compiler/ContentWriter.cs#L147

Contributor guide