PDA

View Full Version : Float precision with 32F textures



speed
09-24-2006, 09:29 AM
Hello,

Does someone know how many bits are used for the integer part of a float in the 32F textures?

I want to store in a texture integers of minimum 24 bits, but the maximum integer texture are 16 bits, but exists float textures of 32 bits.

Thanks!

AlexN
09-24-2006, 10:59 AM
32F textures can store 24-bit integers because they have 24 bits for their fraction. So it's 24 bits worth of contiguous values, whatever your exponent is. You can get more values if you are using signed integers.

arekkusu
09-25-2006, 09:57 AM
32 bit IEEE floats only have 23 bits of mantissa.

Korval
09-25-2006, 10:45 AM
32 bit IEEE floats only have 23 bits of mantissa.And 1 sign bit, hence 24-bit precision. The other 8 bits are the signed exponent.

I also have to ask: why do you need to store textures with such high precision? What are you doing that needs it?

cass
09-25-2006, 11:19 AM
32 bit IEEE floats have 1 sign bit, 8 exponent bits, and 23 mantissa bits.

But because the format is normalized (except for numbers very close to 0 -- called denorms), there's an implied 1 as the MSB of the mantissa.

So in most circumstances you get 24 bits of mantissa, and you can definitely represent 24 bit unsigned integers.

AlexN
09-25-2006, 11:44 AM
I don't know what the original poster is using this for, but one example is storing an index value alongside positions for sorting.

speed
09-27-2006, 01:56 PM
Thank you very much!

As was mentioned, I need to store the index position to sort my texture. The maximum size of a texture in my card is 4096x4096, and I need 24bits to represent all the positions.