<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>performance of sub-bitmaps</title>
		<link>http://www.allegro.cc/forums/view/618337</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 19 Jan 2021 22:44:54 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>noob question of my own!<br />If I have a load of small bitmaps to draw, it is, as I understand it, a good idea to put these all on one bigger bitmap and blit regions of it (a texture atlas I think is the term)<br />I could do this by keeping my own list of rectangles and <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_bitmap_region"><span class="a">al_draw_bitmap_region</span></a></span> or I could create sub-bitmaps and just <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a></span> them. As far as I know, all sub-bitmaps share the same backing bitmap but just apply a region automatically.<br />Are these the same thing performance-wise or are there other issues to consider?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Mon, 11 Jan 2021 16:10:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>They&#39;re the same thing when drawing them, performance wise. Here&#39;s literally the totality of the code difference between drawing a bitmap, or its sub-bitmap:</p><div class="source-code snippet"><div class="inner"><pre>   <span class="k1">if</span> <span class="k2">(</span>bitmap-&gt;parent<span class="k2">)</span> <span class="k2">{</span>
      parent <span class="k3">=</span> bitmap-&gt;parent<span class="k2">;</span>
      sx <span class="k3">+</span><span class="k3">=</span> bitmap-&gt;xofs<span class="k2">;</span>
      sy <span class="k3">+</span><span class="k3">=</span> bitmap-&gt;yofs<span class="k2">;</span>
   <span class="k2">}</span>
</pre></div></div><p>

The only difference I can think of is that your custom rectangle will probably be more lightweight than a bitmap (e.g. every bitmap sets up an orthographic transform just in case its ever used as a target bitmap). But that shouldn&#39;t be a huge difference.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Mon, 11 Jan 2021 16:34:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>On the KrampusHack I used al_hold_bitmap_drawing for the first time, and noticed a massive improvement when using a large bitmap and drawing regions from it. It was probably just in my brain but it seemed a bit faster than using subs. Given SiegeLords reply it was probably just background processes changing at the time of testing. The only thing that enforced it was that I was using OpenGL, and thought maybe it was a specific thing to that. </p><p>I suppose the only useful thing to take from that rant is that al_hold_bitmap_drawing is cool.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Wed, 13 Jan 2021 09:46:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Good shout on <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a></span> I&#39;d forgotten all about that. I&#39;m not really close to having to worry about speed but, if I&#39;ve time, I&#39;ll do some benchmarks to see what difference it makes.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Wed, 13 Jan 2021 15:30:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The full performance comes with sub-bitmaps, hold bitmap drawing and HW acceleration. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (tobing)</author>
		<pubDate>Tue, 19 Jan 2021 22:44:54 +0000</pubDate>
	</item>
</rss>
