Comment 26 for bug 1173787

Revision history for this message
In , Pierre-Eric Pelloux-Prayer (pelloux) wrote :

> @Pierre: It's a pitty if it doesn get hardware accelerated. Many CAD apps use
> GL_SELECT. Can you please give me a hint on how one would go about implementing
> HW acceleration for it? I'm not sure I'm able to do it, but would be interested
> in playing with it.

I've been toying with this idea for a few hours, and the next attachement will be my current patch bringing sort of HW acceleration for GL_SELECT.
(it should work for any Gallium driver, not only r600g)
** WARNING ** it's experimental AND rough AND buggy but it works well for the specific test case above (Blender + 1 cube + multiresolution modifier level 8) : it reduces selection time from +30 secs to ~1sec.

I'm posting it here even if it's not finished, to get some comments on how it's done and if Mesa/gallium developpers think it's worth the effort.

(please note that left click on 3D view in Blender will crash...)

It's done using :
- an offscreen surface where objects are drawn when in GL_SELECT mode
- a custom pixel shader which outputs object's name + depth in color buffer
- glQueries
- glReadBack of offscreen surface when glQuery is >0 to read back name & z values to feed the selection buffer