by Kevin Goldsmith


April 1, 2010

Did you know that you could use C-Style macros in Pixel Bender? This capability has always been there, but Ralph Hauwert pointed out to me that we haven’t really told folks about it. Similar to with a C-Compiler, these macros essentially are replaced with the code that is defined by them. Since it happens in the Pixel Bender pre-processor, it works fine for Pixel Bender bytecode too.

Just a little Pixel Bender tip for your Thursday coding.

Here is an example:

kernel NewFilter
<   namespace : "Your Namespace";
    vendor : "Your Vendor";
    version : 1;
    description : "your description";>
    input image4 src;
    output pixel4 dst;
    #define Blah(clr) clr.r = 1.0;

        dst = sampleNearest(src,outCoord());