On Sep 23, 2009, at 4:25 AM, Chris Wood wrote:

I've not tried the openCL side yet (ati 2600 card :( ) but I've hit a
lot of these issues with CI/GLSL before.

First, you need floating point formats. The default is 8bit integer
(RGBA), which uses unsigned integers (0..255), so negatives won't be
handled.

The second big issue is with passing values between shaders. The
'expected range' of a pixel is 0..1. You can use numbers outside this
range (including negatives) within the shader, but passing these
values between shaders can cause issues (I can't remember the
specifics, but I've a feeling this behaviour is 'undefined', meaning
one vendor allows it and the other decides it gets clamped). Perhaps
that was windows-specific issues, but I was advised to always output
in the 0-1 range.

It's pretty trivial to scale the output at least as a worst case -
it's just 'pixel = (pixel / (maxValue * 2.0)) + 0.5;

Chris

OpenCL explicitly allows signed pixel components, and says that read_imagef returns values in the [-1.0 .. 1.0] range for signed pixel components. This is wonderful for parallel computations, and OpenCL is much simpler to write than the equivalent shader code.

I had tweaked the 2D Fluid Simulation patch to use the offset values, but I couldn't believe that it was written to use signed values if they weren't available. After poking around some more, I found that an OpenCL Kernel set to "default" uses whatever it gets. Feeding 8-bit images into the 2D Fluid Simulation forces it to use 8-bit internally, which breaks the computation.

I've re-tweaked the fluid simulator to force the inputs to float. It works properly now. I've parked a copy with a demo wrapped around it here: <http://dl.getdropbox.com/u/297034/2dflow_fixed_v2.qtz.zip>

Thanks for all your help!

 - Stoney
--
Stonewall Ballard
[email protected]           http://stoney.sb.org/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to