Commit Graph

23 Commits

Author SHA1 Message Date
RoosterDragon
47e2c48068 Ensure MapCache disposes cleanly.
This prevents the map loading thread writing to disposed objects which can have unintended side effects.
2015-04-01 20:58:09 +01:00
RoosterDragon
82bea961ba Checked LINQ queries and collections for inefficiencies.
- Made Array.IndexOf available via extension method.
- Made ToHashSet extension method.
- Change collections queried often via Contains into sets.
- Avoid Count() extension if Count or Length property exist.
- Made Count() > 0 checks and variations calls to Any() instead.
- Don't call ToList/ToArray if there is no benefit to materializing the sequence.
- If the sequence does benefit from materialization, follow this general pattern:
  - Collection queried often via Contains use ToHashSet to speed up lookups.
  - Short lived variables use ToList. This is because ToArray requires an extra copy to output the final size.
  - Collections persisted into fields or for a long time use ToArray to minimize memory overhead.
2015-01-29 19:20:11 +00:00
Oliver Brakmann
16cf805a23 Fix wrong log channel name: Debug -> debug 2015-01-25 18:34:16 +01:00
Oliver Brakmann
7267a3afdb Merge pull request #6984 from DeadlySurprise/yamlFix
Fixed yaml bug with leading spaces
2015-01-20 21:42:22 +01:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
DeadlySurprise
fbe6ab7f4e Fixed yaml bug with leading spaces 2015-01-07 22:16:15 +01:00
Hellhake
5a97a4b63b Fix StyleCop warnings in OpenRA.Game 2015-01-02 12:11:01 +01:00
Paul Chote
14deb1efdf Drop support for map format 5. 2014-12-23 09:08:00 +13:00
RoosterDragon
f0f02dff5c Dispose of graphics resources deterministically.
Textures, FrameBuffers and VertexBuffers allocated by the Sdl2 Renderer were only being released via finalizers. This could lead to OpenGL out of memory errors since resources may not be cleaned up in a timely manner. To avoid this, IDisposable has been implemented and transitively applied to classes that use these resources.

As a side-effect some static state is no longer static, particularly in Renderer, in order to facilitate this change and just for nicer design in general.

Also dispose some bitmaps.
2014-12-22 17:34:01 +00:00
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
Paul Chote
4f44cc1969 Load assets using absolute paths. Fixes #6717. 2014-10-11 11:02:30 +13:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
ScottNZ
831b9b3ca3 Remove some stray semicolons 2014-06-15 22:14:39 +12:00
RoosterDragon
9dbbc23967 Make map preview generation fast.
- Change Map.LoadMapTiles and Map.LoadResourceTiles to read the whole stream into memory before processing individual bytes. This removes the cost of significant overhead from repeated calls to ReadUInt8/16.
- Remove significant UI jank caused by the map chooser by not including the placeholder widget. The maps render fast enough that it is no longer worthwhile and it was causing a lot of flushes which were the source of the jank.
- Trigger async generation for all maps when the chooser is loaded. This means in practice all previews will be ready by the time the user begins to scroll the selection. Since generation is fast, there is no issue with scrolling straight to the bottom and having to wait for the backlog to clear.
2014-06-10 11:46:39 +01:00
Paul Chote
373529e110 Merge pull request #5505 from pavlos256/map-preview-generation
Map preview generation
2014-06-10 17:56:21 +12:00
Pavlos Touboulidis
7d352fdad1 MapCache performance improvements 2014-05-31 23:49:04 +03:00
Matthias Mailänder
61d576ec6e harden map search preview against invalid data
fixes #5492
2014-05-31 15:19:22 +02:00
Paul Chote
657ade7221 Add map folder types. Fixes #4635. 2014-05-18 17:29:42 +12:00
Pavlos Touboulidis
df6159f12b Do not use the map's rules when rendering the minimap in the map chooser
Using the mod's rules is *a lot* faster because we don't have to load
each map's rules.
2014-05-17 14:33:17 +03:00
Pavlos Touboulidis
750fc4e02c Merge ModRuleset and MapRuleset into Ruleset 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
63ec6d60e7 Refactoring to remove static Rules & SequenceProvider 2014-05-17 14:32:03 +03:00
Pavlos Touboulidis
2d8cd8299f Add more perf measurements 2014-04-23 03:43:46 +03:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00