2 Replies Latest reply on May 4, 2010 3:57 PM by AIF Bob

    [BUG] max() function in Flash

    giantneoncowboy

      Hi,

       

      I found a little problem with the built in min() and max() functions with pixel bender in flash.

       

      pixel4 sample = sampleNearest(src,outCoord());

      float causeBug = max(sample.r, sample.b);

      dst = sample;

       

      Basically, with the above code I would expect the output image to be the same as the input image as sample is never modified. The pixel bender toolkit does exactly this. However, in Flash (10.1) the value of the first parameter in the function is modified and the image changes (in this example blues turn purple).

       

      The workaround is to assign off the first parameter to it's own variable before calling the function.

       

      pixel4 sample = sampleNearest(src,outCoord());

      float workaround = sample.r;

      float causeBug = max(workaround, sample.b );

      dst = sample;

       

      The above code produces the same result in both flash and toolkit.

       

      src files: http://deja-visite.com/pixelbender_bug.zip

       

      Cheers,

      Jareth