[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Openexr-devel] luts
From: |
Lutz Latta |
Subject: |
Re: [Openexr-devel] luts |
Date: |
Wed, 18 Feb 2004 04:40:35 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 |
The trick is just a speed up of the way you would do it normally with
integer arithmetic on the CPU, using a modulus and integer division.
Since current GPUs don't have such integer arithmetic natively (although
Cg can emulate it), the fastest way is to use the floating point
functions fmod and floor.
Sorry, I was wrong. I overlooked the fact that the value that is split up is
not used as integer, but as floating point with mantissa and exponent. My
suggestion only works for integer values like [0..65535].
I'm afraid that there are probably no easy alternatives to make those kind of
bit manipulations in ARB_fragment_program. You could try to decode the half
value into mantissa and exponent by doing all kinds of multiplication or other
operations, driving it close to its numerical limits. But considering that
other hardware doesn't offer true half operations, this is unlikely to be
portable - if it is possible at all.
Sorry,
Lutz