PDA

View Full Version : GL_HALF_FLOAT slowdow



Bombata
03-17-2011, 08:47 AM
Hey guys,

I'm porting a GL apps right now on OS X and I've noticed weird slowdowns when I use half float VBOs. The target computer is a new MBP 2011 with an ATI 6750M.

The slowdowns are happening in the glDrawElements function (which takes forever to complete). Since I don't have that problem with 32 bit float VBOs, I wonder if the driver doesn't try to convert the VBOs back to 32 bit before sending the data to the GPU ? I'll try to find a mac with an nv GPU to compare.

I've done a little google search and found nothing interesting. I'm wondering if it is a known problem ?

Thanks

dukey
03-17-2011, 12:03 PM
my guess is the driver converts it to float32

arekkusu
03-17-2011, 05:37 PM
A simple benchmark here doesn't show any difference between half and float:

STATIC_DRAW VBO, Vertex3F Color4UB = ~593 MVerts/sec
STATIC_DRAW VBO, Vertex3F Color4S = ~593 MVerts/sec
STATIC_DRAW VBO, Vertex3F Color4H = ~593 MVerts/sec
STATIC_DRAW VBO, Vertex3F Color4F = ~593 MVerts/sec


Can you give more info about your vertex attributes (all sizes, types, element type) and index count?

Bombata
03-17-2011, 08:04 PM
Thanks arekkusu,

I've done a quick test on a mac with an nvidia 9400M and I've got no slowdown at all (same code, same OS X version), it seems to appear only on the AMD 6750M for now (I can't confirm on other AMD model).

My test mesh vertex attributes are:
position : 3 half
texcoord: 2 half
normal: 3 half
occlusion: 1 half
tangent: 3 half
curvature: 2 half

126290 vertices and 755712 unsigned int indices (It's suzanne model from Blender software with 4 subd).

Do you have an ATI or NV card ?

Alfonse Reinheart
03-17-2011, 09:52 PM
My test mesh vertex attributes are:

Do each of those attributes start on 4-byte boundaries? If not, then they need to.

Your normals and tangent shouldn't be half-floats. Use the new 10_10_10_2 format, with signed normalized integers. That's what it's good for.

Also, what does "occlusion" mean?

Bombata
03-18-2011, 07:13 AM
Thanks for the tips Alfonse,

I didn't know about 10_10_10_2 format looks good !

No my attributes aren't aligned on 4 byte (my old pc's all had nv cards and I've never noticed the problem).

There's another thread discussing that problem (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=236647&page=1).

The occlusion attribute is an ambient occlusion factor baked at each vertex.

Thanks