PixelBender Runtime Compilation

Tinic posted today his PixelBender assembler and disassembler. This makes me happy, because now I can post an experiment I could not show for a while.

If you know PixelBender, than you know that you can not create loops. What you could do is unroll all constant loops with a fixed length. If you know simple convolution filters like a blur, you know that you need an xy-loop and you know it should not be possible with PixelBender at all. Let me prove you wrong and have a look at dynamic loop unrolling with PixelBender (be careful with high values!).

I built a library to assemble and disassemble PixelBender kernels at runtime. I wrapped it also in a high level API so basically you can create a new Kernel by doing var kernel: Kernel = new Kernel();. Then when you need your shader as a ByteArray you simple call kernel.compile(). There are still some glitches here and there but I hope that I can release the source code pretty soon.


  1. Posted Sep 8, 2008 at 11:26 am | Permalink

    Wow, this sounds great! Really looking forward to the release.


  2. D
    Posted Sep 8, 2008 at 2:07 pm | Permalink

    You are really pushing flash forward … this stuff is absolutely awesome

  3. Posted Sep 8, 2008 at 2:52 pm | Permalink

    nice joa,

    i also saw tinic´s blogpost and yeah, that rocks.

    just some quick thoughts to this filter… especially this shader seems to me as you could use it as pbj. several times ( this.image.filters = [ shader1 (x-axis), shader2 (y-axis), …] a.s.o. ?

  4. Posted Sep 8, 2008 at 3:32 pm | Permalink

    You could do this probably. Altough it is much cooler (and more performant) to have the real loop and unroll it at runtime :)

  5. Posted Sep 8, 2008 at 3:46 pm | Permalink

    sure it is… =)

  6. Rezmason
    Posted Sep 24, 2008 at 6:18 pm | Permalink

    I wonder why Adobe hasn’t included in Flash 10 the ability to compile or decompile a pbj file. It’s not the same as decompiling a SWF- they might as well include the functionality.

    Great going, though, figuring it out for yourself! :)

  7. Posted Nov 4, 2008 at 10:07 am | Permalink

    Wow! That’s great, can’t wait to see the results :)

    Any word on when you might be ready to release the source?

    Thank you so much for your contributions.

  8. Janosch
    Posted Jan 3, 2009 at 2:00 pm | Permalink

    Hi Joa, cool idea!
    Are you planning to make the source-code available in the near future?
    Is the input for your compiler compatible with Tinic’s assembler code?

    Happy new year

  9. Posted Mar 15, 2009 at 1:02 am | Permalink

    Hi Joa,

    This is awesome! I was just thinking about writing this same thing for a project I’m working on. What is the status on releasing the source code? Any way you can send me what you have? Thanks!


  10. Posted Mar 15, 2009 at 5:05 pm | Permalink


    Nicolas has released a much better version of the PBJ compilation in haXe already.

5 Trackbacks

  1. […] PixelBender Runtime Compilation […]

  2. By Websites tagged "assembler" on Postsaver on Mar 3, 2009 at 6:17 pm

    […] – PixelBender Runtime Compilation saved by sjwillis2009-02-19 – Guide: How to make an Enhanced Podcast on Windows XP saved by […]

  3. […] you might know I have done a couple of different tools for PixelBender […]

  4. […] you might know I have done a couple of different tools for PixelBender […]

  5. […] you might know I have done a couple of different tools for PixelBender […]