<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] Maximum bitmap size?</title>
		<link>http://www.allegro.cc/forums/view/608632</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 21 Oct 2011 23:41:02 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is there a limit in bitmap size in A5? My A4 program had megatexture bitmap of 3200x3200 but in A5 it seems like it is not possible to make bitmaps larger than about 2000x2000 (2000x2000 works but 2100x2100 does not work).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeaRDoWN)</author>
		<pubDate>Fri, 21 Oct 2011 00:59:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, and it&#39;s dependent on the video card: <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_display_option"><span class="a">al_get_display_option</span></a><span class="k2">(</span>display, ALLEGRO_MAX_BITMAP_SIZE<span class="k2">)</span></span>. The limit applies to video bitmaps.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 21 Oct 2011 01:24:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/608632/934715#target">TeaRDoWN</a> said:</div><div class="quote"><p> (2000x2000 works but 2100x2100 does not work).
</p></div></div><p>

Usually the limit is a power of 2 so your limit is probably 2048x2048. A4 let you make arbitrary sized ones because it was limited by your ram since a4 is software rendering and memory bitmaps.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Fri, 21 Oct 2011 01:29:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This reminded me that <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_display_option"><span class="a">al_get_display_option</span></a><span class="k2">(</span>display, ALLEGRO_MAX_BITMAP_SIZE<span class="k2">)</span></span> was broken in earlier versions. I just checked and it seems that it&#39;s now fixed, kinda.</p><p>If I remember correctly, on my machine the limit when using OpenGL was 2048 while on Direct3D it was 1024. Allegro reports the size limit on both as 2048. As I have a really ancient graphics card it may be an error on my side with the card reporting an incorrect size.</p><p>Anyway, the weird thing is that in Allegro 5.0 attempting to create a bitmap bigger than <span class="source-code">ALLEGRO_MAX_BITMAP_SIZE</span> caused an assertion. In Allegro 5.1, however, it seems like it actually succeeds in creating the bitmap; drawing the bitmap becomes really slow, though. Is this normal? is Allegro 5.1 automatically falling back to create a memory bitmap? can someone confirm this?.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Fri, 21 Oct 2011 02:15:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>5.1 falls back to a memory bitmap if you don&#39;t explicitly request a video bitmap via the <span class="source-code">ALLEGRO_VIDEO_BITMAP</span> flag. So if you don&#39;t care, don&#39;t set either flag.</p><p>Basically it now treats a bitmap without either flag as an &quot;auto&quot; type, where it tries to be accelerated if at all possible. So if you, say, load a small image before creating a display, then create the display, it will automatically upgrade it to a video bitmap. (I think that&#39;s what eventually was implemented after long discussions...)</p><p>So in a nutshell, with 5.1: if you must have a memory or video bitmap, then you need to explicitly set the appropriate flag.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 21 Oct 2011 02:40:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OK, I guess it makes sense. Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Fri, 21 Oct 2011 02:45:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What happens with CPU&#39;s with GPU&#39;s incorporated like the one I&#39;ve got</p><p>A3850 AMD A8</p><p>?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Fri, 21 Oct 2011 02:49:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/608632/934727#target">William Labbett</a> said:</div><div class="quote"><p> What happens with CPU&#39;s with GPU&#39;s incorporated like the one I&#39;ve got
</p></div></div><p>Same thing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 21 Oct 2011 02:51:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What about minimum bitmap size?.</p><div class="quote_container"><div class="title">The Allegro Documentation said:</div><div class="quote"><p>Some platforms also dictate a minimum texture size, which is relevant if you plan to use this bitmap with the primitives addon. If you try to create a bitmap smaller than this, this call will not fail but the returned bitmap will be a section of a larger bitmap with the minimum size. This minimum size is 16 by 16.</p></div></div><p>

