Commit Graph

644 Commits

Author SHA1 Message Date
RoosterDragon
c2b7d9ca5b Release sheet buffers in SequenceProvider and MapCache.
The buffers in SequenceProvider can be freed if Preload is called, since we know everything is loaded. A SequenceProvider is created for each TileSet is use so this saves memory for however many tilesets had been used in the game. This will be at least one for the shellmap, and often more.

The MapCache loading thread is kept alive for 5 seconds after it last generated a map (in anticipation of more requests). Once this time expires the thread is allowed to die, as it is unlikely there will be more requests in the short term. At this time it is ideal to force the changes to be committed to the texture so we can release the buffer. As well as marking the buffer for release, we must access the texture to force the changes stored in the buffer to be written to the texture, after which the buffer can be reclaimed.

Additionally, when starting the MapCache loading thread we must ensure the buffer is created from the main thread since it may query the texture object which has thread affinity. After that the buffer may be modified freely on the loading thread until released.
2014-11-29 12:04:51 +00:00
RoosterDragon
a6f5a21ed4 Made Sheet.Texture into Sheet.GetTexture() since we will want to call it for side-effects.
Do the same for Sheet.Data since it has the side effect of generating a buffer.
2014-11-29 12:04:50 +00:00
RoosterDragon
ff16690b86 Lazily generate buffer in Sheet.
The managed byte buffer is created on demand, meaning a newly allocated sheet will not waste memory holding onto the buffer until some changes are actually required to be written. This avoids a newly allocated sheet wasting memory on buffers that do not differ from their backing texture.
2014-11-29 12:04:00 +00:00
Matthias Mailänder
7ad2a57517 Merge pull request #6927 from huwpascoe/actor-fixup
Actor properties consistency improved
2014-11-23 14:53:33 +01:00
RoosterDragon
35da7d8a6e Make the underlying types of TextureChannel and BlendMode enums a byte to save memory. 2014-11-22 18:12:46 +00:00
huwpascoe
a660bb95b5 Actor properties consistency improved 2014-11-21 02:44:05 +00:00
Paul Chote
18f65552a1 Account for terrain height in Viewport. 2014-11-07 19:14:02 +13:00
Paul Chote
f0eee47e68 Introduce TerrainTemplatePreviewWidget. 2014-11-05 09:39:55 +13:00
Paul Chote
63f5fc8613 Work around the undesired R8 terrain sprite offsets. 2014-11-05 09:39:55 +13:00
Paul Chote
aab9ad5ac0 Load tmp(ts) ExtraData for cliffs etc. 2014-11-05 09:39:55 +13:00
Paul Chote
ab2bc789ce TileSet cleanups. 2014-11-05 09:39:54 +13:00
Matthias Mailänder
44b485606f StyleCop 2014-11-01 16:36:51 +01:00
Matthias Mailänder
83ed06e015 C#ify 2014-11-01 16:35:42 +01:00
Matthias Mailänder
c7f5b24593 use LoadChar 2014-11-01 16:13:54 +01:00
Matthias Mailänder
cf43581bac measure sprite font performance 2014-11-01 16:13:54 +01:00
RoosterDragon
d671e1de01 Create a separate FrameCache for caching sprite frames.
We split the caching SpriteLoader into a SpriteCache and FrameCache. SpriteLoader instead becomes a holder for static loading methods.

