Avoid initialization of graphical elements for a server.
Avoid allocating memory and resources for graphical elements that will never be drawn when starting a dedicated server. This reduces the server memory footprint by approx 17 MiB.
This commit is contained in:
@@ -300,10 +300,11 @@ namespace OpenRA
|
|||||||
Sound.StopVideo();
|
Sound.StopVideo();
|
||||||
Sound.Initialize();
|
Sound.Initialize();
|
||||||
|
|
||||||
ModData = new ModData(mod, true);
|
ModData = new ModData(mod, !Settings.Server.Dedicated);
|
||||||
|
|
||||||
Renderer.InitializeFonts(ModData.Manifest);
|
|
||||||
ModData.InitializeLoaders();
|
ModData.InitializeLoaders();
|
||||||
|
if (!Settings.Server.Dedicated)
|
||||||
|
Renderer.InitializeFonts(ModData.Manifest);
|
||||||
|
|
||||||
using (new PerfTimer("LoadMaps"))
|
using (new PerfTimer("LoadMaps"))
|
||||||
ModData.MapCache.LoadMaps();
|
ModData.MapCache.LoadMaps();
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
static void LoadCollection(string name, MiniYaml yaml)
|
static void LoadCollection(string name, MiniYaml yaml)
|
||||||
{
|
{
|
||||||
|
if (Game.ModData.LoadScreen != null)
|
||||||
Game.ModData.LoadScreen.Display();
|
Game.ModData.LoadScreen.Display();
|
||||||
var collection = new Collection()
|
var collection = new Collection()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,9 +52,12 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
Device = CreateDevice(Assembly.LoadFile(rendererPath), resolution.Width, resolution.Height, graphicSettings.Mode);
|
Device = CreateDevice(Assembly.LoadFile(rendererPath), resolution.Width, resolution.Height, graphicSettings.Mode);
|
||||||
|
|
||||||
|
if (!serverSettings.Dedicated)
|
||||||
|
{
|
||||||
TempBufferSize = graphicSettings.BatchSize;
|
TempBufferSize = graphicSettings.BatchSize;
|
||||||
TempBufferCount = graphicSettings.NumTempBuffers;
|
TempBufferCount = graphicSettings.NumTempBuffers;
|
||||||
SheetSize = graphicSettings.SheetSize;
|
SheetSize = graphicSettings.SheetSize;
|
||||||
|
}
|
||||||
|
|
||||||
WorldSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp"));
|
WorldSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp"));
|
||||||
WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
|
WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Graphics
|
|||||||
if (allocated)
|
if (allocated)
|
||||||
throw new SheetOverflowException("");
|
throw new SheetOverflowException("");
|
||||||
allocated = true;
|
allocated = true;
|
||||||
return SheetBuilder.AllocateSheet(Game.Renderer.SheetSize);
|
return SheetBuilder.AllocateSheet(Game.Settings.Graphics.SheetSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
return new SheetBuilder(SheetType.DualIndexed, allocate);
|
return new SheetBuilder(SheetType.DualIndexed, allocate);
|
||||||
|
|||||||
Reference in New Issue
Block a user