In my code I&#39;m drawing a patterned line using <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a><span class="k2">(</span><span class="k2">)</span></span> and creating a 2x2 bitmap works fine in OpenGL but in Direct3D it&#39;s obviously bitten by this so, for example, I get:</p><p>With OpenGL:<br /><span class="remote-thumbnail"><span class="json">{"name":"patternogl.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/9\/59e729fcbad9359036c818da555c2eb3.png","w":636,"h":474,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/9\/59e729fcbad9359036c818da555c2eb3"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/5/9/59e729fcbad9359036c818da555c2eb3-240.jpg" alt="patternogl.png" width="240" height="178" /></span><br />With Direct3D:<br /><span class="remote-thumbnail"><span class="json">{"name":"patternd3d.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/d\/7d452b88069636c26127045ac9318b24.png","w":637,"h":478,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/d\/7d452b88069636c26127045ac9318b24"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/7/d/7d452b88069636c26127045ac9318b24-240.jpg" alt="patternd3d.png" width="240" height="180" /></span></p><p>Is there a way to query (currently it&#39;s not possible with <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_display_option"><span class="a">al_get_display_option</span></a><span class="k2">(</span><span class="k2">)</span></span>) the minimum bitmap size? or is it better to always assume a minimum size of 16x16?.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Fri, 21 Oct 2011 03:29:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The minimum size is 1x1. There seems to be a bug in al_draw_prim or the D3D driver though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Fri, 21 Oct 2011 03:55:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I thought it was related to the minimum texture size as mentioned in the documentation because it clearly coincides with a 16x16 bitmap size.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Fri, 21 Oct 2011 04:33:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, there&#39;s some weird DirectX-only hack with bitmaps smaller than 16x16. Not sure what that is about. If we really want a minimum size should document that better I think - but better would be if it could be fixed.</p><p>MSDN says nothing about 16 pixel minimum size at least: <a href="http://msdn.microsoft.com/en-us/library/bb174363%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/bb174363%28VS.85%29.aspx</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Fri, 21 Oct 2011 05:02:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d say that indicating in the documentation that on some cards 16x16 is the minimum supported (and a safe minimum to assume) bitmap size is better if that keeps the code cleaner.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Fri, 21 Oct 2011 09:03:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, thanks for the replies. I think I&#39;ll just skip the mega texture idea and go for 5x5 640x640 textures instead so make sure there won&#39;t be any issues running the game on any machine. Thanks.</p><p>EDIT: That didn&#39;t work so well either. Game was only able to create the 640x640 up until 3x4 (12 bitmaps) then the al_create_bitmap fails to create. Why is this? Even more limitations regarding bitmaps?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeaRDoWN)</author>
		<pubDate>Fri, 21 Oct 2011 10:02:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/608632/934794#target">TeaRDoWN</a> said:</div><div class="quote"><p> Why is this? Even more limitations regarding bitmaps?
</p></div></div><p>

Maybe you ran out of vram?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Fri, 21 Oct 2011 16:29:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just for the heck of it, try power of two sizes. like 512, or 1024.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 21 Oct 2011 21:41:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, I&#39;ll try it....</p><p>EDIT: So the code tries to make 5x5 bitmaps of 640x640. This crashes when trying to make the 20th bitmap. When changing size to 512x512 all 25 bitmaps can be created.</p><p>640x640x19 = 7782400 pixels<br />512x512x25 = 6553600 pixels</p><p>Never tried this in A4 but then I was able to make a single 3200x3200 instead. </p><p>3200x3200 = 10240000 pixels</p><p>It&#39;s pitty the swap from A4 to A5 has generated issues not available in the old A4 version of my game.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeaRDoWN)</author>
		<pubDate>Fri, 21 Oct 2011 22:30:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Were you using memory bitmaps in Allegro 4? You can create memory bitmaps in Allegro 5 as well, but they will be much slower than video bitmaps.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 21 Oct 2011 23:11:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Some cards or drivers don&#39;t work with &lt; 16x16 and D3D in my experience, that&#39;s why the limit is there. It looks like you&#39;re drawing the full 16x16 in your example there ken, when you should only use a 2x2 piece of it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Fri, 21 Oct 2011 23:25:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is how I did the 3200x3200 bitmap (and all other bitmaps) in the A4 version of the game:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define LEVEL_SECTION_SIZE 640</span>
<span class="p">#define LEVEL_SECTIONS 5</span>
megatexture <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap"><span class="a">create_bitmap</span></a><span class="k2">(</span>LEVEL_SECTION_SIZE <span class="k3">*</span> LEVEL_SECTIONS, LEVEL_SECTION_SIZE <span class="k3">*</span> LEVEL_SECTIONS<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Don&#39;t know if this is video bitmap or memory bitmaps. I&#39;ve always made them this way. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>EDIT: The 512x512 bitmaps in A5 fails to create when doing 9x9 of them. Returning null at number 74.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeaRDoWN)</author>
		<pubDate>Fri, 21 Oct 2011 23:26:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s a memory bitmap. You&#39;d have to set ALLEGRO_MEMORY_BITMAP in 5.0 to achieve the same effect. But why do you need such a large bitmap?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 21 Oct 2011 23:32:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s been like this since the beginning of the project just to make it easier to open up the image (generated in the editor) in Photoshop and check the result. I was going to add the final 5*5 bitmap system later but did it now instead.</p><p>The megatexture is temporary for adding dirt, stains and debris on the floor sections. The added details can be intersecting between the sections so adding them first on the big texture and then creating 25 640x640 bitmaps.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeaRDoWN)</author>
		<pubDate>Fri, 21 Oct 2011 23:41:02 +0000</pubDate>
	</item>
</rss>
