0 Replies Latest reply on Mar 2, 2010 1:24 PM by Sirisian

    Suggestion: Macros or a way to unroll loops? Integer array input? Shader Model 3 and 4?

    Sirisian Level 1

      I think it would be nice if pixel bender supported a way to unroll loops. In it's current state certain shaders are really awkward to write or just get ugly when they're converted for flash player. I know it wouldn't be that hard for the developers to just unroll constant sized loops. Things such as:

      for (int i = 0; i < 10; ++i)


        if (foo) { ... }


      can be unrolled easily. Either that or add in some code generation feature that allows this with a preprocessor system. Or better yet add in support for loops since it only requires shader model 3 or equivelant from GLSL.


      This brings me onto another point. Is there going to be support for Shader Model 4? I'm talking about bitwise operations and integer types. Even if you don't allow native support for byte array adding texture sampling for bytes, shorts, and integers would be nice. Also allowing this to work in flash would be nice with the ability to tell the user they don't have shader model 4 or be able to detect compatability and use a different shader.


      Integer arrays would be nice to allow to as input then to the shader. I noticed the reference manual already mentioned:

      "NOTE: Pixel Bender 1.0 supports only arrays of floats, and the array size is a compile-time constant. Future versions of Pixel Bender will allow arrays to be declared with a size based on kernel parameters, which will enable parameter-dependent look-up table sizes."

      Again support for these features in flash player would be really nice.


      Targetting the lowest GPUs is really limiting the true power of pixel bender. I wrote this for fun: http://assaultwars.com/pictures/raycasting6.png which is just a simple real-time voxel raycaster. However, it could be so much more powerful if pixel bender supported more of the GPUs features. Even simple things like custom functions would be really handy in flash player. I'm thinking of this more oriented toward flash games too where more powerful features are unlocked based on the user's GPU.


      If this is already planned for a future pixel bender release then nevermind. I didn't see a developers blog or any news about future versions.




      Apparently Kevin said "Look for them in a future version of the language as cards that support  these features become common." in regards to bitwise operators aka Shader Model 4.