<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>HLSL shader platform</title>
		<link>http://www.allegro.cc/forums/view/618307</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 26 Dec 2020 05:34:20 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello. I&#39;m currently playing with HLSL shaders in Allegro, and was wondering if anyone knows how to force the compiler to use a higher version than PS_2_0. </p><p>One of my shaders has too much arithmetic (only 64 instructions allowed on PS_2_0) so I was hoping to bump it up to PS_3_0 or PS_4_0. </p><p>All of the things I&#39;ve tried from online research seem to be very DirectX specific, and I can&#39;t quite work out how to do this in Allegro (or if it&#39;s even possible).</p><p>Any suggestions welcomed!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Fri, 18 Dec 2020 18:04:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think when allegro compiles the shaders, it sets the limit. You might have to hack allegro to use later versions of shaders.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 18 Dec 2020 21:16:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks Edgar.</p><p>I&#39;ve ported over the HLSL to OpenGL, which runs it fine (with the same arithmetic). I think for now I&#39;ll stick with OpenGL, everyone has that nowadays right? <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Fri, 18 Dec 2020 22:09:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Cheers. GLSL it is. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 18 Dec 2020 22:21:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Frustratingly OpenGL with allegro runs a little choppy on my laptop.</p><p>Regardless of complexity (a simple bitmap being blitted at 1280x720), if I run it using DirectX/3D it runs beautifully, if I run it using OpenGL (especially fullscreen) it &quot;judders&quot;, like frames are being missed.</p><p>I&#39;m using the good ol&#39; logic of a timer (1.0 /60) and waiting for event, redraw, etc.</p><p>I suppose my on-board card prefers DirectX to OpenGL when it comes to allegro? </p><p>I looked into using interplation but couldn&#39;t get the math right in my head.</p><p>Any tips? <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Sat, 19 Dec 2020 10:05:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It may be a vsync issue. It&#39;s usually up to the driver to pick whether vsync is on or not, and that usually comes from the system graphics driver settings.</p><p>Guessing DX is better on your laptop, with an integrated chipset.</p><p>Most monitors also refresh on 59.97 HZ, not actually 60.0 .
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 20 Dec 2020 01:34:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I still can&#39;t work out whether it was a vsync issue or a too many frame being drawn issue, but I have found a solution that&#39;s working out really well.</p><p>I create the display as usual using al_create_display, but then I grab a HDC* to the opengl context, and instead of using al_flip_display() as usual, I call SwapBuffers wrapped within a combination of calls to glReadBuffer/glDrawBuffer, to make sure the same frame never gets drawn.</p><p>It&#39;s completely cured the jittery effect, it&#39;s performance now is on par with the Direct3D option.</p><p>Many bothans died to bring us this information, which is another way of saying MAN that took a lot of trial and error (and googling * shouting / fps).</p><p>EDIT:</p><p>And that&#39;s also running smooth with a single shader using 32 lights, just to make it an even better night! <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Mon, 21 Dec 2020 07:16:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I will be very interested to see your code after Krampus is over. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>What&#39;s a few Bothans? :/
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 21 Dec 2020 19:05:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can&#39;t remember what I coded now, but I recall something where I tried out DirectX and OpenGL and found that OpenGL ran at half the frame rate under Allegro.  Not sure what it was off hand now, been a while.  Coded some stuff in straight Windows code + OpenGL and had no problems with some good frame rates.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Fri, 25 Dec 2020 14:19:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s easy enough to get PS_3_0, if you can compile Allegro yourself, just apply this patch:</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k3">-</span><span class="k3">-</span><span class="k3">-</span> a<span class="k3">/</span>src<span class="k3">/</span>win<span class="k3">/</span>d3d_shader.cpp
<span class="number">  2</span><span class="k3">+</span><span class="k3">+</span><span class="k3">+</span> b<span class="k3">/</span>src<span class="k3">/</span>win<span class="k3">/</span>d3d_shader.cpp
<span class="number">  3</span>@@ <span class="k3">-</span><span class="n">47</span>,<span class="n">7</span> <span class="k3">+</span><span class="n">47</span>,<span class="n">7</span> @@ <span class="k1">static</span> <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>technique_source_vertex <span class="k3">=</span>
<span class="number">  4</span>    <span class="s">"{\n"</span>
<span class="number">  5</span>    <span class="s">"   pass p1\n"</span>
<span class="number">  6</span>    <span class="s">"   {\n"</span>
<span class="number">  7</span><span class="k3">-</span>   <span class="s">"      VertexShader = compile vs_2_0 vs_main();\n"</span>
<span class="number">  8</span><span class="k3">+</span>   <span class="s">"      VertexShader = compile vs_3_0 vs_main();\n"</span>
<span class="number">  9</span>    <span class="s">"      PixelShader = null;\n"</span>
<span class="number"> 10</span>    <span class="s">"   }\n"</span>
<span class="number"> 11</span>    <span class="s">"}\n"</span><span class="k2">;</span>
<span class="number"> 12</span>@@ <span class="k3">-</span><span class="n">58</span>,<span class="n">7</span> <span class="k3">+</span><span class="n">58</span>,<span class="n">7</span> @@ <span class="k1">static</span> <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>technique_source_pixel <span class="k3">=</span>
<span class="number"> 13</span>    <span class="s">"   pass p1\n"</span>
<span class="number"> 14</span>    <span class="s">"   {\n"</span>
<span class="number"> 15</span>    <span class="s">"      VertexShader = null;\n"</span>
<span class="number"> 16</span><span class="k3">-</span>   <span class="s">"      PixelShader = compile ps_2_0 ps_main();\n"</span>
<span class="number"> 17</span><span class="k3">+</span>   <span class="s">"      PixelShader = compile ps_3_0 ps_main();\n"</span>
<span class="number"> 18</span>    <span class="s">"   }\n"</span>
<span class="number"> 19</span>    <span class="s">"}\n\n"</span><span class="k2">;</span>
<span class="number"> 20</span>
<span class="number"> 21</span>@@ <span class="k3">-</span><span class="n">67</span>,<span class="n">8</span> <span class="k3">+</span><span class="n">67</span>,<span class="n">8</span> @@ <span class="k1">static</span> <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>technique_source_both <span class="k3">=</span>
<span class="number"> 22</span>    <span class="s">"{\n"</span>
<span class="number"> 23</span>    <span class="s">"   pass p1\n"</span>
<span class="number"> 24</span>    <span class="s">"   {\n"</span>
<span class="number"> 25</span><span class="k3">-</span>   <span class="s">"      VertexShader = compile vs_2_0 vs_main();\n"</span>
<span class="number"> 26</span><span class="k3">-</span>   <span class="s">"      PixelShader = compile ps_2_0 ps_main();\n"</span>
<span class="number"> 27</span><span class="k3">+</span>   <span class="s">"      VertexShader = compile vs_3_0 vs_main();\n"</span>
<span class="number"> 28</span><span class="k3">+</span>   <span class="s">"      PixelShader = compile ps_3_0 ps_main();\n"</span>
<span class="number"> 29</span>    <span class="s">"   }\n"</span>
<span class="number"> 30</span>    <span class="s">"}\n"</span><span class="k2">;</span>
</div></div><p>

Getting 4_0 and 5_0 is more complicated.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sat, 26 Dec 2020 05:34:20 +0000</pubDate>
	</item>
</rss>
