<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programming with .NET - General</title><link>http://forums.silverlight.net/forums/17.aspx</link><description>General discussions around authoring Silverlight .NET applications.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/239347.aspx</link><pubDate>Mon, 29 Jun 2009 21:13:10 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:239347</guid><dc:creator>ksleung</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/239347.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=239347</wfw:commentRss><description>&lt;p&gt;Andrew,&lt;/p&gt;&lt;p&gt;Wow, great to hear that it can be done!&amp;nbsp; I was looking for how to do that in the last couple of days but couldn&amp;#39;t find anything helpful.&amp;nbsp; I guess I wasn&amp;#39;t familiar enough with DirectX to venture further.&lt;/p&gt;&lt;p&gt;Regardless the pack URI schema...&amp;nbsp; this is a bummer!&amp;nbsp; Hmm...&amp;nbsp; seems like there are two really ugly workarounds:&lt;/p&gt;&lt;p&gt;(1) bounce the byte stream to a server so that you can refer to the URI (I assume it takes any URI, not just packed ones).&lt;/p&gt;&lt;p&gt;(2) have a dynamically create assembly (as a byte stream) such that it contains the ps file as &amp;quot;content&amp;quot; (basically a very simple non-compressing zip file needs to be generated).&amp;nbsp; Load the assembly (I know it takes a byte stream) and now you can refer to content of the assembly.&amp;nbsp; The problem is that I don&amp;#39;t think assemblies are garbage collectible, and so every time a new shader is created, it hogs up some memory (and I don&amp;#39;t know how much).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Under these conditions, would it still be okay to share the code?&amp;nbsp; Even (1) per se could be useful enough. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/239335.aspx</link><pubDate>Mon, 29 Jun 2009 20:42:46 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:239335</guid><dc:creator>planetmarshall</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/239335.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=239335</wfw:commentRss><description>&lt;p&gt;I thought this was an interesting problem and looked into it, but while on the face of it the DirectX DDK provides everything you need to write a compiler, Silverlight just doesn&amp;#39;t provide the infrastructure to use generated pixel shader byte code directly. There is no equivalent to WPF&amp;#39;s PixelShader.SetStreamSource() function. &lt;/p&gt;&lt;p&gt;&amp;nbsp;You can only set pixel shaders using the pack URI schema - if someone can come up with a way to load a dynamically generated byte[] array using a pack URI string, then I&amp;#39;ll happily post some of the basic shader generation code I was working on until I discovered SetStreamSource was missing from the Silverlight API. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; Andrew.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/238673.aspx</link><pubDate>Sat, 27 Jun 2009 15:21:14 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:238673</guid><dc:creator>ksleung</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/238673.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=238673</wfw:commentRss><description>i guess i would like to write that compiler, and it is a simple compiler.&amp;nbsp; For example, only thing it does is ((((((A op1 B) op2 C) op3 D) op4 E) op5 F) op6 G), where say op* being either +, -, *, or /.&amp;nbsp; So the question is what exactly the target byte code looks like.&amp;nbsp; I guess I can always try to reverse-engineer, but I was hoping for a more &amp;quot;correct&amp;#39; approach.&amp;nbsp; Anyway, thanks for your help.&lt;br /&gt;</description></item><item><title>Re: Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/238621.aspx</link><pubDate>Sat, 27 Jun 2009 09:20:58 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:238621</guid><dc:creator>Krasshirsch</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/238621.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=238621</wfw:commentRss><description>You still need a compiler, of course you can write your own, but this will be a project of its own.
There is no ready to use compiler, which works with non native code.
If your interested, perhaps you&amp;#39;ll find something within nvidas developer zone, im pretty sure you wont here. http://developer.nvidia.com/object/cg_toolkit.html</description></item><item><title>Re: Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/238615.aspx</link><pubDate>Sat, 27 Jun 2009 08:41:48 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:238615</guid><dc:creator>ksleung</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/238615.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=238615</wfw:commentRss><description>Not necessarily, since the .ps file could be very small.&amp;nbsp; At the end of the day it is just a byte stream, and I even know what the assembly instructions should be (using ildasm.exe on sample fx files).&lt;br /&gt;</description></item><item><title>Re: Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/238614.aspx</link><pubDate>Sat, 27 Jun 2009 08:36:56 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:238614</guid><dc:creator>Krasshirsch</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/238614.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=238614</wfw:commentRss><description>&lt;p&gt;Generating ps files is not possible without the DX API at the moment.&lt;/p&gt;</description></item><item><title>Dynamically generate pixel shader?</title><link>http://forums.silverlight.net/forums/thread/238594.aspx</link><pubDate>Sat, 27 Jun 2009 06:02:26 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:238594</guid><dc:creator>ksleung</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/238594.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=238594</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;Does anyone know where I can find more details or documentation about the compiled pixel shader format (.ps files)?&amp;nbsp; I am wondering if it is possible for me to dynamically generate pixel shaders by creating the .ps files directly.&amp;nbsp; I am not talking about varying the parameters of a pixel shader (like the WPF effect library).&amp;nbsp; I also cannot dynamically generate .fx files and compile them into .ps files because I want the .ps files to be dynamically generated by the Silverlight application (and I don&amp;#39;t want server-based pixel shader compiler), and I&amp;#39;m willing to write in the assembly level.&lt;/p&gt;&lt;p&gt;I know this is a rather bizzare request and is a long-shot, but who knows, maybe I&amp;#39;d be surprised &lt;img src="http://silverlight.net/emoticons/emotion-4.gif" alt="Stick out tongue" /&gt; &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>