<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Compiling HLSL into GLSL in 2010</title>
	<atom:link href="http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/feed/" rel="self" type="application/rss+xml" />
	<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/</link>
	<description>Random thoughts of a triangle pusher</description>
	<lastBuildDate>Thu, 09 Feb 2012 07:56:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Lettiq</title>
		<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/comment-page-1/#comment-33307</link>
		<dc:creator>Lettiq</dc:creator>
		<pubDate>Tue, 08 Jun 2010 22:44:39 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=523#comment-33307</guid>
		<description>I was able to do exactly what you&#039;re trying to achieve. For my home project I have a number of cookers, each of them for a single platform (similar to yours, except I prefer GLSL over ARB). During a processing time (can be offline) the cooker loads a HLSL shader using Cg, process it and submit to a library that saves shaders in a unified file taking care of endianess and stuff. I&#039;ve been using FX file format for my shaders, mostly as it is simple to manage and good enough to convert to various platforms (using given API or Cg). So, the GLSL cooker uses cgCreateEffectFromFile then iterates thru its techniques, passes and parameters getting all the important data to speed up loading time and finally get the shaders code using cgGetProgramString. The GLSL code looks a little weird but it works. However I am still fighting with getting vertex attributes instead of gl_Vertex &amp; Co. Drop me an email if need more details. Cheers!</description>
		<content:encoded><![CDATA[<p>I was able to do exactly what you&#8217;re trying to achieve. For my home project I have a number of cookers, each of them for a single platform (similar to yours, except I prefer GLSL over ARB). During a processing time (can be offline) the cooker loads a HLSL shader using Cg, process it and submit to a library that saves shaders in a unified file taking care of endianess and stuff. I&#8217;ve been using FX file format for my shaders, mostly as it is simple to manage and good enough to convert to various platforms (using given API or Cg). So, the GLSL cooker uses cgCreateEffectFromFile then iterates thru its techniques, passes and parameters getting all the important data to speed up loading time and finally get the shaders code using cgGetProgramString. The GLSL code looks a little weird but it works. However I am still fighting with getting vertex attributes instead of gl_Vertex &amp; Co. Drop me an email if need more details. Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/comment-page-1/#comment-32429</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Tue, 25 May 2010 11:38:51 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=523#comment-32429</guid>
		<description>@Dimi: because GLSL sucks? :)

Seriously though, if we put mobile platforms aside, here&#039;s what we use in Unity in 2010:
* Windows: D3D9 (assembly shaders, compiled from HLSL)
* Mac: OpenGL (ARB assembly shaders, compiled from Cg)
* Xbox 360: HLSL is the only option
* PlayStation 3: Cg is the only option

See? None of the platforms, &lt;em&gt;except&lt;/em&gt; mobile platforms with OpenGL ES 2.0 use GLSL. If GLES2.0 would have another option for shaders, we&#039;d gladly use it.

Why we aren&#039;t using GLSL on OpenGL (Mac)? Because for a very long time, it was unstable as jello. Mysterious bugs in GLSL parser/optimizer, unpredictable runtime behavior, etc. There&#039;s just a lot less hidden pitfalls when using ARB assembly shaders. &lt;em&gt;Maybe&lt;/em&gt; for Unity 3.0 we&#039;ll switch to GLSL on Mac by default, but that is still up in the air.</description>
		<content:encoded><![CDATA[<p>@Dimi: because GLSL sucks? :)</p>
<p>Seriously though, if we put mobile platforms aside, here&#8217;s what we use in Unity in 2010:<br />
* Windows: D3D9 (assembly shaders, compiled from HLSL)<br />
* Mac: OpenGL (ARB assembly shaders, compiled from Cg)<br />
* Xbox 360: HLSL is the only option<br />
* PlayStation 3: Cg is the only option</p>
<p>See? None of the platforms, <em>except</em> mobile platforms with OpenGL ES 2.0 use GLSL. If GLES2.0 would have another option for shaders, we&#8217;d gladly use it.</p>
<p>Why we aren&#8217;t using GLSL on OpenGL (Mac)? Because for a very long time, it was unstable as jello. Mysterious bugs in GLSL parser/optimizer, unpredictable runtime behavior, etc. There&#8217;s just a lot less hidden pitfalls when using ARB assembly shaders. <em>Maybe</em> for Unity 3.0 we&#8217;ll switch to GLSL on Mac by default, but that is still up in the air.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dimi</title>
		<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/comment-page-1/#comment-32426</link>
		<dc:creator>Dimi</dc:creator>
		<pubDate>Tue, 25 May 2010 10:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=523#comment-32426</guid>
		<description>I dont understand why an engine like Unity with roots in the Mac/OS should use HLSL at all.
Why not use GLSL for everything and port to HLSL only for XBox.</description>
		<content:encoded><![CDATA[<p>I dont understand why an engine like Unity with roots in the Mac/OS should use HLSL at all.<br />
Why not use GLSL for everything and port to HLSL only for XBox.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: n00body</title>
		<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/comment-page-1/#comment-32392</link>
		<dc:creator>n00body</dc:creator>
		<pubDate>Mon, 24 May 2010 20:09:10 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=523#comment-32392</guid>
		<description>No, right now I am doing the compilation at runtime. Currently, I am writing my own renderer so I can experiment with various rendering techniques to test their merit. Since my focus is deferred rendering, I don&#039;t have a lot of shader combinations. So shader compilation at runtime hasn&#039;t really been an issue thus far.

Ultimately, I guess my suggestion isn&#039;t applicable to your situation.</description>
		<content:encoded><![CDATA[<p>No, right now I am doing the compilation at runtime. Currently, I am writing my own renderer so I can experiment with various rendering techniques to test their merit. Since my focus is deferred rendering, I don&#8217;t have a lot of shader combinations. So shader compilation at runtime hasn&#8217;t really been an issue thus far.</p>
<p>Ultimately, I guess my suggestion isn&#8217;t applicable to your situation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/comment-page-1/#comment-32355</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Mon, 24 May 2010 04:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=523#comment-32355</guid>
		<description>I want the compilation to happen purely offline. With Cg&#039;s GLSL translator, it seems to be designed to be used at runtime (so you&#039;d use Cg runtime functions to manage programs, set uniforms etc.). I don&#039;t want to ship Cg runtime in my runtime :) (and Cg runtime on some platforms does not exist, e.g. iPhone or Android).

Were you doing Cg to GLSL cross-compilation offline, without using the runtime?</description>
		<content:encoded><![CDATA[<p>I want the compilation to happen purely offline. With Cg&#8217;s GLSL translator, it seems to be designed to be used at runtime (so you&#8217;d use Cg runtime functions to manage programs, set uniforms etc.). I don&#8217;t want to ship Cg runtime in my runtime :) (and Cg runtime on some platforms does not exist, e.g. iPhone or Android).</p>
<p>Were you doing Cg to GLSL cross-compilation offline, without using the runtime?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: n00body</title>
		<link>http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/comment-page-1/#comment-32348</link>
		<dc:creator>n00body</dc:creator>
		<pubDate>Mon, 24 May 2010 03:04:08 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=523#comment-32348</guid>
		<description>Actually, I&#039;ve been able to get Cg to produce working GLSL. I&#039;m curious what went wrong with yours. Did you make sure to use cgCombinePrograms()?</description>
		<content:encoded><![CDATA[<p>Actually, I&#8217;ve been able to get Cg to produce working GLSL. I&#8217;m curious what went wrong with yours. Did you make sure to use cgCombinePrograms()?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

