<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Threading bitmap loads</title>
		<link>http://www.allegro.cc/forums/view/614497</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 29 Jul 2014 22:08:29 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
So, in OpenApoc, I was loading my menu GUI from XML, and rendering it to the screen. I got really confused why when loading from the XML it ran really slowly and jerky, but when I manually constructed the UI, it was smooth.</p><p>Anyway, long story short, it was because I threaded the load of the XML (which included the bitmap).</p><p>Now, when you try and draw with a bitmap loaded in a different thread, it takes a lot longer to render (I assume it&#39;s something to do with handing references between threads)</p><p>How can I go about threading my load, but without the overhead when it comes to rendering?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pmprog)</author>
		<pubDate>Sat, 26 Jul 2014 18:20:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What probably happens is that the images got loaded in the wrong format. Normally, Allegro will use the display format to convert your images to display format for optimal performance. Likely the thread mis-loads the format and also loads the images as memory bitmaps, not video bitmaps.</p><p>Now I haven&#39;t done this before but I guess the way for you would be to open a display, inspect it&#39;s format with <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_display_format"><span class="a">al_get_display_format</span></a></span>, and then set that format with <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_bitmap_format"><span class="a">al_set_new_bitmap_format</span></a></span> , then ensure that you will make video bitmap with <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_bitmap_flags"><span class="a">al_set_new_bitmap_flags</span></a><span class="k2">(</span>ALLEGRO_VIDEO_BITMAP<span class="k2">)</span></span> and finally clone the loaded bitmap to the right format with <span class="source-code"><a href="http://www.allegro.cc/manual/al_clone_bitmap"><span class="a">al_clone_bitmap</span></a></span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Sat, 26 Jul 2014 18:52:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In some version of 5.1, you also get: <a href="http://www.liballeg.org/a5docs/refman/graphics.html#al_convert_bitmap">al_convert_bitmap</a> and <span class="source-code">al_convert_bitmaps</span> which may or may not be faster and more efficient than <span class="source-code"><a href="http://www.allegro.cc/manual/al_clone_bitmap"><span class="a">al_clone_bitmap</span></a></span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 26 Jul 2014 19:24:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ah, I never really thought about display formats over threads, but that makes a lot of sense.</p><p>Thanks, I&#39;ll give it a try.</p><p>Edit: This didn&#39;t actually help me any. I&#39;ll just considering ditching the threaded loads
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pmprog)</author>
		<pubDate>Sun, 27 Jul 2014 00:51:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Did you try to actually profile the code to see what&#39;s causing slowdowns? It might be something unexpected.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Max Savenkov)</author>
		<pubDate>Tue, 29 Jul 2014 11:29:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I remember thinking about it, but I couldn&#39;t find any tools in VS2013 for it... Having just opened VS2013 now, I think I was just going blind, will have a go tonight.</p><p>Though, I&#39;ve actually modified my loading code, I only load images at first attempt to render them; otherwise, I would have been loading practically every reasource for the game straight off, and that could have been quite a chunk of memory. Still, I guess it&#39;ll be nice to know for future
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pmprog)</author>
		<pubDate>Tue, 29 Jul 2014 12:33:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can use one of the 3rd party profiling tools. I myself quite liked Luke Stackwalker and VerySleepy. But I recently saw the new version of (free) AMD CodeXL tool and it was quite a step ahead of their old CodeAnalyst offering, so you can also use it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Max Savenkov)</author>
		<pubDate>Tue, 29 Jul 2014 22:08:29 +0000</pubDate>
	</item>
</rss>
