PDA

View Full Version : Half float pro's and con's?



Nowhere-01
05-24-2011, 05:19 AM
Hey, yesterday i thought about replacing my float vertex attributes with half float, so i made it, i used HalfFloat class to store data and GL_HALF_FLOAT when passing to VBO. It was surprisingly easy to implement.

And so i expected at least noticeable performance boost. But really...no difference. I've tested it with 220k triangle model with phong, bump and 3 dynamic lights. Niether on high end system with GTX295 neither on piece of crap with integrated 6150SE it didn't affect performance noticeably.

Maybe it's because badly written shaders? Maybe they could become bottleneck(with scene described above it's 290-512 FPS on GTX295 and about 1-5 on 6150SE. i don't really know how to optimize my phong shading/normal mapping algorithms).

Also i afraid, that it will be incopatible with some adapters.

dukey
05-24-2011, 06:58 AM
maybe you haven't identified where the bottle neck is.
You could be fill rate limited,
shader limited
etc

Alfonse Reinheart
05-24-2011, 07:00 AM
And so i expected at least noticeable performance boost.

Why? Did you verify that your bottleneck was in vertex attribute transference?

Personally, I'd say that half-floats aren't as good as signed normalized integers, so long as you can afford to rescale them properly in your shader.

Nowhere-01
05-24-2011, 07:52 AM
Why? Did you verify that your bottleneck was in vertex attribute transference?

Personally, I'd say that half-floats aren't as good as signed normalized integers, so long as you can afford to rescale them properly in your shader.

Really, i was hoping it will affect overall performance a bit(so i was hoping opengl will not convert it to 4-byte float before processing and leave as it is...somehow). And asked to be convicted it just affects amount data to transfer and works as it should. I couldn't find much info about passing half floats as vertex attributes. If it will not cause any problems i'll leave it. Still a very nice tweak.