Only a few classes loaded sprite frames, and they all use it with a transient cache. By moving this method into a new class, we can lose the now redundant frame cache, saving on memory significantly since the frame data array can be reclaimed by the GC. This saves ~58 MiB on frames and ~4 MiB on the caching dictionary in simple tests.
2014-10-14 22:06:11 +01:00
Paul Chote
fad0215842 Merge pull request #6698 from RoosterDragon/memory-savings
Small memory savings
2014-10-12 11:43:08 +13:00
Paul Chote
6b1505b71d Add an aspect ratio correction flag to VqaPlayerWidget. 2014-10-11 23:05:34 +13:00
Paul Chote
4f44cc1969 Load assets using absolute paths. Fixes #6717. 2014-10-11 11:02:30 +13:00
Paul Chote
9f3230a009 Remove static state from ChromeProvider. 2014-10-10 23:44:37 +13:00
RoosterDragon
69125989ab Changed Vertex constructors to pass more parameters as plain floats.
This avoids callers having to construct a float2 struct, only to have the Vertex constructor unwrap it into individual components again.
2014-10-10 09:38:14 +01:00
RoosterDragon
bbb3990a0f Don't store pre-calculated texture coords in Sprite.
By storing only the four corners, we can save the object overhead of an array and 4 float elements per sprite. This results in savings of around 5 MiB to store these coordinates.
2014-10-09 20:03:03 +01:00
RoosterDragon
59b3cd154d Change indexes into tile arrays to be stored as bytes to save memory.
The index value needs only be big enough to handle all defined terrain types. This is a low number so we can save memory by defining it as a byte. This particularly saves memory for the CustomTerrain field in the Map class, which defines a cell layer for the map using tile indexes, so we can reduce the size of that layer 4x as a result.
2014-10-09 20:03:01 +01:00
Paul Chote
6a72e87028 Remove the remaining legacy sprite plumbing. 2014-10-07 09:55:50 +13:00
Paul Chote
beb7a394a2 Move ShpD2 sprite loading into Mods.Common. 2014-10-07 09:55:50 +13:00
Paul Chote
533d044755 Move TmpTS sprite loading into Mods.TS. 2014-10-07 09:55:50 +13:00
Paul Chote
37cedd88a2 Move TmpTD sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
997c79130a Move TmpRA sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
ca38193264 Move R8 sprite loading into Mods.D2k. 2014-10-07 09:55:49 +13:00
Paul Chote
c798b306c4 Move ShpTS sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
d658643b73 Move ShpTD sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
9cf8328979 Add plumbing for mod-defined sprite loaders. 2014-10-07 09:55:49 +13:00
Paul Chote
2b92ce7edd Use SpriteLoader for frame exporting. 2014-10-07 09:55:49 +13:00
Paul Chote
7207841f8b Use the existing SpriteLoader cache for tilesets. 2014-10-07 09:55:48 +13:00
ImagoTrigger
eb2124bb89 Adds ability to paste text (ctrl/cmd+v) into chat. 2014-09-13 09:41:59 +12:00
huwpascoe
baecedc7b8 Cursor Doubling
Cursor now doubles with pixel doubling, enabled by a new checkbox in the
settings menu.
2014-08-21 20:08:38 +01:00
huwpascoe
7d96a6ac96 Fixed SpriteRenderer offset bug. 2014-08-21 20:08:33 +01:00
Alexander Fast
070d00c678 Fixes year numbers in license text in file headers. 2014-08-21 11:27:52 +02:00
Paul Chote
0884722c4b Change IOrderGenerator.RenderAfterWorld to return Renderables. 2014-07-25 21:14:39 +12:00
Paul Chote
da6ecbf92e Change IPostRenderSelection and IPlaceBuildingDecoration to return renderables. 2014-07-25 21:14:39 +12:00
Paul Chote
8ac9477cd9 Add UISpriteRenderable for screen-space decorations. 2014-07-25 21:14:39 +12:00
Paul Chote
1beff77c6a Split selectable rendering into *Renderables. 2014-07-25 21:14:39 +12:00
Paul Chote
c4bcf0af46 Introduce RangeCircleRenderable. 2014-07-25 21:14:39 +12:00
Matthias Mailänder
d830a0a7ae Merge pull request #6029 from pchote/gametomods
Move *Renderables and Render* out of Game.
2014-07-23 06:54:42 +02:00
Paul Chote
1d77cd5391 Merge pull request #5851 from RoosterDragon/shroud-perf
Speed up shroud checks
2014-07-23 11:02:27 +12:00
Paul Chote
029da5116b Move VoxelRenderable into Mods.RA. 2014-07-22 16:43:39 +12:00
Paul Chote
4589e93180 Move TextRenderable into Mods.RA. 2014-07-22 16:43:39 +12:00
Paul Chote
1cb6026c38 Move ContrailRenderable into Mods.RA. 2014-07-22 16:43:39 +12:00
Paul Chote
6005262992 Move BeamRenderable into Mods.RA. 2014-07-22 16:43:39 +12:00
Paul Chote
2b91a2363b Fix make animations. 2014-07-08 16:56:09 +12:00