speed
September 24, 2006, 8:29am
#1
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
September 24, 2006, 9:59am
#2
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.

32 bit IEEE floats only have 23 bits of mantissa.

Korval
September 25, 2006, 9:45am
#4
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
September 25, 2006, 10:19am
#5
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
September 25, 2006, 10:44am
#6
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
September 27, 2006, 12:56pm
#7
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.