@@ -20,10 +20,12 @@ public sealed class Configuration
2020 /// <summary>
2121 /// A lazily initialized configuration default instance.
2222 /// </summary>
23- private static readonly Lazy < Configuration > Lazy = new Lazy < Configuration > ( CreateDefaultInstance ) ;
23+ private static readonly Lazy < Configuration > Lazy = new ( CreateDefaultInstance ) ;
2424
2525 private int maxDegreeOfParallelism = Environment . ProcessorCount ;
2626
27+ private MemoryAllocator memoryAllocator = MemoryAllocator . Default ;
28+
2729 /// <summary>
2830 /// Initializes a new instance of the <see cref="Configuration" /> class.
2931 /// </summary>
@@ -83,12 +85,20 @@ public int MaxDegreeOfParallelism
8385 /// <summary>
8486 /// Gets or sets the <see cref="TextureFormatManager"/> that is currently in use.
8587 /// </summary>
86- public TextureFormatManager ImageFormatsManager { get ; set ; } = new TextureFormatManager ( ) ;
88+ public TextureFormatManager ImageFormatsManager { get ; set ; } = new ( ) ;
8789
8890 /// <summary>
8991 /// Gets or sets the <see cref="MemoryAllocator"/> that is currently in use.
9092 /// </summary>
91- public MemoryAllocator MemoryAllocator { get ; set ; } = ArrayPoolMemoryAllocator . CreateDefault ( ) ;
93+ public MemoryAllocator MemoryAllocator
94+ {
95+ get => this . memoryAllocator ;
96+ set
97+ {
98+ Guard . NotNull ( value , nameof ( this . MemoryAllocator ) ) ;
99+ this . memoryAllocator = value ;
100+ }
101+ }
92102
93103 /// <summary>
94104 /// Gets the maximum header size of all the formats.
@@ -123,7 +133,7 @@ public void Configure(IConfigurationModule configuration)
123133 /// Creates a shallow copy of the <see cref="Configuration"/>.
124134 /// </summary>
125135 /// <returns>A new configuration instance.</returns>
126- public Configuration Clone ( ) => new Configuration
136+ public Configuration Clone ( ) => new ( )
127137 {
128138 MaxDegreeOfParallelism = this . MaxDegreeOfParallelism ,
129139 ImageFormatsManager = this . ImageFormatsManager ,
@@ -138,7 +148,7 @@ public void Configure(IConfigurationModule configuration)
138148 /// <see cref="DdsConfigurationModule"/>
139149 /// </summary>
140150 /// <returns>The default configuration of <see cref="Configuration"/>.</returns>
141- internal static Configuration CreateDefaultInstance ( ) => new Configuration (
151+ internal static Configuration CreateDefaultInstance ( ) => new (
142152 new DdsConfigurationModule ( ) ,
143153 new KtxConfigurationModule ( ) ,
144154 new Ktx2ConfigurationModule ( ) ) ;
0 commit comments